2 Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "lib/audio_content.h"
23 #include "lib/content.h"
24 #include "lib/content_factory.h"
29 #include <boost/test/unit_test.hpp>
32 using std::shared_ptr;
35 BOOST_AUTO_TEST_CASE(main_sound_configuration_test_51_vi)
37 auto picture = content_factory("test/data/flat_red.png")[0];
38 auto L = content_factory("test/data/L.wav")[0];
39 auto R = content_factory("test/data/R.wav")[0];
40 auto C = content_factory("test/data/C.wav")[0];
41 auto Lfe = content_factory("test/data/Lfe.wav")[0];
42 auto Ls = content_factory("test/data/Ls.wav")[0];
43 auto Rs = content_factory("test/data/Rs.wav")[0];
44 auto VI = content_factory("test/data/sine_440.wav")[0];
46 auto film = new_test_film2("main_sound_configuration_test_51_vi", { picture, L, R, C, Lfe, Ls, Rs, VI });
47 film->set_audio_channels(8);
49 auto set_map = [](shared_ptr<Content> content, dcp::Channel channel) {
50 auto map = content->audio->mapping();
51 map.set(0, channel, 1.0f);
52 content->audio->set_mapping(map);
55 set_map(L, dcp::Channel::LEFT);
56 set_map(R, dcp::Channel::RIGHT);
57 set_map(C, dcp::Channel::CENTRE);
58 set_map(Lfe, dcp::Channel::LFE);
59 set_map(Ls, dcp::Channel::LS);
60 set_map(Rs, dcp::Channel::RS);
61 set_map(VI, dcp::Channel::VI);
63 make_and_verify_dcp(film);
65 dcp::DCP dcp(film->dir(film->dcp_name()));
67 BOOST_REQUIRE_EQUAL(dcp.cpls().size(), 1U);
68 auto cpl = dcp.cpls()[0];
70 auto msc = cpl->main_sound_configuration();
73 /* We think this should say 51 not 71 at the start (#2580) */
74 BOOST_CHECK_EQUAL(msc->to_string(), "51/L,R,C,LFE,Ls,Rs,-,VIN,-,-,-,-,-,-,-,-");
78 BOOST_AUTO_TEST_CASE(main_sound_configuration_test_71)
80 auto picture = content_factory("test/data/flat_red.png")[0];
81 auto L = content_factory("test/data/L.wav")[0];
82 auto R = content_factory("test/data/R.wav")[0];
83 auto C = content_factory("test/data/C.wav")[0];
84 auto Lfe = content_factory("test/data/Lfe.wav")[0];
85 auto Ls = content_factory("test/data/Ls.wav")[0];
86 auto Rs = content_factory("test/data/Rs.wav")[0];
87 auto BsL = content_factory("test/data/Ls.wav")[0];
88 auto BsR = content_factory("test/data/Rs.wav")[0];
89 auto VI = content_factory("test/data/sine_440.wav")[0];
91 auto film = new_test_film2("main_sound_configuration_test_51_vi", { picture, L, R, C, Lfe, Ls, Rs, BsL, BsR, VI });
92 film->set_audio_channels(12);
94 auto set_map = [](shared_ptr<Content> content, dcp::Channel channel) {
95 auto map = content->audio->mapping();
96 map.set(0, channel, 1.0f);
97 content->audio->set_mapping(map);
100 set_map(L, dcp::Channel::LEFT);
101 set_map(R, dcp::Channel::RIGHT);
102 set_map(C, dcp::Channel::CENTRE);
103 set_map(Lfe, dcp::Channel::LFE);
104 set_map(Ls, dcp::Channel::LS);
105 set_map(Rs, dcp::Channel::RS);
106 set_map(BsL, dcp::Channel::BSL);
107 set_map(BsR, dcp::Channel::BSR);
108 set_map(VI, dcp::Channel::VI);
110 make_and_verify_dcp(film);
112 dcp::DCP dcp(film->dir(film->dcp_name()));
114 BOOST_REQUIRE_EQUAL(dcp.cpls().size(), 1U);
115 auto cpl = dcp.cpls()[0];
117 auto msc = cpl->main_sound_configuration();
120 BOOST_CHECK_EQUAL(msc->to_string(), "71/L,R,C,LFE,Lss,Rss,-,VIN,-,-,Lrs,Rrs,-,-,-,-");