Add a noise generator (Lua DSP)
[ardour.git] / libs / ardour / ardour / session.h
index 788e5bc4e75128bffe410ffba486a9a33a4d1290..4ef5fe66359960e59a1e67e36e10966ef316425d 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "pbd/error.h"
 #include "pbd/event_loop.h"
+#include "pbd/file_archive.h"
 #include "pbd/rcu.h"
 #include "pbd/reallocpool.h"
 #include "pbd/statefuldestructible.h"
@@ -140,6 +141,7 @@ class Region;
 class Return;
 class Route;
 class RouteGroup;
+class RTTaskList;
 class SMFSource;
 class Send;
 class SceneChanger;
@@ -287,6 +289,8 @@ public:
                return routes.reader ();
        }
 
+       boost::shared_ptr<RTTaskList> rt_tasklist () { return _rt_tasklist; }
+
        CoreSelection& selection () { return *_selection; }
 
        /* because the set of Stripables consists of objects managed
@@ -508,6 +512,7 @@ public:
        };
 
        int save_as (SaveAs&);
+
        /** save session
         * @param snapshot_name name of the session (use an empty string for the current name)
         * @param pending save a 'recovery', not full state (default: false)
@@ -515,7 +520,12 @@ public:
         * @param template_only save a session template (default: false)
         * @return zero on success
         */
-       int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false, bool template_only = false);
+       int save_state (std::string snapshot_name,
+                       bool pending = false,
+                       bool switch_to_snapshot = false,
+                       bool template_only = false,
+                       bool for_archive = false,
+                       bool only_used_assets = false);
 
        enum ArchiveEncode {
                NO_ENCODE,
@@ -523,7 +533,11 @@ public:
                FLAC_24BIT
        };
 
-       int archive_session (const std::string&, const std::string&, ArchiveEncode compress_audio = FLAC_16BIT, bool only_used_sources = false, Progress* p = 0);
+       int archive_session (const std::string&, const std::string&,
+                            ArchiveEncode compress_audio = FLAC_16BIT,
+                            PBD::FileArchive::CompressionLevel compression_level = PBD::FileArchive::CompressGood,
+                            bool only_used_sources = false,
+                            Progress* p = 0);
 
        int restore_state (std::string snapshot_name);
        int save_template (const std::string& template_name, const std::string& description = "", bool replace_existing = false);
@@ -558,10 +572,7 @@ public:
        std::vector<std::string> possible_states() const;
        static std::vector<std::string> possible_states (std::string path);
 
-       XMLNode& get_state();
-       int      set_state(const XMLNode& node, int version); // not idempotent
-       XMLNode& get_template();
-       bool     export_track_state (boost::shared_ptr<RouteList> rl, const std::string& path);
+       bool export_track_state (boost::shared_ptr<RouteList> rl, const std::string& path);
 
        /// The instant xml file is written to the session directory
        void add_instant_xml (XMLNode&, bool write_to_config = true);
@@ -720,6 +731,12 @@ public:
        bool   synced_to_mtc () const { return config.get_external_sync() && Config->get_sync_source() == MTC && g_atomic_int_get (const_cast<gint*>(&_mtc_active)); }
        bool   synced_to_ltc () const { return config.get_external_sync() && Config->get_sync_source() == LTC && g_atomic_int_get (const_cast<gint*>(&_ltc_active)); }
 
+       double engine_speed() const { return _engine_speed; }
+       double actual_speed() const {
+               if (_transport_speed > 0) return _engine_speed;
+               if (_transport_speed < 0) return - _engine_speed;
+               return 0;
+       }
        double transport_speed() const { return _count_in_samples > 0 ? 0. : _transport_speed; }
        bool   transport_stopped() const { return _transport_speed == 0.0; }
        bool   transport_rolling() const { return _transport_speed != 0.0 && _count_in_samples == 0 && _remaining_latency_preroll == 0; }
@@ -1247,6 +1264,7 @@ private:
        samplecnt_t             _remaining_latency_preroll;
 
        // varispeed playback
+       double                  _engine_speed;
        double                  _transport_speed;
        double                  _default_transport_speed;
        double                  _last_transport_speed;
@@ -1411,6 +1429,7 @@ private:
        gint            _suspend_save; /* atomic */
        volatile bool   _save_queued;
        Glib::Threads::Mutex save_state_lock;
+       Glib::Threads::Mutex save_source_lock;
        Glib::Threads::Mutex peak_cleanup_lock;
 
        int        load_options (const XMLNode&);
@@ -1898,7 +1917,13 @@ private:
                SwitchToSnapshot
        };
 
-       XMLNode& state(bool, snapshot_t snapshot_type = NormalSave);
+       XMLNode& state (bool save_template,
+                       snapshot_t snapshot_type = NormalSave,
+                       bool only_used_assets = false);
+
+       XMLNode& get_state ();
+       int      set_state (const XMLNode& node, int version); // not idempotent
+       XMLNode& get_template ();
 
        /* click track */
        typedef std::list<Click*> Clicks;
@@ -2057,6 +2082,8 @@ private:
        boost::shared_ptr<IO>   _ltc_input;
        boost::shared_ptr<IO>   _ltc_output;
 
+       boost::shared_ptr<RTTaskList> _rt_tasklist;
+
        /* Scene Changing */
        SceneChanger* _scene_changer;