#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"
class Return;
class Route;
class RouteGroup;
+class RTTaskList;
class SMFSource;
class Send;
class SceneChanger;
/** Ardour Session */
class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager
{
- private:
+private:
enum SubState {
PendingDeclickIn = 0x1, ///< pending de-click fade-in for start
PendingDeclickOut = 0x2, ///< pending de-click fade-out for stop
PendingLocate = 0x20,
};
- public:
+public:
enum RecordState {
Disabled = 0,
Enabled = 1,
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
void set_end_is_free (bool);
int location_name(std::string& result, std::string base = std::string(""));
- pframes_t get_block_size () const { return current_block_size; }
- samplecnt_t worst_output_latency () const { return _worst_output_latency; }
- samplecnt_t worst_input_latency () const { return _worst_input_latency; }
- samplecnt_t worst_track_latency () const { return _worst_track_latency; }
- samplecnt_t worst_track_out_latency () const { return _worst_track_out_latency; }
- samplecnt_t worst_playback_latency () const { return std::max (_worst_output_latency, _worst_track_latency); }
+ pframes_t get_block_size () const { return current_block_size; }
+ samplecnt_t worst_output_latency () const { return _worst_output_latency; }
+ samplecnt_t worst_input_latency () const { return _worst_input_latency; }
+ samplecnt_t worst_route_latency () const { return _worst_route_latency; }
samplecnt_t worst_latency_preroll () const;
struct SaveAs {
};
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)
* @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,
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);
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);
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; }
/* preroll */
samplecnt_t preroll_samples (samplepos_t) const;
- void request_preroll_record_punch (samplepos_t start, samplecnt_t preroll);
void request_preroll_record_trim (samplepos_t start, samplecnt_t preroll);
void request_count_in_record ();
- samplepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; }
- bool preroll_record_punch_enabled () const { return _preroll_record_punch_pos >= 0; }
-
samplecnt_t preroll_record_trim_len () const { return _preroll_record_trim_len; }
/* temporary hacks to allow selection to be pushed from GUI into backend.
void auto_connect_thread_wakeup ();
- protected:
+protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);
void set_sample_rate (samplecnt_t nframes);
void reconnect_existing_routes (bool withLock, bool reconnect_master = true, bool reconnect_inputs = true, bool reconnect_outputs = true);
#endif
- protected:
friend class Route;
void schedule_curve_reallocation ();
void update_latency_compensation (bool force = false);
- private:
+private:
int create (const std::string& mix_template, BusProfile*);
void destroy ();
samplecnt_t _remaining_latency_preroll;
// varispeed playback
+ double _engine_speed;
double _transport_speed;
double _default_transport_speed;
double _last_transport_speed;
CubicInterpolation interpolation;
bool auto_play_legal;
- samplepos_t _last_slave_transport_sample;
- samplecnt_t maximum_output_latency;
- samplepos_t _requested_return_sample;
+ samplepos_t _last_slave_transport_sample;
+ samplepos_t _requested_return_sample;
pframes_t current_block_size;
- samplecnt_t _worst_output_latency;
- samplecnt_t _worst_input_latency;
- samplecnt_t _worst_track_latency;
- samplecnt_t _worst_track_out_latency;
+ samplecnt_t _worst_output_latency;
+ samplecnt_t _worst_input_latency;
+ samplecnt_t _worst_route_latency;
+ uint32_t _send_latency_changes;
bool _have_captured;
bool _non_soloed_outs_muted;
bool _listening;
PBD::ScopedConnection ltc_status_connection;
void initialize_latencies ();
+ void update_latency (bool playback);
+ bool update_route_latency (bool reverse, bool apply_to_delayline);
+
void set_worst_io_latencies ();
- void set_worst_playback_latency ();
- void set_worst_capture_latency ();
- void set_worst_io_latencies_x (IOChange, void *) {
- set_worst_io_latencies ();
- }
- void post_capture_latency ();
- void post_playback_latency ();
+ void set_worst_output_latency ();
+ void set_worst_input_latency ();
- void update_latency_compensation_proxy (void* ignored);
+ void send_latency_compensation_change ();
+ void set_worst_io_latencies_x (IOChange, void *);
void ensure_buffers (ChanCount howmany = ChanCount::ZERO);
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&);
mutable Glib::Threads::Mutex source_lock;
- public:
+public:
typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap;
- private:
+private:
void reset_write_sources (bool mark_write_complete, bool force = false);
SourceMap sources;
-
- private:
int load_sources (const XMLNode& node);
XMLNode& get_sources_as_xml ();
void process_rtop (SessionEvent*);
- void update_latency (bool playback);
-
enum snapshot_t {
NormalSave,
SnapshotKeep,
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;
Evoral::Range<samplepos_t> _range_selection;
Evoral::Range<samplepos_t> _object_selection;
- void unset_preroll_record_punch ();
void unset_preroll_record_trim ();
- samplepos_t _preroll_record_punch_pos;
samplecnt_t _preroll_record_trim_len;
bool _count_in_once;
boost::shared_ptr<IO> _ltc_input;
boost::shared_ptr<IO> _ltc_output;
+ boost::shared_ptr<RTTaskList> _rt_tasklist;
+
/* Scene Changing */
SceneChanger* _scene_changer;