From d1e7b4e38136f9342aad76c685a13adf0e69f869 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Aug 2013 21:00:50 +0200 Subject: audio_format: convert to C++ --- src/output/OpenALOutputPlugin.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/output/OpenALOutputPlugin.cxx') diff --git a/src/output/OpenALOutputPlugin.cxx b/src/output/OpenALOutputPlugin.cxx index e68032d75..81c75f6c4 100644 --- a/src/output/OpenALOutputPlugin.cxx +++ b/src/output/OpenALOutputPlugin.cxx @@ -66,26 +66,26 @@ openal_output_quark(void) } static ALenum -openal_audio_format(struct audio_format *audio_format) +openal_audio_format(AudioFormat &audio_format) { - /* note: cannot map SAMPLE_FORMAT_S8 to AL_FORMAT_STEREO8 or + /* note: cannot map SampleFormat::S8 to AL_FORMAT_STEREO8 or AL_FORMAT_MONO8 since OpenAL expects unsigned 8 bit samples, while MPD uses signed samples */ - switch (audio_format->format) { - case SAMPLE_FORMAT_S16: - if (audio_format->channels == 2) + switch (audio_format.format) { + case SampleFormat::S16: + if (audio_format.channels == 2) return AL_FORMAT_STEREO16; - if (audio_format->channels == 1) + if (audio_format.channels == 1) return AL_FORMAT_MONO16; /* fall back to mono */ - audio_format->channels = 1; + audio_format.channels = 1; return openal_audio_format(audio_format); default: /* fall back to 16 bit */ - audio_format->format = SAMPLE_FORMAT_S16; + audio_format.format = SampleFormat::S16; return openal_audio_format(audio_format); } } @@ -169,7 +169,7 @@ openal_finish(struct audio_output *ao) } static bool -openal_open(struct audio_output *ao, struct audio_format *audio_format, +openal_open(struct audio_output *ao, AudioFormat &audio_format, GError **error) { OpenALOutput *od = (OpenALOutput *)ao; @@ -199,7 +199,7 @@ openal_open(struct audio_output *ao, struct audio_format *audio_format, } od->filled = 0; - od->frequency = audio_format->sample_rate; + od->frequency = audio_format.sample_rate; return true; } -- cgit v1.2.3