forked from PAWPAW-Mirror/lib_xua
Fixed issue setting mix maps (#308)
This commit is contained in:
@@ -660,72 +660,67 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
#if ((MIXER) && (MAX_MIX_COUNT > 0))
|
#if ((MIXER) && (MAX_MIX_COUNT > 0))
|
||||||
case ID_XU_OUT:
|
case ID_XU_OUT:
|
||||||
{
|
{
|
||||||
|
int dst = sp.wValue & 0xff;
|
||||||
|
|
||||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||||
{
|
{
|
||||||
unsigned volume = 0;
|
|
||||||
int c = sp.wValue & 0xff;
|
|
||||||
|
|
||||||
|
|
||||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
channelMapAud[c] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
if (dst < NUM_USB_CHAN_OUT)
|
||||||
|
{
|
||||||
|
channelMapAud[dst] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||||
|
|
||||||
if (!isnull(c_mix_ctl))
|
if (!isnull(c_mix_ctl))
|
||||||
{
|
{
|
||||||
if (c < NUM_USB_CHAN_OUT)
|
UpdateMixerOutputRouting(c_mix_ctl, SET_SAMPLES_TO_DEVICE_MAP, dst, channelMapAud[dst]);
|
||||||
{
|
}
|
||||||
UpdateMixerOutputRouting(c_mix_ctl, SET_SAMPLES_TO_DEVICE_MAP, c, channelMapAud[c]);
|
}
|
||||||
|
|
||||||
/* Send 0 Length as status stage */
|
/* Send 0 Length as status stage */
|
||||||
return XUD_DoSetRequestStatus(ep0_in);
|
return XUD_DoSetRequestStatus(ep0_in);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(buffer, unsigned char[])[0] = channelMapAud[sp.wValue & 0xff];
|
(buffer, unsigned char[])[0] = channelMapAud[dst];
|
||||||
(buffer, unsigned char[])[1] = 0;
|
(buffer, unsigned char[])[1] = 0;
|
||||||
|
|
||||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_XU_IN:
|
case ID_XU_IN:
|
||||||
|
{
|
||||||
|
int dst = sp.wValue & 0xff;
|
||||||
|
|
||||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D) /* Direction: Host-to-device */
|
||||||
{
|
{
|
||||||
unsigned volume = 0;
|
|
||||||
int c = sp.wValue & 0xff;
|
|
||||||
|
|
||||||
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
if((result = XUD_GetBuffer(ep0_out, (buffer, unsigned char[]), datalength)) != XUD_RES_OKAY)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
channelMapUsb[c] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
if (dst < NUM_USB_CHAN_IN)
|
||||||
|
|
||||||
if (c < NUM_USB_CHAN_IN)
|
|
||||||
{
|
{
|
||||||
|
channelMapUsb[dst] = (buffer, unsigned char[])[0] | (buffer, unsigned char[])[1] << 8;
|
||||||
|
|
||||||
if (!isnull(c_mix_ctl))
|
if (!isnull(c_mix_ctl))
|
||||||
{
|
{
|
||||||
UpdateMixerOutputRouting(c_mix_ctl, SET_SAMPLES_TO_HOST_MAP, c, channelMapUsb[c]);
|
UpdateMixerOutputRouting(c_mix_ctl, SET_SAMPLES_TO_HOST_MAP, dst, channelMapUsb[dst]);
|
||||||
|
}
|
||||||
|
}
|
||||||
return XUD_DoSetRequestStatus(ep0_in);
|
return XUD_DoSetRequestStatus(ep0_in);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Direction: Device-to-host */
|
/* Direction: Device-to-host */
|
||||||
(buffer, unsigned char[])[0] = channelMapUsb[sp.wValue & 0xff];
|
(buffer, unsigned char[])[0] = channelMapUsb[dst];
|
||||||
(buffer, unsigned char[])[1] = 0;
|
(buffer, unsigned char[])[1] = 0;
|
||||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), sp.wLength, sp.wLength);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_XU_MIXSEL:
|
case ID_XU_MIXSEL:
|
||||||
@@ -751,14 +746,12 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
/* cs now contains mix number */
|
/* cs now contains mix number */
|
||||||
if(cs < (MAX_MIX_COUNT + 1))
|
if(cs < (MAX_MIX_COUNT + 1))
|
||||||
{
|
{
|
||||||
|
int source = (buffer, unsigned char[])[0];
|
||||||
|
|
||||||
/* Check for "off" - update local state */
|
/* Check for "off" - update local state */
|
||||||
if((buffer, unsigned char[])[0] == 0xFF)
|
if(source == 0xFF)
|
||||||
{
|
{
|
||||||
mixSel[cs][cn] = (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
|
source = (NUM_USB_CHAN_OUT + NUM_USB_CHAN_IN + MAX_MIX_COUNT);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mixSel[cs][cn] = (buffer, unsigned char[])[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cs == 0)
|
if(cs == 0)
|
||||||
@@ -768,14 +761,15 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
{
|
{
|
||||||
/* i : Mix bus */
|
/* i : Mix bus */
|
||||||
/* cn: Mixer input */
|
/* cn: Mixer input */
|
||||||
/* mixSel[i][cn]): Source */
|
mixSel[i][cn] = source;
|
||||||
UpdateMixMap(c_mix_ctl, i, cn, (int) mixSel[cn]);
|
UpdateMixMap(c_mix_ctl, i, cn, mixSel[i][cn]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Update relevant mix map */
|
/* Update relevant mix map */
|
||||||
UpdateMixMap(c_mix_ctl, cs-1, cn, (int) mixSel[cs][cn]);
|
mixSel[cn-1][cn] = source;
|
||||||
|
UpdateMixMap(c_mix_ctl, cs-1, cn, mixSel[cs-1][cn]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return XUD_DoSetRequestStatus(ep0_in);
|
return XUD_DoSetRequestStatus(ep0_in);
|
||||||
|
|||||||
Reference in New Issue
Block a user