diff --git a/Makefile.am b/Makefile.am index 167b61768..357416a03 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1257,7 +1257,7 @@ endif if ENABLE_ENCODER noinst_PROGRAMS += test/run_encoder -test_run_encoder_SOURCES = test/run_encoder.c \ +test_run_encoder_SOURCES = test/run_encoder.cxx \ test/stdbin.h \ src/tokenizer.c src/utils.c src/string_util.c \ src/Tag.cxx src/TagNames.c src/TagPool.cxx \ @@ -1295,7 +1295,7 @@ test_test_vorbis_encoder_LDADD = $(MPD_LIBS) \ $(GLIB_LIBS) endif -test_software_volume_SOURCES = test/software_volume.c \ +test_software_volume_SOURCES = test/software_volume.cxx \ test/stdbin.h \ src/audio_check.c \ src/audio_parser.c @@ -1311,7 +1311,7 @@ test_run_normalize_SOURCES = test/run_normalize.c \ test_run_normalize_LDADD = \ $(GLIB_LIBS) -test_run_convert_SOURCES = test/run_convert.c \ +test_run_convert_SOURCES = test/run_convert.cxx \ src/dsd2pcm/dsd2pcm.c \ src/audio_format.c \ src/audio_check.c \ diff --git a/src/audio_parser.h b/src/audio_parser.h index 49926999e..bbe868f61 100644 --- a/src/audio_parser.h +++ b/src/audio_parser.h @@ -31,6 +31,10 @@ struct audio_format; +#ifdef __cplusplus +extern "C" { +#endif + /** * Parses a string in the form "SAMPLE_RATE:BITS:CHANNELS" into an * #audio_format. @@ -46,4 +50,8 @@ bool audio_format_parse(struct audio_format *dest, const char *src, bool mask, GError **error_r); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/pcm_volume.h b/src/pcm_volume.h index 4a4a4e45a..c161a72c7 100644 --- a/src/pcm_volume.h +++ b/src/pcm_volume.h @@ -65,6 +65,10 @@ pcm_volume_dither(void) return (r & 511) - ((r >> 9) & 511); } +#ifdef __cplusplus +extern "C" { +#endif + /** * Adjust the volume of the specified PCM buffer. * @@ -79,4 +83,8 @@ pcm_volume(void *buffer, size_t length, enum sample_format format, int volume); +#ifdef __cplusplus +} +#endif + #endif diff --git a/test/run_convert.c b/test/run_convert.cxx similarity index 98% rename from test/run_convert.c rename to test/run_convert.cxx index bdb3d2cf0..a71ebc2c4 100644 --- a/test/run_convert.c +++ b/test/run_convert.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 diff --git a/test/run_encoder.c b/test/run_encoder.cxx similarity index 98% rename from test/run_encoder.c rename to test/run_encoder.cxx index db4d3af9b..6a1412969 100644 --- a/test/run_encoder.c +++ b/test/run_encoder.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 @@ -51,7 +51,6 @@ int main(int argc, char **argv) struct encoder *encoder; struct config_param *param; static char buffer[32768]; - ssize_t nbytes; /* parse command line */ @@ -110,6 +109,7 @@ int main(int argc, char **argv) /* do it */ + ssize_t nbytes; while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) { ret = encoder_write(encoder, buffer, nbytes, &error); if (!ret) { diff --git a/test/software_volume.c b/test/software_volume.cxx similarity index 92% rename from test/software_volume.c rename to test/software_volume.cxx index 2357da672..180686650 100644 --- a/test/software_volume.c +++ b/test/software_volume.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 @@ -59,7 +59,8 @@ int main(int argc, char **argv) audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, 2); while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) { - if (!pcm_volume(buffer, nbytes, audio_format.format, + if (!pcm_volume(buffer, nbytes, + sample_format(audio_format.format), PCM_VOLUME_1 / 2)) { g_printerr("pcm_volume() has failed\n"); return 2;