Allow creation of ATMOS sync on channel 14.
[libdcp.git] / src / sound_asset.cc
index c28a33feb07d2a58d5ce12a3e4203b27ee7e5e01..7f2bf5e3c45c29e08d0a4bdb4771b66df76dcccc 100644 (file)
@@ -193,10 +193,13 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand
 }
 
 shared_ptr<SoundAssetWriter>
-SoundAsset::start_write (boost::filesystem::path file)
+SoundAsset::start_write (boost::filesystem::path file, bool atmos_sync)
 {
-       /* XXX: can't we use a shared_ptr here? */
-       return shared_ptr<SoundAssetWriter> (new SoundAssetWriter (this, file));
+       if (atmos_sync && _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));
 }
 
 shared_ptr<SoundAssetReader>