diff --git a/src/pcm/Export.cxx b/src/pcm/Export.cxx index de1bee799..807bfa734 100644 --- a/src/pcm/Export.cxx +++ b/src/pcm/Export.cxx @@ -32,10 +32,9 @@ PcmExport::Open(SampleFormat sample_format, unsigned _channels, { assert(audio_valid_sample_format(sample_format)); + src_sample_format = sample_format; channels = _channels; - alsa_channel_order = params.alsa_channel_order - ? sample_format - : SampleFormat::UNDEFINED; + alsa_channel_order = params.alsa_channel_order; #ifdef ENABLE_DSD assert(params.dsd_mode != DsdMode::DOP || @@ -204,9 +203,9 @@ PcmExport::Params::CalcInputSampleRate(unsigned sample_rate) const noexcept ConstBuffer PcmExport::Export(ConstBuffer data) noexcept { - if (alsa_channel_order != SampleFormat::UNDEFINED) + if (alsa_channel_order) data = ToAlsaChannelOrder(order_buffer, data, - alsa_channel_order, channels); + src_sample_format, channels); #ifdef ENABLE_DSD switch (dsd_mode) { diff --git a/src/pcm/Export.hxx b/src/pcm/Export.hxx index 1d6e6101e..6748c0b88 100644 --- a/src/pcm/Export.hxx +++ b/src/pcm/Export.hxx @@ -79,6 +79,11 @@ class PcmExport { */ PcmBuffer reverse_buffer; + /** + * The sample format of input data. + */ + SampleFormat src_sample_format; + /** * The number of channels. */ @@ -87,12 +92,8 @@ class PcmExport { /** * Convert the given buffer from FLAC channel order to ALSA * channel order using ToAlsaChannelOrder()? - * - * If this value is SampleFormat::UNDEFINED, then no channel - * reordering is applied, otherwise this is the input sample - * format. */ - SampleFormat alsa_channel_order; + bool alsa_channel_order; #ifdef ENABLE_DSD public: