| { | { | ||||
| audio_block_t *left, *right; | audio_block_t *left, *right; | ||||
| left = receiveReadOnly(0); // input 0 = left channel | |||||
| right = receiveReadOnly(1); // input 1 = right channel | |||||
| // TODO: we shouldn't be writing to these...... | |||||
| //left = receiveReadOnly(0); // input 0 = left channel | |||||
| //right = receiveReadOnly(1); // input 1 = right channel | |||||
| left = receiveWritable(0); // input 0 = left channel | |||||
| right = receiveWritable(1); // input 1 = right channel | |||||
| if (usb_audio_transmit_setting == 0) { | if (usb_audio_transmit_setting == 0) { | ||||
| if (left) release(left); | if (left) release(left); | ||||
| if (right) release(right); | if (right) release(right); | ||||
| return; | return; | ||||
| } | } | ||||
| if (left == NULL) { | if (left == NULL) { | ||||
| if (right == NULL) return; | |||||
| right->ref_count++; | |||||
| left = right; | |||||
| } else if (right == NULL) { | |||||
| left->ref_count++; | |||||
| right = left; | |||||
| left = allocate(); | |||||
| if (left == NULL) { | |||||
| if (right) release(right); | |||||
| return; | |||||
| } | |||||
| memset(left->data, 0, sizeof(left->data)); | |||||
| } | |||||
| if (right == NULL) { | |||||
| right = allocate(); | |||||
| if (right == NULL) { | |||||
| release(left); | |||||
| return; | |||||
| } | |||||
| memset(right->data, 0, sizeof(right->data)); | |||||
| } | } | ||||
| __disable_irq(); | __disable_irq(); | ||||
| if (left_1st == NULL) { | if (left_1st == NULL) { |