aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-03 21:00:50 +0200
committerMax Kellermann <max@duempel.org>2013-08-03 21:37:56 +0200
commitd1e7b4e38136f9342aad76c685a13adf0e69f869 (patch)
tree49643b937ddfe735511b566a71398da5a945d7aa /test
parent67f591a9ce60651da41afc499bd9a22e25314e35 (diff)
downloadmpd-d1e7b4e38136f9342aad76c685a13adf0e69f869.tar.gz
mpd-d1e7b4e38136f9342aad76c685a13adf0e69f869.tar.xz
mpd-d1e7b4e38136f9342aad76c685a13adf0e69f869.zip
audio_format: convert to C++
Diffstat (limited to 'test')
-rw-r--r--test/dump_playlist.cxx2
-rw-r--r--test/read_mixer.cxx2
-rw-r--r--test/read_tags.cxx4
-rw-r--r--test/run_convert.cxx18
-rw-r--r--test/run_decoder.cxx6
-rw-r--r--test/run_encoder.cxx10
-rw-r--r--test/run_filter.cxx13
-rw-r--r--test/run_normalize.cxx9
-rw-r--r--test/run_output.cxx15
-rw-r--r--test/software_volume.cxx11
-rw-r--r--test/test_pcm_format.cxx12
-rw-r--r--test/test_pcm_mix.cxx10
-rw-r--r--test/test_pcm_volume.cxx30
-rw-r--r--test/test_vorbis_encoder.cxx8
14 files changed, 71 insertions, 79 deletions
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index ea341ab95..bf8ddcdfe 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -51,7 +51,7 @@ my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
void
decoder_initialized(G_GNUC_UNUSED struct decoder *decoder,
- G_GNUC_UNUSED const struct audio_format *audio_format,
+ G_GNUC_UNUSED const AudioFormat audio_format,
G_GNUC_UNUSED bool seekable,
G_GNUC_UNUSED float total_time)
{
diff --git a/test/read_mixer.cxx b/test/read_mixer.cxx
index 8fc89e93d..1d8372a98 100644
--- a/test/read_mixer.cxx
+++ b/test/read_mixer.cxx
@@ -101,7 +101,7 @@ filter_plugin_by_name(G_GNUC_UNUSED const char *name)
bool
pcm_volume(G_GNUC_UNUSED void *buffer, G_GNUC_UNUSED size_t length,
- G_GNUC_UNUSED enum sample_format format,
+ G_GNUC_UNUSED SampleFormat format,
G_GNUC_UNUSED int volume)
{
assert(false);
diff --git a/test/read_tags.cxx b/test/read_tags.cxx
index ee9464b2c..420cf9f0e 100644
--- a/test/read_tags.cxx
+++ b/test/read_tags.cxx
@@ -23,7 +23,7 @@
#include "DecoderAPI.hxx"
#include "InputInit.hxx"
#include "InputStream.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "TagHandler.hxx"
#include "TagId3.hxx"
#include "ApeTag.hxx"
@@ -40,7 +40,7 @@
void
decoder_initialized(G_GNUC_UNUSED struct decoder *decoder,
- G_GNUC_UNUSED const struct audio_format *audio_format,
+ G_GNUC_UNUSED const AudioFormat audio_format,
G_GNUC_UNUSED bool seekable,
G_GNUC_UNUSED float total_time)
{
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index 2b0214912..ce7df42c3 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -25,7 +25,7 @@
#include "config.h"
#include "AudioParser.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "pcm/PcmConvert.hxx"
#include "conf.h"
#include "util/fifo_buffer.h"
@@ -57,7 +57,7 @@ config_get_string(gcc_unused enum ConfigOption option,
int main(int argc, char **argv)
{
GError *error = NULL;
- struct audio_format in_audio_format, out_audio_format;
+ AudioFormat in_audio_format, out_audio_format;
const void *output;
ssize_t nbytes;
size_t length;
@@ -69,15 +69,15 @@ int main(int argc, char **argv)
g_log_set_default_handler(my_log_func, NULL);
- if (!audio_format_parse(&in_audio_format, argv[1],
+ if (!audio_format_parse(in_audio_format, argv[1],
false, &error)) {
g_printerr("Failed to parse audio format: %s\n",
error->message);
return 1;
}
- struct audio_format out_audio_format_mask;
- if (!audio_format_parse(&out_audio_format_mask, argv[2],
+ AudioFormat out_audio_format_mask;
+ if (!audio_format_parse(out_audio_format_mask, argv[2],
true, &error)) {
g_printerr("Failed to parse audio format: %s\n",
error->message);
@@ -85,9 +85,9 @@ int main(int argc, char **argv)
}
out_audio_format = in_audio_format;
- audio_format_mask_apply(&out_audio_format, &out_audio_format_mask);
+ out_audio_format.ApplyMask(out_audio_format_mask);
- const size_t in_frame_size = audio_format_frame_size(&in_audio_format);
+ const size_t in_frame_size = in_audio_format.GetFrameSize();
PcmConvert state;
@@ -112,8 +112,8 @@ int main(int argc, char **argv)
fifo_buffer_consume(buffer, length);
- output = state.Convert(&in_audio_format, src, length,
- &out_audio_format, &length, &error);
+ output = state.Convert(in_audio_format, src, length,
+ out_audio_format, &length, &error);
if (output == NULL) {
g_printerr("Failed to convert: %s\n", error->message);
return 2;
diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx
index a05afb113..a5826b278 100644
--- a/test/run_decoder.cxx
+++ b/test/run_decoder.cxx
@@ -23,7 +23,7 @@
#include "DecoderAPI.hxx"
#include "InputInit.hxx"
#include "input_stream.h"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "stdbin.h"
#include <glib.h>
@@ -52,14 +52,14 @@ struct decoder {
void
decoder_initialized(struct decoder *decoder,
- const struct audio_format *audio_format,
+ const AudioFormat audio_format,
G_GNUC_UNUSED bool seekable,
G_GNUC_UNUSED float total_time)
{
struct audio_format_string af_string;
assert(!decoder->initialized);
- assert(audio_format_valid(audio_format));
+ assert(audio_format.IsValid());
g_printerr("audio_format=%s\n",
audio_format_to_string(audio_format, &af_string));
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index 1beb434df..4b1521b99 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "EncoderList.hxx"
#include "EncoderPlugin.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "AudioParser.hxx"
#include "conf.h"
#include "stdbin.h"
@@ -44,7 +44,6 @@ encoder_to_stdout(Encoder &encoder)
int main(int argc, char **argv)
{
GError *error = NULL;
- struct audio_format audio_format;
bool ret;
const char *encoder_name;
static char buffer[32768];
@@ -61,8 +60,6 @@ int main(int argc, char **argv)
else
encoder_name = "vorbis";
- audio_format_init(&audio_format, 44100, SAMPLE_FORMAT_S16, 2);
-
/* create the encoder */
const auto plugin = encoder_plugin_get(encoder_name);
@@ -84,8 +81,9 @@ int main(int argc, char **argv)
/* open the encoder */
+ AudioFormat audio_format(44100, SampleFormat::S16, 2);
if (argc > 2) {
- ret = audio_format_parse(&audio_format, argv[2],
+ ret = audio_format_parse(audio_format, argv[2],
false, &error);
if (!ret) {
g_printerr("Failed to parse audio format: %s\n",
@@ -95,7 +93,7 @@ int main(int argc, char **argv)
}
}
- if (!encoder_open(encoder, &audio_format, &error)) {
+ if (!encoder_open(encoder, audio_format, &error)) {
g_printerr("Failed to open encoder: %s\n",
error->message);
g_error_free(error);
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index 8df3fa732..db4a2ee89 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -21,7 +21,7 @@
#include "conf.h"
#include "fs/Path.hxx"
#include "AudioParser.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "FilterPlugin.hxx"
#include "FilterInternal.hxx"
#include "pcm/PcmVolume.hxx"
@@ -91,11 +91,9 @@ load_filter(const char *name)
int main(int argc, char **argv)
{
- struct audio_format audio_format;
struct audio_format_string af_string;
bool success;
GError *error = NULL;
- const struct audio_format *out_audio_format;
char buffer[4096];
if (argc < 3 || argc > 4) {
@@ -105,7 +103,7 @@ int main(int argc, char **argv)
const Path config_path = Path::FromFS(argv[1]);
- audio_format_init(&audio_format, 44100, SAMPLE_FORMAT_S16, 2);
+ AudioFormat audio_format(44100, SampleFormat::S16, 2);
/* initialize GLib */
@@ -127,7 +125,7 @@ int main(int argc, char **argv)
/* parse the audio format */
if (argc > 3) {
- success = audio_format_parse(&audio_format, argv[3],
+ success = audio_format_parse(audio_format, argv[3],
false, &error);
if (!success) {
g_printerr("Failed to parse audio format: %s\n",
@@ -145,8 +143,9 @@ int main(int argc, char **argv)
/* open the filter */
- out_audio_format = filter->Open(audio_format, &error);
- if (out_audio_format == NULL) {
+ const AudioFormat out_audio_format =
+ filter->Open(audio_format, &error);
+ if (!out_audio_format.IsDefined()) {
g_printerr("Failed to open filter: %s\n", error->message);
g_error_free(error);
delete filter;
diff --git a/test/run_normalize.cxx b/test/run_normalize.cxx
index 070dbaf5a..72e23054f 100644
--- a/test/run_normalize.cxx
+++ b/test/run_normalize.cxx
@@ -26,7 +26,7 @@
#include "config.h"
#include "AudioCompress/compress.h"
#include "AudioParser.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "stdbin.h"
#include <glib.h>
@@ -38,7 +38,6 @@
int main(int argc, char **argv)
{
GError *error = NULL;
- struct audio_format audio_format;
bool ret;
struct Compressor *compressor;
static char buffer[4096];
@@ -49,16 +48,16 @@ int main(int argc, char **argv)
return 1;
}
+ AudioFormat audio_format(48000, SampleFormat::S16, 2);
if (argc > 1) {
- ret = audio_format_parse(&audio_format, argv[1],
+ ret = audio_format_parse(audio_format, argv[1],
false, &error);
if (!ret) {
g_printerr("Failed to parse audio format: %s\n",
error->message);
return 1;
}
- } else
- audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, 2);
+ }
compressor = Compressor_new(0);
diff --git a/test/run_output.cxx b/test/run_output.cxx
index 399d8e731..34879c657 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -52,9 +52,9 @@ PcmConvert::PcmConvert() {}
PcmConvert::~PcmConvert() {}
const void *
-PcmConvert::Convert(gcc_unused const audio_format *src_format,
+PcmConvert::Convert(gcc_unused const AudioFormat src_format,
gcc_unused const void *src, gcc_unused size_t src_size,
- gcc_unused const audio_format *dest_format,
+ gcc_unused const AudioFormat dest_format,
gcc_unused size_t *dest_size_r,
gcc_unused GError **error_r)
{
@@ -114,7 +114,7 @@ load_audio_output(const char *name)
}
static bool
-run_output(struct audio_output *ao, struct audio_format *audio_format)
+run_output(struct audio_output *ao, AudioFormat audio_format)
{
/* open the audio output */
@@ -138,7 +138,7 @@ run_output(struct audio_output *ao, struct audio_format *audio_format)
g_printerr("audio_format=%s\n",
audio_format_to_string(audio_format, &af_string));
- size_t frame_size = audio_format_frame_size(audio_format);
+ size_t frame_size = audio_format.GetFrameSize();
/* play */
@@ -183,7 +183,6 @@ run_output(struct audio_output *ao, struct audio_format *audio_format)
int main(int argc, char **argv)
{
- struct audio_format audio_format;
bool success;
GError *error = NULL;
@@ -194,7 +193,7 @@ int main(int argc, char **argv)
const Path config_path = Path::FromFS(argv[1]);
- audio_format_init(&audio_format, 44100, SAMPLE_FORMAT_S16, 2);
+ AudioFormat audio_format(44100, SampleFormat::S16, 2);
#if !GLIB_CHECK_VERSION(2,32,0)
g_thread_init(NULL);
@@ -227,7 +226,7 @@ int main(int argc, char **argv)
/* parse the audio format */
if (argc > 3) {
- success = audio_format_parse(&audio_format, argv[3],
+ success = audio_format_parse(audio_format, argv[3],
false, &error);
if (!success) {
g_printerr("Failed to parse audio format: %s\n",
@@ -239,7 +238,7 @@ int main(int argc, char **argv)
/* do it */
- success = run_output(ao, &audio_format);
+ success = run_output(ao, audio_format);
/* cleanup and exit */
diff --git a/test/software_volume.cxx b/test/software_volume.cxx
index fee4eeff3..c46804731 100644
--- a/test/software_volume.cxx
+++ b/test/software_volume.cxx
@@ -26,7 +26,7 @@
#include "config.h"
#include "pcm/PcmVolume.hxx"
#include "AudioParser.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "stdbin.h"
#include <glib.h>
@@ -37,7 +37,6 @@
int main(int argc, char **argv)
{
GError *error = NULL;
- struct audio_format audio_format;
bool ret;
static char buffer[4096];
ssize_t nbytes;
@@ -47,20 +46,20 @@ int main(int argc, char **argv)
return 1;
}
+ AudioFormat audio_format(48000, SampleFormat::S16, 2);
if (argc > 1) {
- ret = audio_format_parse(&audio_format, argv[1],
+ ret = audio_format_parse(audio_format, argv[1],
false, &error);
if (!ret) {
g_printerr("Failed to parse audio format: %s\n",
error->message);
return 1;
}
- } else
- audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, 2);
+ }
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
if (!pcm_volume(buffer, nbytes,
- sample_format(audio_format.format),
+ audio_format.format,
PCM_VOLUME_1 / 2)) {
g_printerr("pcm_volume() has failed\n");
return 2;
diff --git a/test/test_pcm_format.cxx b/test/test_pcm_format.cxx
index d7a0a2698..65d744671 100644
--- a/test/test_pcm_format.cxx
+++ b/test/test_pcm_format.cxx
@@ -24,7 +24,7 @@
#include "pcm/PcmDither.hxx"
#include "pcm/PcmUtils.hxx"
#include "pcm/PcmBuffer.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include <glib.h>
@@ -38,7 +38,7 @@ test_pcm_format_8_to_16()
size_t d_size;
PcmDither dither;
- auto d = pcm_convert_to_16(buffer, dither, SAMPLE_FORMAT_S8,
+ auto d = pcm_convert_to_16(buffer, dither, SampleFormat::S8,
src, sizeof(src), &d_size);
auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N);
@@ -56,7 +56,7 @@ test_pcm_format_16_to_24()
PcmBuffer buffer;
size_t d_size;
- auto d = pcm_convert_to_24(buffer, SAMPLE_FORMAT_S16,
+ auto d = pcm_convert_to_24(buffer, SampleFormat::S16,
src, sizeof(src), &d_size);
auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N);
@@ -74,7 +74,7 @@ test_pcm_format_16_to_32()
PcmBuffer buffer;
size_t d_size;
- auto d = pcm_convert_to_32(buffer, SAMPLE_FORMAT_S16,
+ auto d = pcm_convert_to_32(buffer, SampleFormat::S16,
src, sizeof(src), &d_size);
auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N);
@@ -92,7 +92,7 @@ test_pcm_format_float()
PcmBuffer buffer1, buffer2;
size_t f_size;
- auto f = pcm_convert_to_float(buffer1, SAMPLE_FORMAT_S16,
+ auto f = pcm_convert_to_float(buffer1, SampleFormat::S16,
src, sizeof(src), &f_size);
auto f_end = pcm_end_pointer(f, f_size);
g_assert_cmpint(f_end - f, ==, N);
@@ -106,7 +106,7 @@ test_pcm_format_float()
size_t d_size;
auto d = pcm_convert_to_16(buffer2, dither,
- SAMPLE_FORMAT_FLOAT,
+ SampleFormat::FLOAT,
f, f_size, &d_size);
auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N);
diff --git a/test/test_pcm_mix.cxx b/test/test_pcm_mix.cxx
index b4d8486bf..b0e89639c 100644
--- a/test/test_pcm_mix.cxx
+++ b/test/test_pcm_mix.cxx
@@ -24,7 +24,7 @@
#include <glib.h>
-template<typename T, sample_format format, typename G=GlibRandomInt<T>>
+template<typename T, SampleFormat format, typename G=GlibRandomInt<T>>
void
TestPcmMix(G g=G())
{
@@ -62,23 +62,23 @@ TestPcmMix(G g=G())
void
test_pcm_mix_8()
{
- TestPcmMix<int8_t, SAMPLE_FORMAT_S8>();
+ TestPcmMix<int8_t, SampleFormat::S8>();
}
void
test_pcm_mix_16()
{
- TestPcmMix<int16_t, SAMPLE_FORMAT_S16>();
+ TestPcmMix<int16_t, SampleFormat::S16>();
}
void
test_pcm_mix_24()
{
- TestPcmMix<int32_t, SAMPLE_FORMAT_S24_P32>(GlibRandomInt24());
+ TestPcmMix<int32_t, SampleFormat::S24_P32>(GlibRandomInt24());
}
void
test_pcm_mix_32()
{
- TestPcmMix<int32_t, SAMPLE_FORMAT_S32>();
+ TestPcmMix<int32_t, SampleFormat::S32>();
}
diff --git a/test/test_pcm_volume.cxx b/test/test_pcm_volume.cxx
index ec3ac23b9..d5aa3782e 100644
--- a/test/test_pcm_volume.cxx
+++ b/test/test_pcm_volume.cxx
@@ -37,17 +37,17 @@ test_pcm_volume_8()
int8_t dest[N];
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S8,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S8,
0), ==, true);
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S8,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S8,
PCM_VOLUME_1), ==, true);
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S8,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S8,
PCM_VOLUME_1 / 2), ==, true);
for (unsigned i = 0; i < N; ++i) {
@@ -66,17 +66,17 @@ test_pcm_volume_16()
int16_t dest[N];
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S16,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S16,
0), ==, true);
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S16,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S16,
PCM_VOLUME_1), ==, true);
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S16,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S16,
PCM_VOLUME_1 / 2), ==, true);
for (unsigned i = 0; i < N; ++i) {
@@ -95,17 +95,17 @@ test_pcm_volume_24()
int32_t dest[N];
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S24_P32,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S24_P32,
0), ==, true);
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S24_P32,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S24_P32,
PCM_VOLUME_1), ==, true);
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S24_P32,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S24_P32,
PCM_VOLUME_1 / 2), ==, true);
for (unsigned i = 0; i < N; ++i) {
@@ -124,17 +124,17 @@ test_pcm_volume_32()
int32_t dest[N];
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S32,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S32,
0), ==, true);
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S32,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S32,
PCM_VOLUME_1), ==, true);
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_S32,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S32,
PCM_VOLUME_1 / 2), ==, true);
for (unsigned i = 0; i < N; ++i) {
@@ -153,17 +153,17 @@ test_pcm_volume_float()
float dest[N];
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_FLOAT,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::FLOAT,
0), ==, true);
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_FLOAT,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::FLOAT,
PCM_VOLUME_1), ==, true);
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0);
std::copy(src.begin(), src.end(), dest);
- g_assert_cmpint(pcm_volume(dest, sizeof(dest), SAMPLE_FORMAT_FLOAT,
+ g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::FLOAT,
PCM_VOLUME_1 / 2), ==, true);
for (unsigned i = 0; i < N; ++i)
diff --git a/test/test_vorbis_encoder.cxx b/test/test_vorbis_encoder.cxx
index 650480319..a523f9d72 100644
--- a/test/test_vorbis_encoder.cxx
+++ b/test/test_vorbis_encoder.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "EncoderList.hxx"
#include "EncoderPlugin.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "conf.h"
#include "stdbin.h"
#include "Tag.hxx"
@@ -61,10 +61,8 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
/* open the encoder */
- struct audio_format audio_format;
-
- audio_format_init(&audio_format, 44100, SAMPLE_FORMAT_S16, 2);
- success = encoder_open(encoder, &audio_format, NULL);
+ AudioFormat audio_format(44100, SampleFormat::S16, 2);
+ success = encoder_open(encoder, audio_format, NULL);
assert(success);
encoder_to_stdout(*encoder);