[alsa-devel] Question about Conversion to S24_LE from S24_3LE

Fujikawa, Kazutoshi fujikawa.k at jp.fujitsu.com
Fri Aug 10 02:28:50 CEST 2012


I'd like to play a wav file converted from S24_3LE format to S24_LE by alsa-lib.
(I use aplay command.)

I recognize the following:

<PCM format in wav file>
ex. Valid PCM data is 0x123456.

S24_LE  :  0x12345600(in 4bytes, LSB 0 padding)
S24_3LE :  0x123456  (in 3bytes, No padding)

When the S24_LE format file is played, the ALSA driver receives data format is as follows:

0x12345600 (LSB 0 padding)

However, when the S24_3LE format file which is converted to S24_LE by alsa-lib is played, the ALSA driver receives data formats is as follows:

0x00123456 (MSB 0(or 0xFF) padding)

Why is the how to pad 0 different(LSB/MSB)?


When "snd_pcm_linear_getput" is called
  'get_idx' is set 16.
  'put_idx' is set 8.


211     void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_ pcm_uframes_t dst_offset,
212                                const snd_pcm_channel_area_t *src_areas, snd_ pcm_uframes_t src_offset,
213                                unsigned int channels, snd_pcm_uframes_t fram es,
214                                unsigned int get_idx, unsigned int put_idx)
215     {
216     #define CONV24_LABELS
217     #include "plugin_ops.h"
218     #undef CONV24_LABELS
219             void *get = get32_labels[get_idx];
220             void *put = put32_labels[put_idx];
221             unsigned int channel;
222             u_int32_t sample = 0;
223             for (channel = 0; channel < channels; ++channel) {
224                     const char *src;

When 'get_idx' is 16 and 'put_idx' is 8, it is converted as follows:

0x123456(S24_3LE) -> 0x00123456(MSB 0 padding)

I expect the following:

0x123456(S24_3LE) -> 0x12345600(LSB 0 padding)

(If 'get_idx' is 16 and 'put_idx' is 12, it is converted like this.)

I'm doing something wrong?




More information about the Alsa-devel mailing list