Some compilers don't like x = {} where x is a boost::optional<string>
[libdcp.git] / src / sound_asset_writer.h
index f1b1514d800830275b828b549ff5b244a16a5f2c..d2eba02474cc77ecf3887641fe8284fbd0a8f6d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 /** @file  src/sound_asset_writer.h
- *  @brief SoundAssetWriter class.
+ *  @brief SoundAssetWriter class
  */
 
+
 #include "asset_writer.h"
 #include "fsk.h"
 #include "types.h"
 #include "sound_frame.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
 #include <boost/filesystem.hpp>
 #include <boost/shared_array.hpp>
 
@@ -49,8 +51,10 @@ struct sync_test1;
 
 namespace dcp {
 
+
 class SoundAsset;
 
+
 /** @class SoundAssetWriter
  *  @brief A helper class for writing to SoundAssets.
  *
@@ -63,15 +67,20 @@ class SoundAsset;
 class SoundAssetWriter : public AssetWriter
 {
 public:
+       /** @param data Pointer an array of float pointers, one for each channel.
+        *  @param frames Number of frames i.e. number of floats that are given for each channel.
+        */
        void write (float const * const *, int);
+
        bool finalize ();
 
 private:
        friend class SoundAsset;
        friend struct ::sync_test1;
 
-       SoundAssetWriter (SoundAsset *, boost::filesystem::path, bool sync);
+       SoundAssetWriter (SoundAsset *, boost::filesystem::path, std::vector<Channel> active_channels, bool sync);
 
+       void start ();
        void write_current_frame ();
        std::vector<bool> create_sync_packets ();
 
@@ -80,16 +89,18 @@ private:
        */
 
        struct ASDCPState;
-       boost::shared_ptr<ASDCPState> _state;
+       std::shared_ptr<ASDCPState> _state;
 
-       SoundAsset* _asset;
-       int _frame_buffer_offset;
+       SoundAsset* _asset = nullptr;
+       int _frame_buffer_offset = 0;
 
        /** true to ignore any signal passed to write() on channel 14 and instead write a sync track */
-       bool _sync;
+       bool _sync = false;
        /** index of the sync packet (0-3) which starts the next edit unit */
-       int _sync_packet;
+       int _sync_packet = 0;
        FSK _fsk;
+
+       std::vector<Channel> _active_channels;
 };
 
 }