Hi all,
A while back I looked into creating dynamic patch cords to connect audio components. I wrote a simple test program that took USB audio in, connected it directly to line out, then swapped left and right channels. It worked. I shelved it for awhile, then pulled it back out recently. Here's some relevant code:
These functions worked ok.
I'm now trying to integrate this functionality into a much more complex application, and I think I've found a problem. While I'm still fairly certain this is a problem with something I'm doing, what I'm finding is that if the device I'm trying to disconnect has a second patch cord attached to it things get a little more questionable. Sometimes it seems to work partially in that one of the two will disconnect.
I'm still trying to properly characterize this, but so far every combination of static or dynamic patch cord has failed when paired with a dynamic patch on a single output terminal. So far it seems that this happens when I have one statically defined patch and one that I try to connect and disconnect. It happens when I have two dynamically defined patches but only try to connect/disconnect one of them. And it happens when I have two dynamically defined ones that both get connected and disconnected at the same time.
I will report back as I learn more, but so far does this match anyone else's experience, or does anyone know of a reason why this is happening? I am really not sure what to try next, so for now I'm off to bed. I'm hoping someone can give me a bit of a steer, I feel a bit lost on this.
Thank you!
A while back I looked into creating dynamic patch cords to connect audio components. I wrote a simple test program that took USB audio in, connected it directly to line out, then swapped left and right channels. It worked. I shelved it for awhile, then pulled it back out recently. Here's some relevant code:
Code:
// Dynamic Patch Definition
AudioConnection* pUSB1_0s;
AudioConnection* pUSB1_1s;
AudioConnection* pUSB1_0c;
AudioConnection* pUSB1_1c;
void usb_in_setup() // Setup USB in patches
{
pUSB1_0c = new AudioConnection(usb1, 0, i2s1, 1);
pUSB1_1c = new AudioConnection(usb1, 1, i2s1, 0);
pUSB1_0c -> disconnect();
pUSB1_1c -> disconnect();
pUSB1_0s = new AudioConnection(usb1, 0, i2s1, 0);
pUSB1_1s = new AudioConnection(usb1, 1, i2s1, 1);
pUSB1_0s -> disconnect();
pUSB1_1s -> disconnect();
}
void usb_in_straight(void) //USB input straight to output
{
if(pUSB1_0c && pUSB1_1c)
{
pUSB1_0c -> disconnect();
pUSB1_1c -> disconnect();
pUSB1_0s -> connect();
pUSB1_1s -> connect();
}
}
void usb_in_cross(void) //USB input cross to output
{
if(pUSB1_0s && pUSB1_1s)
{
pUSB1_0s -> disconnect();
pUSB1_1s -> disconnect();
pUSB1_0c -> connect();
pUSB1_1c -> connect();
}
}
These functions worked ok.
I'm now trying to integrate this functionality into a much more complex application, and I think I've found a problem. While I'm still fairly certain this is a problem with something I'm doing, what I'm finding is that if the device I'm trying to disconnect has a second patch cord attached to it things get a little more questionable. Sometimes it seems to work partially in that one of the two will disconnect.
I'm still trying to properly characterize this, but so far every combination of static or dynamic patch cord has failed when paired with a dynamic patch on a single output terminal. So far it seems that this happens when I have one statically defined patch and one that I try to connect and disconnect. It happens when I have two dynamically defined patches but only try to connect/disconnect one of them. And it happens when I have two dynamically defined ones that both get connected and disconnected at the same time.
I will report back as I learn more, but so far does this match anyone else's experience, or does anyone know of a reason why this is happening? I am really not sure what to try next, so for now I'm off to bed. I'm hoping someone can give me a bit of a steer, I feel a bit lost on this.
Thank you!