aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-07 19:00:02 +0100
committerMax Kellermann <max@duempel.org>2009-01-07 19:00:02 +0100
commit04a2138b3329e189c87c6bedb39b8a975da53565 (patch)
treed262ddc9d5a77112b949ec52899f14d43d262de9
parentbb01016400e0f36ac1ae8781314682db5fe207ca (diff)
downloadmpd-04a2138b3329e189c87c6bedb39b8a975da53565.tar.gz
mpd-04a2138b3329e189c87c6bedb39b8a975da53565.tar.xz
mpd-04a2138b3329e189c87c6bedb39b8a975da53565.zip
pcm: pass void pointers to PCM functions
In generic PCM functions allowing all sample formats, pass a void pointer instead of a char pointer.
-rw-r--r--src/pcm_convert.c9
-rw-r--r--src/pcm_convert.h4
-rw-r--r--src/pcm_mix.c4
-rw-r--r--src/pcm_mix.h2
-rw-r--r--src/pcm_volume.c2
-rw-r--r--src/pcm_volume.h2
6 files changed, 11 insertions, 12 deletions
diff --git a/src/pcm_convert.c b/src/pcm_convert.c
index 283befd8c..f9fc9a64b 100644
--- a/src/pcm_convert.c
+++ b/src/pcm_convert.c
@@ -117,21 +117,20 @@ pcm_convert_24(const struct audio_format *src_format,
return len;
}
-/* outFormat bits must be 16 and channels must be 1 or 2! */
size_t pcm_convert(const struct audio_format *inFormat,
- const char *src, size_t src_size,
+ const void *src, size_t src_size,
const struct audio_format *outFormat,
- char *outBuffer,
+ void *dest,
struct pcm_convert_state *convState)
{
switch (outFormat->bits) {
case 16:
return pcm_convert_16(inFormat, src, src_size,
- outFormat, (int16_t*)outBuffer,
+ outFormat, (int16_t*)dest,
convState);
case 24:
return pcm_convert_24(inFormat, src, src_size,
- outFormat, (int32_t*)outBuffer,
+ outFormat, (int32_t*)dest,
convState);
default:
diff --git a/src/pcm_convert.h b/src/pcm_convert.h
index ac771a5c1..ad54290b8 100644
--- a/src/pcm_convert.h
+++ b/src/pcm_convert.h
@@ -33,9 +33,9 @@ struct pcm_convert_state {
void pcm_convert_init(struct pcm_convert_state *state);
size_t pcm_convert(const struct audio_format *inFormat,
- const char *inBuffer, size_t inSize,
+ const void *src, size_t src_size,
const struct audio_format *outFormat,
- char *outBuffer,
+ void *dest,
struct pcm_convert_state *convState);
size_t pcm_convert_size(const struct audio_format *inFormat, size_t inSize,
diff --git a/src/pcm_mix.c b/src/pcm_mix.c
index 0ca5a9a7f..3084051ab 100644
--- a/src/pcm_mix.c
+++ b/src/pcm_mix.c
@@ -80,7 +80,7 @@ pcm_add_24(int32_t *buffer1, const int32_t *buffer2,
}
static void
-pcm_add(char *buffer1, const char *buffer2, size_t size,
+pcm_add(void *buffer1, const void *buffer2, size_t size,
int vol1, int vol2,
const struct audio_format *format)
{
@@ -107,7 +107,7 @@ pcm_add(char *buffer1, const char *buffer2, size_t size,
}
void
-pcm_mix(char *buffer1, const char *buffer2, size_t size,
+pcm_mix(void *buffer1, const void *buffer2, size_t size,
const struct audio_format *format, float portion1)
{
int vol1;
diff --git a/src/pcm_mix.h b/src/pcm_mix.h
index cce35dedf..f3fe3c365 100644
--- a/src/pcm_mix.h
+++ b/src/pcm_mix.h
@@ -24,7 +24,7 @@
struct audio_format;
void
-pcm_mix(char *buffer1, const char *buffer2, size_t size,
+pcm_mix(void *buffer1, const void *buffer2, size_t size,
const struct audio_format *format, float portion1);
#endif
diff --git a/src/pcm_volume.c b/src/pcm_volume.c
index 7f032a5f3..2dff14ef5 100644
--- a/src/pcm_volume.c
+++ b/src/pcm_volume.c
@@ -74,7 +74,7 @@ pcm_volume_change_24(int32_t *buffer, unsigned num_samples, int volume)
}
void
-pcm_volume(char *buffer, int bufferSize,
+pcm_volume(void *buffer, int bufferSize,
const struct audio_format *format,
int volume)
{
diff --git a/src/pcm_volume.h b/src/pcm_volume.h
index 4c1b45352..7b5323ed7 100644
--- a/src/pcm_volume.h
+++ b/src/pcm_volume.h
@@ -52,7 +52,7 @@ pcm_volume_dither(void)
}
void
-pcm_volume(char *buffer, int bufferSize,
+pcm_volume(void *buffer, int bufferSize,
const struct audio_format *format,
int volume);