[pulseaudio-discuss] [PATCH] core: Set volumes const in pa_do_volume_func_t

Peter Meerwald pmeerw at pmeerw.net
Mon Jul 9 09:01:32 PDT 2012


From: Peter Meerwald <p.meerwald at bct-electronic.com>

volumes do not change, the samples get scaled

Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
---
 src/pulsecore/sample-util.h |    2 +-
 src/pulsecore/svolume_arm.c |    2 +-
 src/pulsecore/svolume_c.c   |   24 ++++++++++++------------
 src/pulsecore/svolume_mmx.c |    4 ++--
 src/pulsecore/svolume_orc.c |    2 +-
 src/pulsecore/svolume_sse.c |    4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/pulsecore/sample-util.h b/src/pulsecore/sample-util.h
index cf79d43..a6b4600 100644
--- a/src/pulsecore/sample-util.h
+++ b/src/pulsecore/sample-util.h
@@ -88,7 +88,7 @@ void pa_memchunk_dump_to_file(pa_memchunk *c, const char *fn);
 
 void pa_memchunk_sine(pa_memchunk *c, pa_mempool *pool, unsigned rate, unsigned freq);
 
-typedef void (*pa_do_volume_func_t) (void *samples, void *volumes, unsigned channels, unsigned length);
+typedef void (*pa_do_volume_func_t) (void *samples, const void *volumes, unsigned channels, unsigned length);
 
 pa_do_volume_func_t pa_get_volume_func(pa_sample_format_t f);
 void pa_set_volume_func(pa_sample_format_t f, pa_do_volume_func_t func);
diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
index f938e57..79ed830 100644
--- a/src/pulsecore/svolume_arm.c
+++ b/src/pulsecore/svolume_arm.c
@@ -40,7 +40,7 @@
     " addcs r0, %1                  \n\t" \
     " movcs r6, r0                  \n\t"
 
-static void pa_volume_s16ne_arm(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16ne_arm(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     int32_t *ve;
 
     /* Channels must be at least 4, and always a multiple of the original number.
diff --git a/src/pulsecore/svolume_c.c b/src/pulsecore/svolume_c.c
index 272e7a7..13ac667 100644
--- a/src/pulsecore/svolume_c.c
+++ b/src/pulsecore/svolume_c.c
@@ -31,7 +31,7 @@
 
 #include "sample-util.h"
 
-static void pa_volume_u8_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_u8_c(uint8_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     for (channel = 0; length; length--) {
@@ -50,7 +50,7 @@ static void pa_volume_u8_c(uint8_t *samples, int32_t *volumes, unsigned channels
     }
 }
 
-static void pa_volume_alaw_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_alaw_c(uint8_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     for (channel = 0; length; length--) {
@@ -69,7 +69,7 @@ static void pa_volume_alaw_c(uint8_t *samples, int32_t *volumes, unsigned channe
     }
 }
 
-static void pa_volume_ulaw_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_ulaw_c(uint8_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     for (channel = 0; length; length--) {
@@ -88,7 +88,7 @@ static void pa_volume_ulaw_c(uint8_t *samples, int32_t *volumes, unsigned channe
     }
 }
 
-static void pa_volume_s16ne_c(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16ne_c(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(int16_t);
@@ -115,7 +115,7 @@ static void pa_volume_s16ne_c(int16_t *samples, int32_t *volumes, unsigned chann
     }
 }
 
-static void pa_volume_s16re_c(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16re_c(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(int16_t);
@@ -136,7 +136,7 @@ static void pa_volume_s16re_c(int16_t *samples, int32_t *volumes, unsigned chann
     }
 }
 
-static void pa_volume_float32ne_c(float *samples, float *volumes, unsigned channels, unsigned length) {
+static void pa_volume_float32ne_c(float *samples, const float *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(float);
@@ -166,7 +166,7 @@ static void pa_volume_float32re_c(float *samples, float *volumes, unsigned chann
     }
 }
 
-static void pa_volume_s32ne_c(int32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s32ne_c(int32_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(int32_t);
@@ -184,7 +184,7 @@ static void pa_volume_s32ne_c(int32_t *samples, int32_t *volumes, unsigned chann
     }
 }
 
-static void pa_volume_s32re_c(int32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s32re_c(int32_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(int32_t);
@@ -202,7 +202,7 @@ static void pa_volume_s32re_c(int32_t *samples, int32_t *volumes, unsigned chann
     }
 }
 
-static void pa_volume_s24ne_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s24ne_c(uint8_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
     uint8_t *e;
 
@@ -221,7 +221,7 @@ static void pa_volume_s24ne_c(uint8_t *samples, int32_t *volumes, unsigned chann
     }
 }
 
-static void pa_volume_s24re_c(uint8_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s24re_c(uint8_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
     uint8_t *e;
 
@@ -240,7 +240,7 @@ static void pa_volume_s24re_c(uint8_t *samples, int32_t *volumes, unsigned chann
     }
 }
 
-static void pa_volume_s24_32ne_c(uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s24_32ne_c(uint32_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(uint32_t);
@@ -258,7 +258,7 @@ static void pa_volume_s24_32ne_c(uint32_t *samples, int32_t *volumes, unsigned c
     }
 }
 
-static void pa_volume_s24_32re_c(uint32_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s24_32re_c(uint32_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     unsigned channel;
 
     length /= sizeof(uint32_t);
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index f9fc175..c470ffb 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -92,7 +92,7 @@
       " por %%mm4, "#s1"             \n\t" /* .. |  l  h |  */ \
       " por %%mm5, "#s2"             \n\t"
 
-static void pa_volume_s16ne_mmx(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16ne_mmx(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 4, and always a multiple of the original number.
@@ -161,7 +161,7 @@ static void pa_volume_s16ne_mmx(int16_t *samples, int32_t *volumes, unsigned cha
     );
 }
 
-static void pa_volume_s16re_mmx(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16re_mmx(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 4, and always a multiple of the original number.
diff --git a/src/pulsecore/svolume_orc.c b/src/pulsecore/svolume_orc.c
index b178bbf..d5bd5f2 100644
--- a/src/pulsecore/svolume_orc.c
+++ b/src/pulsecore/svolume_orc.c
@@ -34,7 +34,7 @@
 pa_do_volume_func_t fallback;
 
 static void
-pa_volume_s16ne_orc(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
+pa_volume_s16ne_orc(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length)
 {
     if (channels == 2) {
         int64_t v = (int64_t)volumes[1] << 32 | volumes[0];
diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c
index fe08de4..771bf53 100644
--- a/src/pulsecore/svolume_sse.c
+++ b/src/pulsecore/svolume_sse.c
@@ -76,7 +76,7 @@
 
 static int channel_overread_table[8] = {8,8,8,12,8,10,12,14};
 
-static void pa_volume_s16ne_sse2(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16ne_sse2(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 8 and always a multiple of the original number.
@@ -160,7 +160,7 @@ static void pa_volume_s16ne_sse2(int16_t *samples, int32_t *volumes, unsigned ch
     );
 }
 
-static void pa_volume_s16re_sse2(int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) {
+static void pa_volume_s16re_sse2(int16_t *samples, const int32_t *volumes, unsigned channels, unsigned length) {
     pa_reg_x86 channel, temp;
 
     /* Channels must be at least 8 and always a multiple of the original number.
-- 
1.7.5.4



More information about the pulseaudio-discuss mailing list