All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] speaker-test: Support S24_3LE sample format
@ 2018-05-23 13:42 Julian Scheel
  2018-05-23 13:42 ` [PATCH v2 2/2] speaker-test: Remove unused variable Julian Scheel
  2018-05-23 14:06 ` [PATCH v2 1/2] speaker-test: Support S24_3LE sample format Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Julian Scheel @ 2018-05-23 13:42 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: Julian Scheel

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;
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-23 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-23 13:42 [PATCH v2 1/2] speaker-test: Support S24_3LE sample format Julian Scheel
2018-05-23 13:42 ` [PATCH v2 2/2] speaker-test: Remove unused variable Julian Scheel
2018-05-23 14:06 ` [PATCH v2 1/2] speaker-test: Support S24_3LE sample format Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.