[alsa-devel] dmix format S24_LE

Bart De Vos bart_dv at eia.be
Tue Mar 2 13:20:08 CET 2010


Hi,

I've added support for the S24_LE format in the dmix plugin. This has 
been tested 'only' on i.MX31 (arm11) with sound DAC AK4367 over I2S, 
which supports this format natively.

Patch is against alsa-lib-1.0.22.

Please let me know your thoughts.

diff -urN alsa-lib-1.0.22-orig/src/pcm/pcm_direct.c 
alsa-lib-1.0.22/src/pcm/pcm_direct.c
--- alsa-lib-1.0.22-orig/src/pcm/pcm_direct.c	2009-12-16 
16:18:51.000000000 +0100
+++ alsa-lib-1.0.22/src/pcm/pcm_direct.c	2010-03-02 10:01:00.000000000 +0100
@@ -888,6 +888,7 @@
  			SND_PCM_FORMAT_S32 ^ SND_PCM_FORMAT_S32_LE ^ SND_PCM_FORMAT_S32_BE,
  			SND_PCM_FORMAT_S16,
  			SND_PCM_FORMAT_S16 ^ SND_PCM_FORMAT_S16_LE ^ SND_PCM_FORMAT_S16_BE,
+			SND_PCM_FORMAT_S24_LE,
  			SND_PCM_FORMAT_S24_3LE,
  			SND_PCM_FORMAT_U8,
  		};
diff -urN alsa-lib-1.0.22-orig/src/pcm/pcm_dmix.c 
alsa-lib-1.0.22/src/pcm/pcm_dmix.c
--- alsa-lib-1.0.22-orig/src/pcm/pcm_dmix.c	2009-12-16 
16:18:51.000000000 +0100
+++ alsa-lib-1.0.22/src/pcm/pcm_dmix.c	2010-03-02 10:02:39.000000000 +0100
@@ -174,6 +174,10 @@
  		sample_size = 4;
  		do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_32;
  		break;
+	case SND_PCM_FORMAT_S24_LE:
+		sample_size = 4;
+		do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_24;
+		break;
  	case SND_PCM_FORMAT_S24_3LE:
  		sample_size = 3;
  		do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_24;
@@ -238,6 +242,10 @@
  		sample_size = 4;
  		do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_32;
  		break;
+	case SND_PCM_FORMAT_S24_LE:
+		sample_size = 4;
+		do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_24;
+		break;
  	case SND_PCM_FORMAT_S24_3LE:
  		sample_size = 3;
  		do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_24;
diff -urN alsa-lib-1.0.22-orig/src/pcm/pcm_dmix_generic.c 
alsa-lib-1.0.22/src/pcm/pcm_dmix_generic.c
--- alsa-lib-1.0.22-orig/src/pcm/pcm_dmix_generic.c	2009-12-16 
16:18:51.000000000 +0100
+++ alsa-lib-1.0.22/src/pcm/pcm_dmix_generic.c	2010-03-02 
10:37:16.000000000 +0100
@@ -122,7 +122,7 @@
  #define generic_dmix_supported_format \
  	((1ULL << SND_PCM_FORMAT_S16_LE) | (1ULL << SND_PCM_FORMAT_S32_LE) |\
  	 (1ULL << SND_PCM_FORMAT_S16_BE) | (1ULL << SND_PCM_FORMAT_S32_BE) |\
-	 (1ULL << SND_PCM_FORMAT_S24_3LE) | \
+	 (1ULL << SND_PCM_FORMAT_S24_LE) | (1ULL << SND_PCM_FORMAT_S24_3LE)|\
  	 (1ULL << SND_PCM_FORMAT_U8))

  #include <byteswap.h>

-- 
--------------------------------------------------
Bart De Vos
Development Engineer
mailto:bart.devos at eia.be

EIA Electronics
Vluchtenburgstraat  3
B-2630 Aartselaar  (Belgium)
phone	: +32(0)3 870 85 29
fax    	: +32(0)3 877 14 72
website	: http://www.eia.be/
--------------------------------------------------
Basically, perfect development is impossible.
Development can be fast, good and cheap. Pick two!
— Larry Wall
--------------------------------------------------


More information about the Alsa-devel mailing list