[alsa-devel] [PATCH v2 1/2] speaker-test: Support S24_3LE sample format
Implement support signed 24 bit samples, packed in 3 bytes.
Signed-off-by: Julian Scheel julian@jusst.de --- speaker-test/speaker-test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c index 65ab523..4804bcf 100644 --- a/speaker-test/speaker-test.c +++ b/speaker-test/speaker-test.c @@ -283,6 +283,8 @@ static const int supported_formats[] = { SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE, SND_PCM_FORMAT_FLOAT_LE, + SND_PCM_FORMAT_S24_3LE, + SND_PCM_FORMAT_S24_3BE, SND_PCM_FORMAT_S32_LE, SND_PCM_FORMAT_S32_BE, -1 @@ -325,6 +327,18 @@ static void do_generate(uint8_t *frames, int channel, int count, case SND_PCM_FORMAT_FLOAT_LE: *samp_f++ = res.f; break; + case SND_PCM_FORMAT_S24_3LE: + res.i >>= 8; + *samp8++ = LE_INT(res.i); + *samp8++ = LE_INT(res.i) >> 8; + *samp8++ = LE_INT(res.i) >> 16; + break; + case SND_PCM_FORMAT_S24_3BE: + res.i >>= 8; + *samp8++ = BE_INT(res.i); + *samp8++ = BE_INT(res.i) >> 8; + *samp8++ = BE_INT(res.i) >> 16; + break; case SND_PCM_FORMAT_S32_LE: *samp32++ = LE_INT(res.i); break;
Signed-off-by: Julian Scheel julian@jusst.de --- speaker-test/speaker-test.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c index 4804bcf..0cdecb3 100644 --- a/speaker-test/speaker-test.c +++ b/speaker-test/speaker-test.c @@ -300,7 +300,6 @@ static void do_generate(uint8_t *frames, int channel, int count, { value_t res; int chn; - int32_t ires; int8_t *samp8 = (int8_t*) frames; int16_t *samp16 = (int16_t*) frames; int32_t *samp32 = (int32_t*) frames;
On Wed, 23 May 2018 15:42:20 +0200, Julian Scheel wrote:
Implement support signed 24 bit samples, packed in 3 bytes.
Signed-off-by: Julian Scheel julian@jusst.de
Applied both patches. Thanks.
Takashi
participants (2)
-
Julian Scheel
-
Takashi Iwai