diff --git a/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c index 84cc6430..54314769 100644 --- a/modules/usbaudio/audio_hal.c +++ b/modules/usbaudio/audio_hal.c @@ -123,74 +123,6 @@ struct stream_in { size_t conversion_buffer_size; /* in bytes */ }; -/* - * Data Conversions - */ -/* - * Convert a buffer of packed (3-byte) PCM24LE samples to PCM16LE samples. - * in_buff points to the buffer of PCM24LE samples - * num_in_samples size of input buffer in SAMPLES - * out_buff points to the buffer to receive converted PCM16LE LE samples. - * returns - * the number of BYTES of output data. - * We are doing this since we *always* present to The Framework as A PCM16LE device, but need to - * support PCM24_3LE (24-bit, packed). - * NOTE: - * This conversion is safe to do in-place (in_buff == out_buff). - * TODO Move this to a utilities module. - */ -static size_t convert_24_3_to_16(const unsigned char * in_buff, size_t num_in_samples, - short * out_buff) -{ - /* - * Move from front to back so that the conversion can be done in-place - * i.e. in_buff == out_buff - */ - /* we need 2 bytes in the output for every 3 bytes in the input */ - unsigned char* dst_ptr = (unsigned char*)out_buff; - const unsigned char* src_ptr = in_buff; - size_t src_smpl_index; - for (src_smpl_index = 0; src_smpl_index < num_in_samples; src_smpl_index++) { - src_ptr++; /* lowest-(skip)-byte */ - *dst_ptr++ = *src_ptr++; /* low-byte */ - *dst_ptr++ = *src_ptr++; /* high-byte */ - } - - /* return number of *bytes* generated: */ - return num_in_samples * 2; -} - -/* - * Convert a buffer of packed (3-byte) PCM32 samples to PCM16LE samples. - * in_buff points to the buffer of PCM32 samples - * num_in_samples size of input buffer in SAMPLES - * out_buff points to the buffer to receive converted PCM16LE LE samples. - * returns - * the number of BYTES of output data. - * We are doing this since we *always* present to The Framework as A PCM16LE device, but need to - * support PCM_FORMAT_S32_LE (32-bit). - * NOTE: - * This conversion is safe to do in-place (in_buff == out_buff). - * TODO Move this to a utilities module. - */ -static size_t convert_32_to_16(const int32_t * in_buff, size_t num_in_samples, short * out_buff) -{ - /* - * Move from front to back so that the conversion can be done in-place - * i.e. in_buff == out_buff - */ - - short * dst_ptr = out_buff; - const int32_t* src_ptr = in_buff; - size_t src_smpl_index; - for (src_smpl_index = 0; src_smpl_index < num_in_samples; src_smpl_index++) { - *dst_ptr++ = *src_ptr++ >> 16; - } - - /* return number of *bytes* generated: */ - return num_in_samples * 2; -} - /* * Extract the card and device numbers from the supplied key/value pairs. * kvpairs A null-terminated string containing the key/value pairs or card and device.