Each mix can now have a unique mix-map (with 0 as a "master")

This commit is contained in:
Ross Owen
2014-09-11 12:39:19 +01:00
parent ae85f31e22
commit b185f0183c
3 changed files with 44 additions and 17 deletions

View File

@@ -1,6 +1,12 @@
sc_usb_audio Change Log
=======================
HEAD
----
- CHANGE: Modifying mix map now only affects specified mix, previous was applied to all
mixes. CS_XU_MIXSEL control selector now takes values 0 to MAX_MIX_COUNT + 1
(with 0 affecting all mixes).
6.8.0
-----
- ADDED: Evaluation support for iAP EA Native Transport endpoints

View File

@@ -40,7 +40,7 @@ extern unsigned char channelMapAud[NUM_USB_CHAN_OUT];
extern unsigned char channelMapUsb[NUM_USB_CHAN_IN];
/* Mixer input mapping */
extern unsigned char mixSel[MIX_INPUTS];
extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS];
#endif
/* Global var for current frequency, set to default freq */
@@ -687,23 +687,42 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
/* cn bounds check for safety..*/
if(cn < MIX_INPUTS)
{
if(cs == CS_XU_MIXSEL)
//if(cs == CS_XU_MIXSEL)
/* cs now contains mix number */
if(cs < (MAX_MIX_COUNT + 1))
{
/* Check for "off" - update local state */
if(buffer[0] == 0xFF)
mixSel[cn] = (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
else
mixSel[cn] = buffer[0];
/* Update all mix maps */
for (int i = 0; i < MAX_MIX_COUNT; i++)
{
outuint(c_mix_ctl, SET_MIX_MAP);
outuint(c_mix_ctl, i); /* Mix bus */
outuint(c_mix_ctl, cn); /* Mixer input */
outuint(c_mix_ctl, (int) mixSel[cn]); /* Source */
outct(c_mix_ctl, XS1_CT_END);
mixSel[cs][cn] = (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
}
else
{
mixSel[cs][cn] = buffer[0];
}
if(cs == 0)
{
/* Update all mix maps */
for (int i = 0; i < MAX_MIX_COUNT; i++)
{
outuint(c_mix_ctl, SET_MIX_MAP);
outuint(c_mix_ctl, i); /* Mix bus */
outuint(c_mix_ctl, cn); /* Mixer input */
outuint(c_mix_ctl, (int) mixSel[cn]); /* Source */
outct(c_mix_ctl, XS1_CT_END);
}
}
else
{
/* Update relevant mix map */
outuint(c_mix_ctl, SET_MIX_MAP); /* Command */
outuint(c_mix_ctl, (cs-1)); /* Mix bus */
outuint(c_mix_ctl, cn); /* Mixer input */
outuint(c_mix_ctl, (int) mixSel[cs][cn]); /* Source */
outct(c_mix_ctl, XS1_CT_END); /* Wait for handshake back */
}
return XUD_DoSetRequestStatus(ep0_in);
}
}
@@ -718,9 +737,10 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
if(cn < MIX_INPUTS)
{
/* Inspect control selector */
if(cs == CS_XU_MIXSEL)
/* TODO ideally have a return for cs = 0. I.e all mix maps */
if((cs > 0) && (cs < (MAX_MIX_COUNT+1)))
{
buffer[0] = mixSel[cn];
buffer[0] = mixSel[cs-1][cn];
return XUD_DoGetRequest(ep0_out, ep0_in, buffer, 1, 1 );
}
}

View File

@@ -78,7 +78,7 @@ short mixer1Weights[18*8];
unsigned char channelMap[NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT];
unsigned char channelMapAud[NUM_USB_CHAN_OUT];
unsigned char channelMapUsb[NUM_USB_CHAN_IN];
unsigned char mixSel[MIX_INPUTS];
unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS];
#endif
int min(int x, int y);
@@ -221,9 +221,10 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
#endif
/* Init mixer inputs */
for(int j = 0; j < MAX_MIX_COUNT; j++)
for(int i = 0; i < MIX_INPUTS; i++)
{
mixSel[i] = i;
mixSel[j][i] = i;
}
#endif