]> code.delx.au - pulseaudio/commitdiff
Implement mix-test for s24le and s24be sample formats.
authorDiego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
Wed, 24 Jun 2009 16:24:45 +0000 (18:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 29 Jun 2009 15:40:42 +0000 (17:40 +0200)
src/tests/mix-test.c

index b1dac3bd1a736147d3b22148ae0143720c704f59..c7a30d67336164ea35288eaf389c3f0c6d19399a 100644 (file)
@@ -79,6 +79,16 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
             break;
         }
 
+        case PA_SAMPLE_S24NE:
+        case PA_SAMPLE_S24RE: {
+            uint8_t *u = d;
+
+            for (i = 0; i < chunk->length / pa_frame_size(ss); i++)
+               printf("0x%02x%02x%02xx ", *(u++), *(u++), *(u++));
+
+            break;
+        }
+
         case PA_SAMPLE_FLOAT32NE:
         case PA_SAMPLE_FLOAT32RE: {
             float *u = d;
@@ -141,6 +151,25 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) {
             break;
         }
 
+        case PA_SAMPLE_S24NE:
+        case PA_SAMPLE_S24RE: {
+           /* Need to be on a byte array because they are not aligned */
+           static const uint8_t u24_samples[] =
+             { 0x00, 0x00, 0x01,
+               0xFF, 0xFF, 0x02,
+               0x7F, 0xFF, 0x03,
+               0x80, 0x00, 0x04,
+               0x9f, 0xff, 0x05,
+               0x3f, 0xff, 0x06,
+               0x01, 0x00, 0x07,
+               0xF0, 0x00, 0x08,
+               0x20, 0x00, 0x09,
+               0x21, 0x00, 0x0A };
+
+           memcpy(d, &u24_samples[0], sizeof(u24_samples));
+            break;
+        }
+
         case PA_SAMPLE_FLOAT32NE:
         case PA_SAMPLE_FLOAT32RE: {
             float *u = d;