diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-03-17 13:33:08 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-03-20 16:41:02 +0100 |
| commit | 870f02f07ee51ee478006260e2c3b683e591b0c9 (patch) | |
| tree | 0df3a83d06c3c627b3b16664ff45a574d630d747 /src | |
| parent | 90a4d88bf00dc4d038621227f6878c013b289a88 (diff) | |
Remove the bools and default parameters from SoundAsset::start_write().
They were more confusing than they were worth.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sound_asset.cc | 12 | ||||
| -rw-r--r-- | src/sound_asset.h | 17 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/sound_asset.cc b/src/sound_asset.cc index 8002f37a..56d13951 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -221,13 +221,19 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand 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) + ); } diff --git a/src/sound_asset.h b/src/sound_asset.h index e9a2736d..e51f1854 100644 --- a/src/sound_asset.h +++ b/src/sound_asset.h @@ -75,7 +75,22 @@ public: 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 ( |
