aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-31 20:33:26 +0100
committerMax Kellermann <max@duempel.org>2013-01-31 21:11:06 +0100
commit1b175025fecb1c10e6719d4ab79c188d473fccc4 (patch)
treea1d04e92416e72c78f474de25c0aeee3374d47a1
parentccdf7184bea4bcc38ae468095ec400e2a2a4db3b (diff)
downloadmpd-1b175025fecb1c10e6719d4ab79c188d473fccc4.tar.gz
mpd-1b175025fecb1c10e6719d4ab79c188d473fccc4.tar.xz
mpd-1b175025fecb1c10e6719d4ab79c188d473fccc4.zip
pcm_*: convert to C++
-rw-r--r--Makefile.am14
-rw-r--r--src/MixerAll.cxx2
-rw-r--r--src/OutputThread.cxx2
-rw-r--r--src/PcmChannels.cxx (renamed from src/pcm_channels.c)22
-rw-r--r--src/PcmChannels.hxx (renamed from src/pcm_channels.h)6
-rw-r--r--src/PcmConvert.cxx8
-rw-r--r--src/PcmConvert.hxx3
-rw-r--r--src/PcmDither.cxx (renamed from src/pcm_dither.c)6
-rw-r--r--src/PcmDither.hxx (renamed from src/pcm_dither.h)6
-rw-r--r--src/PcmFormat.cxx (renamed from src/pcm_format.c)92
-rw-r--r--src/PcmFormat.hxx (renamed from src/pcm_format.h)6
-rw-r--r--src/PcmMix.cxx (renamed from src/pcm_mix.c)17
-rw-r--r--src/PcmMix.hxx (renamed from src/pcm_mix.h)7
-rw-r--r--src/PcmPrng.hxx (renamed from src/pcm_prng.h)6
-rw-r--r--src/PcmUtils.hxx (renamed from src/pcm_utils.h)7
-rw-r--r--src/PcmVolume.cxx (renamed from src/pcm_volume.c)18
-rw-r--r--src/PcmVolume.hxx (renamed from src/pcm_volume.h)16
-rw-r--r--src/filter/ReplayGainFilterPlugin.cxx2
-rw-r--r--src/filter/VolumeFilterPlugin.cxx2
-rw-r--r--src/mixer/SoftwareMixerPlugin.cxx2
-rw-r--r--test/read_mixer.cxx2
-rw-r--r--test/run_filter.cxx2
-rw-r--r--test/software_volume.cxx2
-rw-r--r--test/test_pcm_channels.cxx4
-rw-r--r--test/test_pcm_dither.cxx5
-rw-r--r--test/test_pcm_volume.cxx2
26 files changed, 132 insertions, 129 deletions
diff --git a/Makefile.am b/Makefile.am
index 37b3699ab..bf2f40666 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -333,17 +333,17 @@ libpcm_a_SOURCES = \
src/dsd2pcm/dsd2pcm.c src/dsd2pcm/dsd2pcm.h \
src/pcm_dsd.c src/pcm_dsd.h \
src/pcm_dsd_usb.c src/pcm_dsd_usb.h \
- src/pcm_volume.c src/pcm_volume.h \
- src/pcm_mix.c src/pcm_mix.h \
- src/pcm_channels.c src/pcm_channels.h \
+ src/PcmVolume.cxx src/PcmVolume.hxx \
+ src/PcmMix.cxx src/PcmMix.hxx \
+ src/PcmChannels.cxx src/PcmChannels.hxx \
src/pcm_pack.c src/pcm_pack.h \
- src/pcm_format.c src/pcm_format.h \
+ src/PcmFormat.cxx src/PcmFormat.hxx \
src/pcm_resample.c src/pcm_resample.h \
src/pcm_resample_fallback.c \
src/pcm_resample_internal.h \
- src/pcm_dither.c src/pcm_dither.h \
- src/pcm_prng.h \
- src/pcm_utils.h
+ src/PcmDither.cxx src/PcmDither.hxx \
+ src/PcmPrng.hxx \
+ src/PcmUtils.hxx
libpcm_a_CPPFLAGS = $(AM_CPPFLAGS) \
$(SAMPLERATE_CFLAGS)
diff --git a/src/MixerAll.cxx b/src/MixerAll.cxx
index a214c1e24..b38005520 100644
--- a/src/MixerAll.cxx
+++ b/src/MixerAll.cxx
@@ -19,8 +19,8 @@
#include "config.h"
#include "MixerAll.hxx"
-#include "pcm_volume.h"
#include "OutputAll.hxx"
+#include "PcmVolume.hxx"
extern "C" {
#include "mixer_control.h"
diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx
index fbbab98ea..c7b01d957 100644
--- a/src/OutputThread.cxx
+++ b/src/OutputThread.cxx
@@ -20,10 +20,10 @@
#include "config.h"
#include "OutputThread.hxx"
#include "output_api.h"
+#include "PcmMix.hxx"
extern "C" {
#include "output_internal.h"
-#include "pcm_mix.h"
#include "filter_plugin.h"
}
diff --git a/src/pcm_channels.c b/src/PcmChannels.cxx
index 9d166a437..3b100e46f 100644
--- a/src/pcm_channels.c
+++ b/src/PcmChannels.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,9 @@
*/
#include "config.h"
-#include "pcm_channels.h"
+#include "PcmChannels.hxx"
#include "pcm_buffer.h"
-#include "pcm_utils.h"
+#include "PcmUtils.hxx"
#include <assert.h>
@@ -84,7 +84,7 @@ pcm_convert_channels_16(struct pcm_buffer *buffer,
size_t dest_size = src_size / src_channels * dest_channels;
*dest_size_r = dest_size;
- int16_t *dest = pcm_buffer_get(buffer, dest_size);
+ int16_t *dest = (int16_t *)pcm_buffer_get(buffer, dest_size);
const int16_t *src_end = pcm_end_pointer(src, src_size);
if (src_channels == 1 && dest_channels == 2)
@@ -160,8 +160,9 @@ pcm_convert_channels_24(struct pcm_buffer *buffer,
size_t dest_size = src_size / src_channels * dest_channels;
*dest_size_r = dest_size;
- int32_t *dest = pcm_buffer_get(buffer, dest_size);
- const int32_t *src_end = pcm_end_pointer(src, src_size);
+ int32_t *dest = (int32_t *)pcm_buffer_get(buffer, dest_size);
+ const int32_t *src_end = (const int32_t *)
+ pcm_end_pointer(src, src_size);
if (src_channels == 1 && dest_channels == 2)
pcm_convert_channels_24_1_to_2(dest, src, src_end);
@@ -229,8 +230,9 @@ pcm_convert_channels_32(struct pcm_buffer *buffer,
size_t dest_size = src_size / src_channels * dest_channels;
*dest_size_r = dest_size;
- int32_t *dest = pcm_buffer_get(buffer, dest_size);
- const int32_t *src_end = pcm_end_pointer(src, src_size);
+ int32_t *dest = (int32_t *)pcm_buffer_get(buffer, dest_size);
+ const int32_t *src_end = (const int32_t *)
+ pcm_end_pointer(src, src_size);
if (src_channels == 1 && dest_channels == 2)
pcm_convert_channels_32_1_to_2(dest, src, src_end);
@@ -300,8 +302,8 @@ pcm_convert_channels_float(struct pcm_buffer *buffer,
size_t dest_size = src_size / src_channels * dest_channels;
*dest_size_r = dest_size;
- float *dest = pcm_buffer_get(buffer, dest_size);
- const float *src_end = pcm_end_pointer(src, src_size);
+ float *dest = (float *)pcm_buffer_get(buffer, dest_size);
+ const float *src_end = (const float *)pcm_end_pointer(src, src_size);
if (src_channels == 1 && dest_channels == 2)
pcm_convert_channels_float_1_to_2(dest, src, src_end);
diff --git a/src/pcm_channels.h b/src/PcmChannels.hxx
index 6da00316d..ede49cd81 100644
--- a/src/pcm_channels.h
+++ b/src/PcmChannels.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_PCM_CHANNELS_H
-#define MPD_PCM_CHANNELS_H
+#ifndef MPD_PCM_CHANNELS_HXX
+#define MPD_PCM_CHANNELS_HXX
#include <stdint.h>
#include <stddef.h>
diff --git a/src/PcmConvert.cxx b/src/PcmConvert.cxx
index 175584c83..ed260d074 100644
--- a/src/PcmConvert.cxx
+++ b/src/PcmConvert.cxx
@@ -19,12 +19,8 @@
#include "config.h"
#include "PcmConvert.hxx"
-
-extern "C" {
-#include "pcm_channels.h"
-#include "pcm_format.h"
-}
-
+#include "PcmChannels.hxx"
+#include "PcmFormat.hxx"
#include "pcm_pack.h"
#include "audio_format.h"
diff --git a/src/PcmConvert.hxx b/src/PcmConvert.hxx
index bec30af45..d76ecc125 100644
--- a/src/PcmConvert.hxx
+++ b/src/PcmConvert.hxx
@@ -20,10 +20,11 @@
#ifndef PCM_CONVERT_HXX
#define PCM_CONVERT_HXX
+#include "PcmDither.hxx"
+
extern "C" {
#include "pcm_dsd.h"
#include "pcm_resample.h"
-#include "pcm_dither.h"
#include "pcm_buffer.h"
}
diff --git a/src/pcm_dither.c b/src/PcmDither.cxx
index 4811946c8..e18119082 100644
--- a/src/pcm_dither.c
+++ b/src/PcmDither.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,8 @@
*/
#include "config.h"
-#include "pcm_dither.h"
-#include "pcm_prng.h"
+#include "PcmDither.hxx"
+#include "PcmPrng.hxx"
static int16_t
pcm_dither_sample_24_to_16(int32_t sample, struct pcm_dither *dither)
diff --git a/src/pcm_dither.h b/src/PcmDither.hxx
index 046dea21e..59affa088 100644
--- a/src/pcm_dither.h
+++ b/src/PcmDither.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_PCM_DITHER_H
-#define MPD_PCM_DITHER_H
+#ifndef MPD_PCM_DITHER_HXX
+#define MPD_PCM_DITHER_HXX
#include <stdint.h>
diff --git a/src/pcm_format.c b/src/PcmFormat.cxx
index d3ea3acb0..cf601684a 100644
--- a/src/pcm_format.c
+++ b/src/PcmFormat.cxx
@@ -18,11 +18,11 @@
*/
#include "config.h"
-#include "pcm_format.h"
-#include "pcm_dither.h"
+#include "PcmFormat.hxx"
+#include "PcmDither.hxx"
#include "pcm_buffer.h"
#include "pcm_pack.h"
-#include "pcm_utils.h"
+#include "PcmUtils.hxx"
static void
pcm_convert_8_to_16(int16_t *out, const int8_t *in, const int8_t *in_end)
@@ -64,7 +64,7 @@ pcm_allocate_8_to_16(struct pcm_buffer *buffer,
{
int16_t *dest;
*dest_size_r = src_size / sizeof(*src) * sizeof(*dest);
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int16_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_8_to_16(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -77,7 +77,7 @@ pcm_allocate_24p32_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
int16_t *dest;
*dest_size_r = src_size / 2;
assert(*dest_size_r == src_size / sizeof(*src) * sizeof(*dest));
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int16_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_24_to_16(dither, dest, src,
pcm_end_pointer(src, src_size));
return dest;
@@ -91,7 +91,7 @@ pcm_allocate_32_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
int16_t *dest;
*dest_size_r = src_size / 2;
assert(*dest_size_r == src_size / sizeof(*src) * sizeof(*dest));
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int16_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_32_to_16(dither, dest, src,
pcm_end_pointer(src, src_size));
return dest;
@@ -105,7 +105,7 @@ pcm_allocate_float_to_16(struct pcm_buffer *buffer,
int16_t *dest;
*dest_size_r = src_size / 2;
assert(*dest_size_r == src_size / sizeof(*src) * sizeof(*dest));
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int16_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_float_to_16(dest, src,
pcm_end_pointer(src, src_size));
return dest;
@@ -125,22 +125,26 @@ pcm_convert_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
case SAMPLE_FORMAT_S8:
return pcm_allocate_8_to_16(buffer,
- src, src_size, dest_size_r);
+ (const int8_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_S16:
*dest_size_r = src_size;
- return src;
+ return (const int16_t *)src;
case SAMPLE_FORMAT_S24_P32:
- return pcm_allocate_24p32_to_16(buffer, dither, src, src_size,
+ return pcm_allocate_24p32_to_16(buffer, dither,
+ (const int32_t *)src, src_size,
dest_size_r);
case SAMPLE_FORMAT_S32:
- return pcm_allocate_32_to_16(buffer, dither, src, src_size,
+ return pcm_allocate_32_to_16(buffer, dither,
+ (const int32_t *)src, src_size,
dest_size_r);
case SAMPLE_FORMAT_FLOAT:
- return pcm_allocate_float_to_16(buffer, src, src_size,
+ return pcm_allocate_float_to_16(buffer,
+ (const float *)src, src_size,
dest_size_r);
}
@@ -188,7 +192,7 @@ pcm_allocate_8_to_24(struct pcm_buffer *buffer,
{
int32_t *dest;
*dest_size_r = src_size / sizeof(*src) * sizeof(*dest);
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_8_to_24(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -200,7 +204,7 @@ pcm_allocate_16_to_24(struct pcm_buffer *buffer,
int32_t *dest;
*dest_size_r = src_size * 2;
assert(*dest_size_r == src_size / sizeof(*src) * sizeof(*dest));
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_16_to_24(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -210,7 +214,7 @@ pcm_allocate_32_to_24(struct pcm_buffer *buffer,
const int32_t *src, size_t src_size, size_t *dest_size_r)
{
*dest_size_r = src_size;
- int32_t *dest = pcm_buffer_get(buffer, *dest_size_r);
+ int32_t *dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_32_to_24(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -221,7 +225,7 @@ pcm_allocate_float_to_24(struct pcm_buffer *buffer,
size_t *dest_size_r)
{
*dest_size_r = src_size;
- int32_t *dest = pcm_buffer_get(buffer, *dest_size_r);
+ int32_t *dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_float_to_24(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -240,22 +244,26 @@ pcm_convert_to_24(struct pcm_buffer *buffer,
case SAMPLE_FORMAT_S8:
return pcm_allocate_8_to_24(buffer,
- src, src_size, dest_size_r);
+ (const int8_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_S16:
return pcm_allocate_16_to_24(buffer,
- src, src_size, dest_size_r);
+ (const int16_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_S24_P32:
*dest_size_r = src_size;
- return src;
+ return (const int32_t *)src;
case SAMPLE_FORMAT_S32:
- return pcm_allocate_32_to_24(buffer, src, src_size,
+ return pcm_allocate_32_to_24(buffer,
+ (const int32_t *)src, src_size,
dest_size_r);
case SAMPLE_FORMAT_FLOAT:
- return pcm_allocate_float_to_24(buffer, src, src_size,
+ return pcm_allocate_float_to_24(buffer,
+ (const float *)src, src_size,
dest_size_r);
}
@@ -291,7 +299,7 @@ pcm_allocate_8_to_32(struct pcm_buffer *buffer,
{
int32_t *dest;
*dest_size_r = src_size / sizeof(*src) * sizeof(*dest);
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_8_to_32(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -303,7 +311,7 @@ pcm_allocate_16_to_32(struct pcm_buffer *buffer,
int32_t *dest;
*dest_size_r = src_size * 2;
assert(*dest_size_r == src_size / sizeof(*src) * sizeof(*dest));
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_16_to_32(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -314,7 +322,7 @@ pcm_allocate_24p32_to_32(struct pcm_buffer *buffer,
size_t *dest_size_r)
{
*dest_size_r = src_size;
- int32_t *dest = pcm_buffer_get(buffer, *dest_size_r);
+ int32_t *dest = (int32_t *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_24_to_32(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -346,23 +354,27 @@ pcm_convert_to_32(struct pcm_buffer *buffer,
break;
case SAMPLE_FORMAT_S8:
- return pcm_allocate_8_to_32(buffer, src, src_size,
+ return pcm_allocate_8_to_32(buffer,
+ (const int8_t *)src, src_size,
dest_size_r);
case SAMPLE_FORMAT_S16:
- return pcm_allocate_16_to_32(buffer, src, src_size,
+ return pcm_allocate_16_to_32(buffer,
+ (const int16_t *)src, src_size,
dest_size_r);
case SAMPLE_FORMAT_S24_P32:
- return pcm_allocate_24p32_to_32(buffer, src, src_size,
+ return pcm_allocate_24p32_to_32(buffer,
+ (const int32_t *)src, src_size,
dest_size_r);
case SAMPLE_FORMAT_S32:
*dest_size_r = src_size;
- return src;
+ return (const int32_t *)src;
case SAMPLE_FORMAT_FLOAT:
- return pcm_allocate_float_to_32(buffer, src, src_size,
+ return pcm_allocate_float_to_32(buffer,
+ (const float *)src, src_size,
dest_size_r);
}
@@ -412,7 +424,7 @@ pcm_allocate_8_to_float(struct pcm_buffer *buffer,
{
float *dest;
*dest_size_r = src_size / sizeof(*src) * sizeof(*dest);
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (float *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_8_to_float(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -425,7 +437,7 @@ pcm_allocate_16_to_float(struct pcm_buffer *buffer,
float *dest;
*dest_size_r = src_size * 2;
assert(*dest_size_r == src_size / sizeof(*src) * sizeof(*dest));
- dest = pcm_buffer_get(buffer, *dest_size_r);
+ dest = (float *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_16_to_float(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -436,7 +448,7 @@ pcm_allocate_24p32_to_float(struct pcm_buffer *buffer,
size_t *dest_size_r)
{
*dest_size_r = src_size;
- float *dest = pcm_buffer_get(buffer, *dest_size_r);
+ float *dest = (float *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_24_to_float(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -447,7 +459,7 @@ pcm_allocate_32_to_float(struct pcm_buffer *buffer,
size_t *dest_size_r)
{
*dest_size_r = src_size;
- float *dest = pcm_buffer_get(buffer, *dest_size_r);
+ float *dest = (float *)pcm_buffer_get(buffer, *dest_size_r);
pcm_convert_32_to_float(dest, src, pcm_end_pointer(src, src_size));
return dest;
}
@@ -464,23 +476,27 @@ pcm_convert_to_float(struct pcm_buffer *buffer,
case SAMPLE_FORMAT_S8:
return pcm_allocate_8_to_float(buffer,
- src, src_size, dest_size_r);
+ (const int8_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_S16:
return pcm_allocate_16_to_float(buffer,
- src, src_size, dest_size_r);
+ (const int16_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_S24_P32:
return pcm_allocate_24p32_to_float(buffer,
- src, src_size, dest_size_r);
+ (const int32_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_S32:
return pcm_allocate_32_to_float(buffer,
- src, src_size, dest_size_r);
+ (const int32_t *)src, src_size,
+ dest_size_r);
case SAMPLE_FORMAT_FLOAT:
*dest_size_r = src_size;
- return src;
+ return (const float *)src;
}
return NULL;
diff --git a/src/pcm_format.h b/src/PcmFormat.hxx
index 48bcd0662..d739f60d1 100644
--- a/src/pcm_format.h
+++ b/src/PcmFormat.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef PCM_FORMAT_H
-#define PCM_FORMAT_H
+#ifndef MPD_PCM_FORMAT_HXX
+#define MPD_PCM_FORMAT_HXX
#include "audio_format.h"
diff --git a/src/pcm_mix.c b/src/PcmMix.cxx
index 6c6d1b4ab..4f8f3882c 100644
--- a/src/pcm_mix.c
+++ b/src/PcmMix.cxx
@@ -18,18 +18,13 @@
*/
#include "config.h"
-#include "pcm_mix.h"
-#include "pcm_volume.h"
-#include "pcm_utils.h"
+#include "PcmMix.hxx"
+#include "PcmVolume.hxx"
+#include "PcmUtils.hxx"
#include "audio_format.h"
-#include <glib.h>
-
#include <math.h>
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "pcm"
-
static void
pcm_add_vol_8(int8_t *buffer1, const int8_t *buffer2,
unsigned num_samples, int volume1, int volume2)
@@ -144,7 +139,8 @@ pcm_add_vol(void *buffer1, const void *buffer2, size_t size,
return true;
case SAMPLE_FORMAT_FLOAT:
- pcm_add_vol_float(buffer1, buffer2, size / 4,
+ pcm_add_vol_float((float *)buffer1, (const float *)buffer2,
+ size / 4,
pcm_volume_to_float(vol1),
pcm_volume_to_float(vol2));
return true;
@@ -249,7 +245,8 @@ pcm_add(void *buffer1, const void *buffer2, size_t size,
return true;
case SAMPLE_FORMAT_FLOAT:
- pcm_add_float(buffer1, buffer2, size / 4);
+ pcm_add_float((float *)buffer1, (const float *)buffer2,
+ size / 4);
return true;
}
diff --git a/src/pcm_mix.h b/src/PcmMix.hxx
index 0cf557680..bb7110d04 100644
--- a/src/pcm_mix.h
+++ b/src/PcmMix.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,13 +17,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef PCM_MIX_H
-#define PCM_MIX_H
+#ifndef MPD_PCM_MIX_HXX
+#define MPD_PCM_MIX_HXX
#include "audio_format.h"
#include "gcc.h"
-#include <stdbool.h>
#include <stddef.h>
/*
diff --git a/src/pcm_prng.h b/src/PcmPrng.hxx
index 457ba4b66..0c823250d 100644
--- a/src/pcm_prng.h
+++ b/src/PcmPrng.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef PCM_PRNG_H
-#define PCM_PRNG_H
+#ifndef MPD_PCM_PRNG_HXX
+#define MPD_PCM_PRNG_HXX
/**
* A very simple linear congruential PRNG. It's good enough for PCM
diff --git a/src/pcm_utils.h b/src/PcmUtils.hxx
index 21df95e48..a95af7e68 100644
--- a/src/pcm_utils.h
+++ b/src/PcmUtils.hxx
@@ -29,10 +29,11 @@
* function to convert a source pointer and a byte count to an "end"
* pointer for use in loops.
*/
-static inline const void *
-pcm_end_pointer(const void *p, size_t size)
+template<typename T>
+static inline const T *
+pcm_end_pointer(const T *p, size_t size)
{
- return (const char *)p + size;
+ return (const T *)((const uint8_t *)p + size);
}
/**
diff --git a/src/pcm_volume.c b/src/PcmVolume.cxx
index 49c86026f..e19469f4a 100644
--- a/src/pcm_volume.c
+++ b/src/PcmVolume.cxx
@@ -18,8 +18,8 @@
*/
#include "config.h"
-#include "pcm_volume.h"
-#include "pcm_utils.h"
+#include "PcmVolume.hxx"
+#include "PcmUtils.hxx"
#include "audio_format.h"
#include <glib.h>
@@ -163,23 +163,27 @@ pcm_volume(void *buffer, size_t length,
return false;
case SAMPLE_FORMAT_S8:
- pcm_volume_change_8(buffer, end, volume);
+ pcm_volume_change_8((int8_t *)buffer, (const int8_t *)end,
+ volume);
return true;
case SAMPLE_FORMAT_S16:
- pcm_volume_change_16(buffer, end, volume);
+ pcm_volume_change_16((int16_t *)buffer, (const int16_t *)end,
+ volume);
return true;
case SAMPLE_FORMAT_S24_P32:
- pcm_volume_change_24(buffer, end, volume);
+ pcm_volume_change_24((int32_t *)buffer, (const int32_t *)end,
+ volume);
return true;
case SAMPLE_FORMAT_S32:
- pcm_volume_change_32(buffer, end, volume);
+ pcm_volume_change_32((int32_t *)buffer, (const int32_t *)end,
+ volume);
return true;
case SAMPLE_FORMAT_FLOAT:
- pcm_volume_change_float(buffer, end,
+ pcm_volume_change_float((float *)buffer, (const float *)end,
pcm_volume_to_float(volume));
return true;
}
diff --git a/src/pcm_volume.h b/src/PcmVolume.hxx
index c161a72c7..d3e6a5536 100644
--- a/src/pcm_volume.h
+++ b/src/PcmVolume.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,10 +17,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef PCM_VOLUME_H
-#define PCM_VOLUME_H
+#ifndef MPD_PCM_VOLUME_HXX
+#define MPD_PCM_VOLUME_HXX
-#include "pcm_prng.h"
+#include "PcmPrng.hxx"
#include "audio_format.h"
#include <stdint.h>
@@ -65,10 +65,6 @@ pcm_volume_dither(void)
return (r & 511) - ((r >> 9) & 511);
}
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* Adjust the volume of the specified PCM buffer.
*
@@ -83,8 +79,4 @@ pcm_volume(void *buffer, size_t length,
enum sample_format format,
int volume);
-#ifdef __cplusplus
-}
-#endif
-
#endif
diff --git a/src/filter/ReplayGainFilterPlugin.cxx b/src/filter/ReplayGainFilterPlugin.cxx
index f4b1f92ee..9fb412be7 100644
--- a/src/filter/ReplayGainFilterPlugin.cxx
+++ b/src/filter/ReplayGainFilterPlugin.cxx
@@ -26,10 +26,10 @@
#include "replay_gain_info.h"
#include "replay_gain_config.h"
#include "mixer_control.h"
+#include "PcmVolume.hxx"
extern "C" {
#include "pcm_buffer.h"
-#include "pcm_volume.h"
}
#include <assert.h>
diff --git a/src/filter/VolumeFilterPlugin.cxx b/src/filter/VolumeFilterPlugin.cxx
index 764d2453f..5066ebbfa 100644
--- a/src/filter/VolumeFilterPlugin.cxx
+++ b/src/filter/VolumeFilterPlugin.cxx
@@ -24,7 +24,7 @@
#include "filter_registry.h"
#include "conf.h"
#include "pcm_buffer.h"
-#include "pcm_volume.h"
+#include "PcmVolume.hxx"
#include "audio_format.h"
#include <assert.h>
diff --git a/src/mixer/SoftwareMixerPlugin.cxx b/src/mixer/SoftwareMixerPlugin.cxx
index 45f564c9d..c06ce18ea 100644
--- a/src/mixer/SoftwareMixerPlugin.cxx
+++ b/src/mixer/SoftwareMixerPlugin.cxx
@@ -23,7 +23,7 @@
#include "filter_plugin.h"
#include "filter_registry.h"
#include "filter/VolumeFilterPlugin.hxx"
-#include "pcm_volume.h"
+#include "PcmVolume.hxx"
#include <assert.h>
#include <math.h>
diff --git a/test/read_mixer.cxx b/test/read_mixer.cxx
index 799bbefd5..d0426c9a9 100644
--- a/test/read_mixer.cxx
+++ b/test/read_mixer.cxx
@@ -25,7 +25,7 @@ extern "C" {
#include "filter_registry.h"
}
-#include "pcm_volume.h"
+#include "PcmVolume.hxx"
#include "GlobalEvents.hxx"
#include "Main.hxx"
#include "event/Loop.hxx"
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index 87672adc5..2d53ed496 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -23,7 +23,7 @@
#include "AudioParser.hxx"
#include "audio_format.h"
#include "filter_plugin.h"
-#include "pcm_volume.h"
+#include "PcmVolume.hxx"
#include "mixer_control.h"
#include "stdbin.h"
diff --git a/test/software_volume.cxx b/test/software_volume.cxx
index 2579a4f0b..929932398 100644
--- a/test/software_volume.cxx
+++ b/test/software_volume.cxx
@@ -24,7 +24,7 @@
*/
#include "config.h"
-#include "pcm_volume.h"
+#include "PcmVolume.hxx"
#include "AudioParser.hxx"
#include "audio_format.h"
#include "stdbin.h"
diff --git a/test/test_pcm_channels.cxx b/test/test_pcm_channels.cxx
index 66f4bc63c..38d030519 100644
--- a/test/test_pcm_channels.cxx
+++ b/test/test_pcm_channels.cxx
@@ -19,9 +19,7 @@
#include "config.h"
#include "test_pcm_all.hxx"
-extern "C" {
-#include "pcm_channels.h"
-}
+#include "PcmChannels.hxx"
#include "pcm_buffer.h"
#include <glib.h>
diff --git a/test/test_pcm_dither.cxx b/test/test_pcm_dither.cxx
index 47b94764d..44830746f 100644
--- a/test/test_pcm_dither.cxx
+++ b/test/test_pcm_dither.cxx
@@ -18,10 +18,7 @@
*/
#include "test_pcm_all.hxx"
-
-extern "C" {
-#include "pcm_dither.h"
-}
+#include "PcmDither.hxx"
#include <glib.h>
diff --git a/test/test_pcm_volume.cxx b/test/test_pcm_volume.cxx
index ab8444411..4ec76e79c 100644
--- a/test/test_pcm_volume.cxx
+++ b/test/test_pcm_volume.cxx
@@ -18,7 +18,7 @@
*/
#include "test_pcm_all.hxx"
-#include "pcm_volume.h"
+#include "PcmVolume.hxx"
#include <glib.h>