Self-connection

Post Reply
poetix
Posts: 54
Joined: Mon Nov 28, 2022 3:26 pm

Self-connection

Post by poetix »

I think the anwer to this is "no", but just checking just in case: in the case that I have an output jack of my module patched into an input jack of the same module, is there any way to detect that it's the same cable at both ends? Use case: an oversampled oscillator, where rather than sending a signal at normal sample rate through the VM system I might want to detect when I'm self-connected and take the higher sample-rate output as an input via an internal patch matrix. (Obviously there are other ways to do it if not...)
London, UK
Developer, Vulpus Labs
Musician, w/trem
User avatar
utdgrant
Posts: 536
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Self-connection

Post by utdgrant »

Have you read through the Documentation pack?

Voltage-Developer-Kit-2.7.0/Documentation/JavaDocs/voltage/core/AudioJack.html

makes reference to a Connect method, which has an object of class VoltageCable as its parameter.

I don't really have the time to dig further at the moment, but it might be a good starting point?


Grant
______________________
Dome Music Technologies
poetix
Posts: 54
Joined: Mon Nov 28, 2022 3:26 pm

Re: Self-connection

Post by poetix »

Yeah, nothing usable there unfortunately (I'm not sure how you'd ever use that function from inside a module...). I think that means the answer is "no".
London, UK
Developer, Vulpus Labs
Musician, w/trem
User avatar
utdgrant
Posts: 536
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Self-connection

Post by utdgrant »

You could maybe keep track of cables connected by monitoring the longValue in Notify?

Code: Select all

      case Jack_Connected:   // longValue is the new cable ID
      {
      }
      break;


Check that the value of component equals the input or output jack.
______________________
Dome Music Technologies
poetix
Posts: 54
Joined: Mon Nov 28, 2022 3:26 pm

Re: Self-connection

Post by poetix »

Ooh, that'll do it - thanks!
London, UK
Developer, Vulpus Labs
Musician, w/trem
ColinP
Posts: 940
Joined: Mon Aug 03, 2020 7:46 pm

Re: Self-connection

Post by ColinP »

Sounds fragile to me as multiple cables can be plugged into the same socket.
User avatar
utdgrant
Posts: 536
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Self-connection

Post by utdgrant »

Please be aware that a Jack_Disconnected notification is only called when ALL cables to a jack have been disconnected.

Code: Select all

      case Jack_Disconnected:   // All cables have been disconnected from this jack
      {
      }
      break;
Consider the situation that a user already has one cable going into the input jack (from an LFO, say). Also, the output jack already has one cable coming from it (to Main Out Left, say).

Then they connect a loopback cable from the output jack to the input jack, two Jack_Connected notifications will be triggered (one event for each jack).
You'd be able to tell that the loopback path was being requested because both longValues would have the same cable ID.
I would imagine that your code would stop reading the GetValue of the input jack (from the LFO) and start using the oversampled 'internal' signal.

If the user then removed the loopback cable while the LFO cable and Main Out Left were still connected, there would be no notification events generated. In that situation, I think your code would 'think' that the loopback cable was still in place, and so would continue to use the 'internal' signal, rather than reverting to the LFO.

I'm not sure if there's a way to interrogate a jack to enumerate all the cables connected to it. I can't see anything obvious in the documentation, yet.
ColinP wrote: Mon Feb 06, 2023 8:09 pmSounds fragile to me as multiple cables can be plugged into the same socket.
Posted just as I was writing a reply. Great minds, Colin! :lol:
______________________
Dome Music Technologies
UrbanCyborg
Posts: 589
Joined: Mon Nov 15, 2021 9:23 pm

Re: Self-connection

Post by UrbanCyborg »

Fragile for another reason: the loop-back might not be a simple cable, but may contain other processing, i.e., other modules.

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
ColinP
Posts: 940
Joined: Mon Aug 03, 2020 7:46 pm

Re: Self-connection

Post by ColinP »

UrbanCyborg wrote: Mon Feb 06, 2023 8:50 pm Fragile for another reason: the loop-back might not be a simple cable, but may contain other processing, i.e., other modules.

Reid
But then the cable ID would be different.

BTW I've not checked that the cable IDs are actually available. Some things in the API don't work as one might hope.
poetix
Posts: 54
Joined: Mon Nov 28, 2022 3:26 pm

Re: Self-connection

Post by poetix »

It does look like if you want to configure an internal routing matrix there are better ways to do it (I'm thinking of the way Sines does it, for example).
London, UK
Developer, Vulpus Labs
Musician, w/trem
Post Reply

Return to “Module Designer”