From: Carl Hetherington Date: Mon, 27 Jul 2020 22:25:57 +0000 (+0000) Subject: Fix export of projects with fewer than 6 channels. X-Git-Tag: v2.14.34~1 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=e5c629b805bcf3d819c9b15d32bb8a3a9f93ab41 Fix export of projects with fewer than 6 channels. --- diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 68575d11a..afba7c187 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -93,12 +93,23 @@ FFmpegEncoder::FFmpegEncoder ( map = AudioMapping (ch, 2); float const overall_gain = 2 / (4 + sqrt(2)); float const minus_3dB = 1 / sqrt(2); - map.set (dcp::LEFT, 0, overall_gain); - map.set (dcp::RIGHT, 1, overall_gain); - map.set (dcp::CENTRE, 0, overall_gain * minus_3dB); - map.set (dcp::CENTRE, 1, overall_gain * minus_3dB); - map.set (dcp::LS, 0, overall_gain); - map.set (dcp::RS, 1, overall_gain); + if (ch == 2) { + map.set (dcp::LEFT, 0, 1); + map.set (dcp::RIGHT, 1, 1); + } else if (ch == 4) { + map.set (dcp::LEFT, 0, overall_gain); + map.set (dcp::RIGHT, 1, overall_gain); + map.set (dcp::CENTRE, 0, overall_gain * minus_3dB); + map.set (dcp::CENTRE, 1, overall_gain * minus_3dB); + map.set (dcp::LS, 0, overall_gain); + } else if (ch >= 6) { + map.set (dcp::LEFT, 0, overall_gain); + map.set (dcp::RIGHT, 1, overall_gain); + map.set (dcp::CENTRE, 0, overall_gain * minus_3dB); + map.set (dcp::CENTRE, 1, overall_gain * minus_3dB); + map.set (dcp::LS, 0, overall_gain); + map.set (dcp::RS, 1, overall_gain); + } } else { _output_audio_channels = ch; map = AudioMapping (ch, ch);