forked from PAWPAW-Mirror/lib_xua
INPUT_VOLUME_CONTROL now affects descriptors and processing in decouple()
This commit is contained in:
@@ -840,7 +840,7 @@ typedef struct
|
|||||||
#ifdef OUTPUT
|
#ifdef OUTPUT
|
||||||
/* Output path */
|
/* Output path */
|
||||||
USB_Descriptor_Audio_InputTerminal_t Audio_Out_InputTerminal;
|
USB_Descriptor_Audio_InputTerminal_t Audio_Out_InputTerminal;
|
||||||
#if(OUTPUT_VOLUME_CONTROL==1)
|
#if(OUTPUT_VOLUME_CONTROL == 1)
|
||||||
USB_Descriptor_Audio_FeatureUnit_Out_t Audio_Out_FeatureUnit;
|
USB_Descriptor_Audio_FeatureUnit_Out_t Audio_Out_FeatureUnit;
|
||||||
#endif
|
#endif
|
||||||
USB_Descriptor_Audio_OutputTerminal_t Audio_Out_OutputTerminal;
|
USB_Descriptor_Audio_OutputTerminal_t Audio_Out_OutputTerminal;
|
||||||
@@ -848,7 +848,9 @@ typedef struct
|
|||||||
#ifdef INPUT
|
#ifdef INPUT
|
||||||
/* Input path */
|
/* Input path */
|
||||||
USB_Descriptor_Audio_InputTerminal_t Audio_In_InputTerminal;
|
USB_Descriptor_Audio_InputTerminal_t Audio_In_InputTerminal;
|
||||||
|
#if(INPUT_VOLUME_CONTROL == 1)
|
||||||
USB_Descriptor_Audio_FeatureUnit_In_t Audio_In_FeatureUnit;
|
USB_Descriptor_Audio_FeatureUnit_In_t Audio_In_FeatureUnit;
|
||||||
|
#endif
|
||||||
USB_Descriptor_Audio_OutputTerminal_t Audio_In_OutputTerminal;
|
USB_Descriptor_Audio_OutputTerminal_t Audio_In_OutputTerminal;
|
||||||
#endif
|
#endif
|
||||||
} __attribute__((packed)) USB_CfgDesc_Audio2_CS_Control_Int;
|
} __attribute__((packed)) USB_CfgDesc_Audio2_CS_Control_Int;
|
||||||
@@ -1212,6 +1214,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
.iTerminal = 0,
|
.iTerminal = 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#if (INPUT_VOLUME_CONTROL == 1)
|
||||||
.Audio_In_FeatureUnit =
|
.Audio_In_FeatureUnit =
|
||||||
{
|
{
|
||||||
.bLength = sizeof(USB_Descriptor_Audio_FeatureUnit_In_t),
|
.bLength = sizeof(USB_Descriptor_Audio_FeatureUnit_In_t),
|
||||||
@@ -1285,20 +1288,26 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
},
|
},
|
||||||
0, /* 60 iFeature */
|
0, /* 60 iFeature */
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
|
|
||||||
.Audio_In_OutputTerminal =
|
.Audio_In_OutputTerminal =
|
||||||
{
|
{
|
||||||
/* Output Terminal Descriptor (USB Streaming) */
|
/* Output Terminal Descriptor (USB Streaming) */
|
||||||
0x0C, /* 0 bLength */
|
.bLength = 0x0C,
|
||||||
UAC_CS_DESCTYPE_INTERFACE, /* 1 bDescriptorType: 0x24 */
|
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
|
||||||
UAC_CS_AC_INTERFACE_SUBTYPE_OUTPUT_TERMINAL, /* 2 bDescriptorSubType: OUTPUT_TERMINAL */
|
.bDescriptorSubtype = UAC_CS_AC_INTERFACE_SUBTYPE_OUTPUT_TERMINAL,
|
||||||
ID_OT_USB, /* 3 bTerminalID */
|
.bTerminalID = ID_OT_USB,
|
||||||
USB_TERMTYPE_USB_STREAMING, /* 5 wTerminalType */
|
.wTerminalType = USB_TERMTYPE_USB_STREAMING,
|
||||||
0x00, /* 6 bAssocTerminal */
|
.bAssocTerminal = 0x00,
|
||||||
FU_USBIN, /* 7 bSourceID Connect to analog input feature unit*/
|
#if (INPUT_VOLUME_CONTROL == 1)
|
||||||
ID_CLKSEL, /* 8 bCSourceUD */
|
.bSourceID = FU_USBIN, /* 7 bSourceID Connect to analog input feature unit*/
|
||||||
0x0000, /* 9 bmControls */
|
#else
|
||||||
7, /* 11 iTerminal */
|
|
||||||
|
.bSourceID = ID_IT_USB, /* 7 bSourceID Connect to analog input term */
|
||||||
|
#endif
|
||||||
|
.bCSourceID = ID_CLKSEL,
|
||||||
|
.bmControls = 0x0000,
|
||||||
|
.iTerminal = offsetof(StringDescTable_t, usbOutputTermStr_Audio2)/sizeof(char *)
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
}, /* End of .Audio_CS_Control_Int */
|
}, /* End of .Audio_CS_Control_Int */
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ __builtin_unreachable();
|
|||||||
{
|
{
|
||||||
/* Receive sample */
|
/* Receive sample */
|
||||||
int sample = inuint(c_mix_out);
|
int sample = inuint(c_mix_out);
|
||||||
|
#if (INPUT_VOLUME_CONTROL == 1)
|
||||||
#if !defined(IN_VOLUME_IN_MIXER)
|
#if !defined(IN_VOLUME_IN_MIXER)
|
||||||
/* Apply volume */
|
/* Apply volume */
|
||||||
int mult;
|
int mult;
|
||||||
@@ -183,6 +184,7 @@ __builtin_unreachable();
|
|||||||
/* Note, in 2 byte sub slot - ignore lower bits of macs */
|
/* Note, in 2 byte sub slot - ignore lower bits of macs */
|
||||||
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
||||||
sample = sample << 3;
|
sample = sample << 3;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
write_short_via_xc_ptr(g_aud_to_host_dptr, sample>>16);
|
write_short_via_xc_ptr(g_aud_to_host_dptr, sample>>16);
|
||||||
g_aud_to_host_dptr+=2;
|
g_aud_to_host_dptr+=2;
|
||||||
@@ -200,6 +202,7 @@ __builtin_unreachable();
|
|||||||
{
|
{
|
||||||
/* Receive sample */
|
/* Receive sample */
|
||||||
int sample = inuint(c_mix_out);
|
int sample = inuint(c_mix_out);
|
||||||
|
#if(INPUT_VOLUME_CONTROL == 1)
|
||||||
#if !defined(IN_VOLUME_IN_MIXER)
|
#if !defined(IN_VOLUME_IN_MIXER)
|
||||||
/* Apply volume */
|
/* Apply volume */
|
||||||
int mult;
|
int mult;
|
||||||
@@ -213,6 +216,7 @@ __builtin_unreachable();
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
#elif defined(IN_VOLUME_IN_MIXER) && defined(IN_VOLUME_AFTER_MIX)
|
||||||
sample = sample << 3;
|
sample = sample << 3;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/* Write into fifo */
|
/* Write into fifo */
|
||||||
write_via_xc_ptr(ptr, sample);
|
write_via_xc_ptr(ptr, sample);
|
||||||
@@ -232,7 +236,7 @@ __builtin_unreachable();
|
|||||||
{
|
{
|
||||||
/* Receive sample */
|
/* Receive sample */
|
||||||
int sample = inuint(c_mix_out);
|
int sample = inuint(c_mix_out);
|
||||||
#ifndef IN_VOLUME_IN_MIXER
|
#if (INPUT_VOLUME_CONTROL) && !defined(IN_VOLUME_IN_MIXER)
|
||||||
/* Apply volume */
|
/* Apply volume */
|
||||||
int mult;
|
int mult;
|
||||||
int h;
|
int h;
|
||||||
|
|||||||
Reference in New Issue
Block a user