X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffilm_viewer.cc;h=509cc9426dd279ed14e960f6b12a8a4f5f2263dc;hb=e0b2ef3dbac6fc4900cad6fea4395c212578602b;hp=9b01cd394bdee06f65e30915e381f7f3a1b6f8cd;hpb=c8db1d4012217ec295d2a77581cf0661543dc9af;p=dcpomatic.git diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 9b01cd394..509cc9426 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -209,40 +209,17 @@ FilmViewer::recreate_butler () return; } - AudioMapping map = AudioMapping (_film->audio_channels(), _audio_channels); - - if (_audio_channels != 2 || _film->audio_channels() < 3) { - for (int i = 0; i < min (_film->audio_channels(), _audio_channels); ++i) { - map.set (i, i, 1); - } - } else { - /* Special case: stereo output, at least 3 channel input. - Map so that Lt = L(-3dB) + Ls(-3dB) + C(-6dB) + Lfe(-10dB) - Rt = R(-3dB) + Rs(-3dB) + C(-6dB) + Lfe(-10dB) - */ - if (_film->audio_channels() > 0) { - map.set (dcp::LEFT, 0, 1 / sqrt(2)); // L -> Lt - } - if (_film->audio_channels() > 1) { - map.set (dcp::RIGHT, 1, 1 / sqrt(2)); // R -> Rt - } - if (_film->audio_channels() > 2) { - map.set (dcp::CENTRE, 0, 1 / 2.0); // C -> Lt - map.set (dcp::CENTRE, 1, 1 / 2.0); // C -> Rt - } - if (_film->audio_channels() > 3) { - map.set (dcp::LFE, 0, 1 / sqrt(10)); // Lfe -> Lt - map.set (dcp::LFE, 1, 1 / sqrt(10)); // Lfe -> Rt - } - if (_film->audio_channels() > 4) { - map.set (dcp::LS, 0, 1 / sqrt(2)); // Ls -> Lt - } - if (_film->audio_channels() > 5) { - map.set (dcp::RS, 1, 1 / sqrt(2)); // Rs -> Rt - } - } + _butler.reset( + new Butler( + _player, + Config::instance()->audio_mapping(_audio_channels), + _audio_channels, + bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), + false, + true + ) + ); - _butler.reset (new Butler(_player, map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true)); if (!Config::instance()->sound() && !_audio.isStreamOpen()) { _butler->disable_audio (); } @@ -626,6 +603,11 @@ FilmViewer::config_changed (Config::Property p) } #endif + if (p == Config::AUDIO_MAPPING) { + recreate_butler (); + return; + } + if (p != Config::SOUND && p != Config::SOUND_OUTPUT) { return; } @@ -754,7 +736,7 @@ FilmViewer::dcp_decode_reduction () const DCPTime FilmViewer::one_video_frame () const { - return DCPTime::from_frames (1, _film->video_frame_rate()); + return DCPTime::from_frames (1, _film ? _film->video_frame_rate() : 24); } /** Open a dialog box showing our film's closed captions */