I have challenge while trying to use 2xSpdifReceive().
Original project architecture is:
Code: Select all
XMOS input port -> spdifReceive(channel) -> clockGen(channel) -> ... -> mixer() -> USB recording
My idea is:
Code: Select all
XMOS input port1 -> spdifReceive(ch1) -\
-> clockGen(ch1, ch2) -> ... -> mixer() -> USB rec
XMOS input port2 -> spdifReceive(ch2) -/
spdifReceive() is written in asm, so I try to add input switching into
clockGen().
Code: Select all
void clockGen(channel) - original
{
...
while(1)
{
select
{
case ...:
case ...:
/* Receive sample from S/PDIF RX thread (steaming chan) */
case channel:> tmp:
...
break;
} // eo select
}// eo while
}
Index of current input I send from
AudioClassRequests_1() to
clockGen() via already existing
c_clk_ctl channel.
The challenge is how to add if(index == INPUT_1) into select statement.
I want to realize something like this:
Code: Select all
void clockGen(ch1, ch2, c_clk_ctl)
{
unsigned char index;
while(1)
{
select
{
...
case c_clk_clk event:
get index from c_clk_ctl channel
break;
if (index == INPUT_1)
{
/* Receive sample from S/PDIF rx port */
case ch1 :> tmp:
}
else
{
/* Receive sample from AES/EBU rx port */
case ch2 :> tmp:
}
...
break;
} // eo select
}// eo while
}
The only way I can realize it is:
Code: Select all
void clockGen(ch1, ch2, c_clk_ctl)
{
unsigned char index;
while(1)
{
if (index == INPUT_1)
{
select
{
...
case c_clk_clk event:
get index from c_clk_ctl channel
break;
/* Receive sample from S/PDIF rx port */
case ch1 :> tmp:
} // eo select
}
else
{
select
{
...
case c_clk_clk event:
get index from c_clk_ctl channel
break;
/* Receive sample from AES/EBU rx port */
case ch2 :> tmp:
...
break;
} // eo select
}// eo if
}// eo while
}
But it doesn't work.:( No sound from both digital inputs.
Can anybody recommend me code contruction to switch inputs in clockGen()?
P.S. There is workaround to pass audio samples from both digital inputs to mixer() and switch inputs there, but this is an extreme case.