diff options
author | Dan Glastonbury <[email protected]> | 2018-03-23 11:31:29 +1000 |
---|---|---|
committer | Dan Glastonbury <[email protected]> | 2018-03-23 14:38:34 +1000 |
commit | 77cb1a9a37bb9fcc43743770727cb6a31b27ab74 (patch) | |
tree | a8b0aaa6b67f8cea466a3c7f3bd10d383bc06ed8 /src/cubeb_mixer.cpp | |
parent | 3c8205901f20f8ec0bb01fea190a2f24c6e11a21 (diff) | |
download | cubeb-77cb1a9a37bb9fcc43743770727cb6a31b27ab74.tar.gz cubeb-77cb1a9a37bb9fcc43743770727cb6a31b27ab74.zip |
Eliminate warning from MixerContext constructor.
Diffstat (limited to 'src/cubeb_mixer.cpp')
-rw-r--r-- | src/cubeb_mixer.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/cubeb_mixer.cpp b/src/cubeb_mixer.cpp index 4b22add..9b9ba59 100644 --- a/src/cubeb_mixer.cpp +++ b/src/cubeb_mixer.cpp @@ -64,6 +64,18 @@ #define C_45DB 0.594603558 #define C_60DB 0.5 +static cubeb_channel_layout +cubeb_channel_layout_check(cubeb_channel_layout l, uint32_t c) +{ + if (l == CUBEB_LAYOUT_UNDEFINED) { + switch (c) { + case 1: return CUBEB_LAYOUT_MONO; + case 2: return CUBEB_LAYOUT_STEREO; + } + } + return l; +} + unsigned int cubeb_channel_layout_nb_channels(cubeb_channel_layout x) { #if __GNUC__ || __clang__ @@ -85,18 +97,8 @@ struct MixerContext { uint32_t out_channels, cubeb_channel_layout out) : _format(f) - , _in_ch_layout(in == CUBEB_LAYOUT_UNDEFINED - ? (in_channels == 1 - ? CUBEB_LAYOUT_MONO - : (in_channels == 2 ? CUBEB_LAYOUT_STEREO - : CUBEB_LAYOUT_UNDEFINED)) - : in) - , _out_ch_layout( - (out == CUBEB_LAYOUT_UNDEFINED - ? (out_channels == 1 ? CUBEB_LAYOUT_MONO - : (out_channels == 2 ? CUBEB_LAYOUT_STEREO - : CUBEB_LAYOUT_UNDEFINED)) - : out)) + , _in_ch_layout(cubeb_channel_layout_check(in, in_channels)) + , _out_ch_layout(cubeb_channel_layout_check(out, out_channels)) , _in_ch_count(in_channels) , _out_ch_count(out_channels) { |