@@ -47,6 +47,7 @@ uint8_t AudioInputUSB::receive_flag; | |||
#define DMABUFATTR __attribute__ ((section(".dmabuffers"), aligned (4))) | |||
uint16_t usb_audio_receive_buffer[AUDIO_RX_SIZE/2] DMABUFATTR; | |||
uint32_t usb_audio_sync_feedback DMABUFATTR; | |||
uint8_t usb_audio_receive_setting=0; | |||
static uint32_t feedback_accumulator = 185042824; | |||
@@ -212,6 +213,7 @@ uint16_t AudioOutputUSB::outgoing_count; | |||
uint16_t usb_audio_transmit_buffer[AUDIO_TX_SIZE/2] DMABUFATTR; | |||
uint8_t usb_audio_transmit_setting=0; | |||
void AudioOutputUSB::begin(void) | |||
{ | |||
@@ -227,6 +229,19 @@ void AudioOutputUSB::update(void) | |||
left = receiveReadOnly(0); // input 0 = left channel | |||
right = receiveReadOnly(1); // input 1 = right channel | |||
if (usb_audio_transmit_setting == 0) { | |||
if (left) release(left); | |||
if (right) release(right); | |||
if (outgoing_count) { | |||
if (left_1st) release(left_1st); | |||
if (left_2nd) release(left_2nd); | |||
if (right_1st) release(right_1st); | |||
if (right_2nd) release(right_2nd); | |||
outgoing_count = 0; | |||
offset_1st = 0; | |||
} | |||
return; | |||
} | |||
if (left == NULL) { | |||
if (right == NULL) return; | |||
right->ref_count++; |
@@ -12,6 +12,8 @@ extern uint16_t usb_audio_transmit_buffer[]; | |||
extern void usb_audio_receive_callback(unsigned int len); | |||
extern unsigned int usb_audio_transmit_callback(void); | |||
extern uint32_t usb_audio_sync_feedback; | |||
extern uint8_t usb_audio_receive_setting; | |||
extern uint8_t usb_audio_transmit_setting; | |||
#ifdef __cplusplus | |||
} | |||
@@ -384,9 +384,9 @@ static void usb_setup(void) | |||
#if defined(AUDIO_INTERFACE) | |||
case 0x0B01: // SET_INTERFACE (alternate setting) | |||
if (setup.wIndex == AUDIO_INTERFACE+1) { | |||
//audio_tx_alternate_setting = setup.wValue; | |||
usb_audio_transmit_setting = setup.wValue; | |||
} else if (setup.wIndex == AUDIO_INTERFACE+2) { | |||
//audio_rx_alternate_setting = setup.wValue; | |||
usb_audio_receive_setting = setup.wValue; | |||
} else { | |||
endpoint0_stall(); | |||
return; | |||
@@ -396,11 +396,9 @@ static void usb_setup(void) | |||
datalen = 1; | |||
data = reply_buffer; | |||
if (setup.wIndex == AUDIO_INTERFACE+1) { | |||
reply_buffer[0] = 0; | |||
//reply_buffer[0] = audio_tx_alternate_setting; | |||
reply_buffer[0] = usb_audio_transmit_setting; | |||
} else if (setup.wIndex == AUDIO_INTERFACE+2) { | |||
reply_buffer[0] = 0; | |||
//reply_buffer[0] = audio_rx_alternate_setting; | |||
reply_buffer[0] = usb_audio_receive_setting; | |||
} else { | |||
endpoint0_stall(); | |||
return; |
@@ -102,6 +102,8 @@ extern void usb_flightsim_flush_callback(void); | |||
extern uint16_t usb_audio_receive_buffer[]; | |||
extern uint16_t usb_audio_transmit_buffer[]; | |||
extern uint32_t usb_audio_sync_feedback; | |||
extern uint8_t usb_audio_receive_setting; | |||
extern uint8_t usb_audio_transmit_setting; | |||
extern void usb_audio_receive_callback(unsigned int len); | |||
extern unsigned int usb_audio_transmit_callback(void); | |||
#endif |