diff --git a/module_usb_audio/endpoint0/audiorequests.xc b/module_usb_audio/endpoint0/audiorequests.xc index dda0b2de..f42652d6 100644 --- a/module_usb_audio/endpoint0/audiorequests.xc +++ b/module_usb_audio/endpoint0/audiorequests.xc @@ -1105,40 +1105,49 @@ int AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c return result; } - if(datalength == 2) + unitID = sp.wIndex >> 8; + + switch ((sp.wValue>>8) & 0xff) { - unitID = sp.wIndex >> 8; + case FU_VOLUME_CONTROL: - if (unitID == FU_USBOUT) - { - switch ((sp.wValue>>8) & 0xff) + if(datalength == 2) { - case FU_VOLUME_CONTROL: - volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); - updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); - return XUD_DoSetRequestStatus(ep0_in); - case FU_MUTE_CONTROL: - mutesOut[ sp.wValue & 0xff ] = buffer[0]; - updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); - return XUD_DoSetRequestStatus(ep0_in); + switch(unitID) + { + case FU_USBOUT: + volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); + updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); + return XUD_DoSetRequestStatus(ep0_in); + + case FU_USBIN: + volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); + updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); + return XUD_DoSetRequestStatus(ep0_in); + } } - } - else if (unitID == FU_USBIN) - { - switch ((sp.wValue>>8) & 0xff) - { - case FU_VOLUME_CONTROL: - volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); - updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); - return XUD_DoSetRequestStatus(ep0_in); - case FU_MUTE_CONTROL: - mutesIn[ sp.wValue & 0xff ] = buffer[0]; - updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); - return XUD_DoSetRequestStatus(ep0_in); + break; + + case FU_MUTE_CONTROL: + + if(datalength == 1) + { + switch(unitID) + { + case FU_USBOUT: + mutesOut[ sp.wValue & 0xff ] = buffer[0]; + updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); + return XUD_DoSetRequestStatus(ep0_in); + + case FU_USBIN: + mutesIn[ sp.wValue & 0xff ] = buffer[0]; + updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); + return XUD_DoSetRequestStatus(ep0_in); + } } - } + break; } - break; + break; } case UAC_B_REQ_GET_CUR: {