They were more confusing than they were worth.
When creating the object we specify the sampling rate (48kHz) and the number of channels (2).
*/
auto sound_asset = std::make_shared<dcp::SoundAsset>(dcp::Fraction(24, 1), 48000, 2, dcp::LanguageTag("en-GB"), dcp::Standard::SMPTE);
- auto sound_writer = sound_asset->start_write("DCP/sound.mxf");
+ auto sound_writer = sound_asset->start_write("DCP/sound.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
/* Write some sine waves */
std::array<float, 48000> left;
shared_ptr<SoundAssetWriter>
-SoundAsset::start_write(boost::filesystem::path file, bool atmos_sync, bool include_mca_subdescriptors)
+SoundAsset::start_write(
+ boost::filesystem::path file,
+ AtmosSync atmos_sync,
+ MCASubDescriptors include_mca_subdescriptors
+ )
{
- if (atmos_sync && _channels < 14) {
+ if (atmos_sync == AtmosSync::ENABLED && _channels < 14) {
throw MiscError ("Insufficient channels to write ATMOS sync (there must be at least 14)");
}
- return shared_ptr<SoundAssetWriter>(new SoundAssetWriter(this, file, atmos_sync, include_mca_subdescriptors));
+ return shared_ptr<SoundAssetWriter>(
+ new SoundAssetWriter(this, file, atmos_sync == AtmosSync::ENABLED, include_mca_subdescriptors == MCASubDescriptors::ENABLED)
+ );
}
explicit SoundAsset (boost::filesystem::path file);
SoundAsset (Fraction edit_rate, int sampling_rate, int channels, LanguageTag language, Standard standard);
- std::shared_ptr<SoundAssetWriter> start_write(boost::filesystem::path file, bool atmos_sync = false, bool include_mca_subdescriptors = true);
+ enum class AtmosSync {
+ ENABLED,
+ DISABLED
+ };
+
+ enum class MCASubDescriptors {
+ ENABLED,
+ DISABLED
+ };
+
+ std::shared_ptr<SoundAssetWriter> start_write(
+ boost::filesystem::path file,
+ AtmosSync atmos_sync,
+ MCASubDescriptors mca_subdescriptors
+ );
+
std::shared_ptr<SoundAssetReader> start_read () const;
bool equals (
auto ms = make_shared<dcp::SoundAsset>(dcp::Fraction(24, 1), 48000, 1, dcp::LanguageTag("en-GB"), dcp::Standard::SMPTE);
ms->set_metadata (mxf_meta);
- auto sound_writer = ms->start_write ("build/test/DCP/dcp_test2/audio.mxf");
+ auto sound_writer = ms->start_write("build/test/DCP/dcp_test2/audio.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
SF_INFO info;
info.format = 0;
auto reader = A_sound->asset()->start_read();
auto sound = make_shared<dcp::SoundAsset>(A_sound->asset()->edit_rate(), A_sound->asset()->sampling_rate(), A_sound->asset()->channels(), dcp::LanguageTag("en-US"), dcp::Standard::SMPTE);
- auto writer = sound->start_write(path("build") / "test" / name / "pcm_8246f87f-e1df-4c42-a290-f3b3069ff021.mxf", {});
+ auto writer = sound->start_write(path("build") / "test" / name / "pcm_8246f87f-e1df-4c42-a290-f3b3069ff021.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
bool need_to_modify = modify;
for (int i = 0; i < A_sound->asset()->intrinsic_duration(); ++i) {
auto ms = make_shared<dcp::SoundAsset>(dcp::Fraction(24, 1), 48000, 1, dcp::LanguageTag("en-GB"), dcp::Standard::SMPTE);
ms->set_metadata (mxf_meta);
- auto sound_writer = ms->start_write ("build/test/DCP/dcp_test5/audio.mxf");
+ auto sound_writer = ms->start_write("build/test/DCP/dcp_test5/audio.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
SF_INFO info;
info.format = 0;
auto sound_asset = std::make_shared<dcp::SoundAsset>(dcp::Fraction(24, 1), 48000, 2, dcp::LanguageTag("en-GB"), dcp::Standard::SMPTE);
sound_asset->set_key (key);
sound_asset->set_context_id (context_id);
- auto sound_writer = sound_asset->start_write(dir / "sound.mxf");
+ auto sound_writer = sound_asset->start_write(dir / "sound.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
std::array<float, 48000> left;
std::array<float, 48000> right;
for (int i = 0; i < 48000; ++i) {
auto ms = make_shared<dcp::SoundAsset>(dcp::Fraction (24, 1), 48000, 1, dcp::LanguageTag("en-GB"), dcp::Standard::SMPTE);
ms->set_metadata (mxf_metadata);
ms->set_key (key);
- auto sound_writer = ms->start_write ("build/test/DCP/encryption_test/audio.mxf");
+ auto sound_writer = ms->start_write("build/test/DCP/encryption_test/audio.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
SF_INFO info;
info.format = 0;
BOOST_AUTO_TEST_CASE (write_mca_descriptors_to_mxf_test)
{
auto sound_asset = make_shared<dcp::SoundAsset>(dcp::Fraction(24, 1), 48000, 6, dcp::LanguageTag("en-US"), dcp::Standard::SMPTE);
- auto writer = sound_asset->start_write("build/test/write_mca_descriptors_to_mxf_test.mxf");
+ auto writer = sound_asset->start_write("build/test/write_mca_descriptors_to_mxf_test.mxf", {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
float* samples[6];
for (int i = 0; i < 6; ++i) {
no_padding_test(boost::filesystem::path path, std::function<void (shared_ptr<dcp::SoundAssetWriter>, boost::random::mt19937&, boost::random::uniform_int_distribution<>&)> write)
{
dcp::SoundAsset asset({24, 1}, 48000, 6, dcp::LanguageTag{"en-GB"}, dcp::Standard::SMPTE);
- auto writer = asset.start_write(path);
+ auto writer = asset.start_write(path, {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
boost::random::mt19937 rng(1);
boost::random::uniform_int_distribution<> dist(0, 32767);
padding_test(boost::filesystem::path path, std::function<void (shared_ptr<dcp::SoundAssetWriter>, boost::random::mt19937&, boost::random::uniform_int_distribution<>&)> write)
{
dcp::SoundAsset asset({24, 1}, 48000, 14, dcp::LanguageTag{"en-GB"}, dcp::Standard::SMPTE);
- auto writer = asset.start_write(path);
+ auto writer = asset.start_write(path, {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
boost::random::mt19937 rng(1);
boost::random::uniform_int_distribution<> dist(0, 32767);
}
}
- shared_ptr<dcp::SoundAssetWriter> writer = asset.start_write ("build/test/foo.mxf", true);
+ auto writer = asset.start_write("build/test/foo.mxf", {}, dcp::SoundAsset::AtmosSync::ENABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
/* Compare the sync bits made by SoundAssetWriter to the "proper" ones in the MXF */
BOOST_CHECK (ref == writer->create_sync_packets());
asset._id = "e004046e09234f90a4ae4355e7e83506";
boost::system::error_code ec;
boost::filesystem::remove ("build/test/foo.mxf", ec);
- auto writer = asset.start_write ("build/test/foo.mxf", true);
+ auto writer = asset.start_write("build/test/foo.mxf", {}, dcp::SoundAsset::AtmosSync::ENABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
int const frames = 2000;
float** junk = new float*[channels];
}
ms->_language = language;
ms->set_metadata (mxf_meta);
- shared_ptr<dcp::SoundAssetWriter> sound_writer = ms->start_write (path / dcp::String::compose("audio%1.mxf", suffix));
+ auto sound_writer = ms->start_write(path / dcp::String::compose("audio%1.mxf", suffix), {}, dcp::SoundAsset::AtmosSync::DISABLED, dcp::SoundAsset::MCASubDescriptors::ENABLED);
int const samples_per_frame = sample_rate / 24;