Self-connection
Self-connection
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...)
Re: Self-connection
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
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
Dome Music Technologies
Re: Self-connection
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".
Re: Self-connection
You could maybe keep track of cables connected by monitoring the longValue in Notify?
Check that the value of component equals the input or output jack.
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
Dome Music Technologies
Re: Self-connection
Sounds fragile to me as multiple cables can be plugged into the same socket.
Re: Self-connection
Please be aware that a Jack_Disconnected notification is only called when ALL cables to a jack have been disconnected.
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.
Code: Select all
case Jack_Disconnected: // All cables have been disconnected from this jack
{
}
break;
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.
Posted just as I was writing a reply. Great minds, Colin!
______________________
Dome Music Technologies
Dome Music Technologies
-
- Posts: 625
- Joined: Mon Nov 15, 2021 9:23 pm
Re: Self-connection
Fragile for another reason: the loop-back might not be a simple cable, but may contain other processing, i.e., other modules.
Reid
Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Re: Self-connection
But then the cable ID would be different.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
BTW I've not checked that the cable IDs are actually available. Some things in the API don't work as one might hope.
Re: Self-connection
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).