#ifndef __ardour_session_h__
#define __ardour_session_h__
+#include "libardour-config.h"
+
#include <list>
#include <map>
#include <set>
-#include <stack>
#include <string>
#include <vector>
#include <stdint.h>
static PBD::Signal1<void,std::string> Dialog;
- std::string sound_dir (bool with_path = true) const;
- std::string peak_dir () const;
- std::string dead_sound_dir () const;
+ int ensure_subdirs ();
+
std::string automation_dir () const;
std::string analysis_dir() const;
std::string plugins_dir() const;
-
- int ensure_subdirs ();
std::string peak_path (std::string) const;
std::string peak_path_from_audio_path (std::string) const;
std::string new_audio_source_name (const std::string&, uint32_t nchans, uint32_t chan, bool destructive);
std::string new_midi_source_name (const std::string&);
- std::string new_source_path_from_name (DataType type, const std::string&, bool as_stub = false);
+ std::string new_source_path_from_name (DataType type, const std::string&);
RouteList new_route_from_template (uint32_t how_many, const std::string& template_path);
void process (pframes_t nframes);
void refresh_disk_space ();
int load_diskstreams_2X (XMLNode const &, int);
-
+
int load_routes (const XMLNode&, int);
boost::shared_ptr<RouteList> get_routes() const {
return routes.reader ();
return (RecordState) g_atomic_int_get (&_record_status);
}
- bool actively_recording () {
+ bool actively_recording () const {
return record_status() == Recording;
}
/* Transport mechanism signals */
- PBD::Signal0<void> TransportStateChange; /* generic */
+ /** Emitted on the following changes in transport state:
+ * - stop (from the butler thread)
+ * - change in whether or not we are looping (from the process thread)
+ * - change in the play range (from the process thread)
+ * - start (from the process thread)
+ * - engine halted
+ */
+ PBD::Signal0<void> TransportStateChange;
+
PBD::Signal1<void,framepos_t> PositionChanged; /* sent after any non-sequential motion */
PBD::Signal1<void,framepos_t> Xrun;
PBD::Signal0<void> TransportLooped;
void use_rf_shuttle_speed ();
void allow_auto_play (bool yn);
void request_transport_speed (double speed);
+ void request_transport_speed_nonzero (double);
void request_overwrite_buffer (Track *);
void adjust_playback_buffering();
void adjust_capture_buffering();
int wipe ();
- std::pair<framepos_t, framepos_t> get_extent () const;
framepos_t current_end_frame () const;
framepos_t current_start_frame () const;
/** "actual" sample rate of session, set by current audioengine rate, pullup/down etc. */
framecnt_t worst_output_latency () const { return _worst_output_latency; }
framecnt_t worst_input_latency () const { return _worst_input_latency; }
framecnt_t worst_track_latency () const { return _worst_track_latency; }
+ framecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; }
-#ifdef HAVE_JACK_SESSION
+#ifdef HAVE_JACK_SESSION
void jack_session_event (jack_session_event_t* event);
#endif
int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false);
void add_route_group (RouteGroup *);
void remove_route_group (RouteGroup&);
+ void reorder_route_groups (std::list<RouteGroup*>);
RouteGroup* route_group_by_name (std::string);
RouteGroup& all_route_group() const;
PBD::Signal1<void,RouteGroup*> route_group_added;
PBD::Signal0<void> route_group_removed;
+ PBD::Signal0<void> route_groups_reordered;
void foreach_route_group (boost::function<void(RouteGroup*)> f) {
for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
}
}
+ std::list<RouteGroup*> const & route_groups () const {
+ return _route_groups;
+ }
+
/* fundamental operations. duh. */
std::list<boost::shared_ptr<AudioTrack> > new_audio_track (
- int input_channels, int output_channels, TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1
+ int input_channels,
+ int output_channels,
+ TrackMode mode = Normal,
+ RouteGroup* route_group = 0,
+ uint32_t how_many = 1,
+ std::string name_template = ""
);
- RouteList new_audio_route (bool aux, int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many);
+ RouteList new_audio_route (
+ int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many, std::string name_template = ""
+ );
std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
- TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1
+ TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1, std::string name_template = ""
);
void remove_route (boost::shared_ptr<Route>);
void timecode_duration_string (char *, framecnt_t) const;
framecnt_t convert_to_frames (AnyTime const & position);
- framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration);
+ framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration);
static PBD::Signal1<void, framepos_t> StartTimeChanged;
static PBD::Signal1<void, framepos_t> EndTimeChanged;
void add_source (boost::shared_ptr<Source>);
void remove_source (boost::weak_ptr<Source>);
+ void cleanup_regions();
int cleanup_sources (CleanupReport&);
int cleanup_trash_sources (CleanupReport&);
static PBD::Signal0<int> AskAboutPendingState;
boost::shared_ptr<AudioFileSource> create_audio_source_for_session (
- size_t, std::string const &, uint32_t, bool destructive, bool as_stub = false);
-
+ size_t, std::string const &, uint32_t, bool destructive);
+
boost::shared_ptr<MidiSource> create_midi_source_for_session (
- Track*, std::string const &, bool as_stub = false);
+ Track*, std::string const &);
boost::shared_ptr<Source> source_by_id (const PBD::ID&);
boost::shared_ptr<Source> source_by_path_and_channel (const std::string&, uint16_t);
/* Curves and AutomationLists (TODO when they go away) */
void add_automation_list(AutomationList*);
- /* fade curves */
-
- float get_default_fade_length () const { return default_fade_msecs; }
- float get_default_fade_steepness () const { return default_fade_steepness; }
- void set_default_fade (float steepness, float msecs);
-
/* auditioning */
boost::shared_ptr<Auditioner> the_auditioner() { return auditioner; }
PBD::Signal1<void,bool> SoloActive;
PBD::Signal0<void> SoloChanged;
PBD::Signal0<void> IsolatedChanged;
-
+
/* control/master out */
boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
std::string next_redo() const { return _history.next_redo(); }
void begin_reversible_command (const std::string& cmd_name);
+ void begin_reversible_command (GQuark);
void commit_reversible_command (Command* cmd = 0);
- UndoTransaction* start_reversible_command (const std::string& cmd_name);
- void finish_reversible_command (UndoTransaction&);
-
void add_command (Command *const cmd) {
- assert(!_current_trans.empty ());
- _current_trans.top()->add_command (cmd);
+ assert (_current_trans);
+ _current_trans->add_command (cmd);
+ }
+
+ /** @return The list of operations that are currently in progress */
+ std::list<GQuark> const & current_operations () {
+ return _current_trans_quarks;
}
void add_commands (std::vector<Command*> const & cmds);
/* Speakers */
- Speakers& get_speakers ();
+ boost::shared_ptr<Speakers> get_speakers ();
/* Controllables */
void add_controllable (boost::shared_ptr<PBD::Controllable>);
void remove_controllable (PBD::Controllable*);
+ boost::shared_ptr<PBD::Controllable> solo_cut_control() const;
+
SessionMetadata & metadata () { return *_metadata; }
SessionConfiguration config;
Waiting,
Running
};
-
+
SlaveState slave_state() const { return _slave_state; }
boost::shared_ptr<SessionPlaylists> playlists;
protected:
friend class Route;
void schedule_curve_reallocation ();
- void update_latency_compensation (bool, bool);
+ void update_latency_compensation (bool force = false);
private:
int create (const std::string& mix_template, BusProfile*);
Location* _session_range_location; ///< session range, or 0 if there is nothing in the session yet
Slave* _slave;
bool _silent;
-
+
+ void maybe_update_session_range (framepos_t, framepos_t);
+
// varispeed playback
double _transport_speed;
double _last_transport_speed;
bool _was_seamless;
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 update_latency_compensation_proxy (void* ignored);
std::string _path;
std::string _name;
bool _is_new;
- bool session_send_mtc;
+ bool _send_qf_mtc;
+ /** Number of process frames since the last MTC output (when sending MTC); used to
+ * know when to send full MTC messages every so often.
+ */
+ pframes_t _pframes_since_last_mtc;
bool session_midi_feedback;
bool play_loop;
bool loop_changing;
void when_engine_running ();
void graph_reordered ();
+ /** current snapshot name, without the .ardour suffix */
std::string _current_snapshot_name;
XMLTree* state_tree;
void first_stage_init (std::string path, std::string snapshot_name);
int second_stage_init ();
- void update_session_range_location_marker ();
void remove_empty_sounds ();
void setup_midi_control ();
bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle
- int send_midi_time_code_for_cycle (pframes_t nframes);
+ int send_midi_time_code_for_cycle (framepos_t, framepos_t, pframes_t nframes);
void reset_record_status ();
void stop_transport (bool abort = false, bool clear_state = false);
void start_transport ();
void realtime_stop (bool abort, bool clear_state);
+ void realtime_locate ();
void non_realtime_start_scrub ();
void non_realtime_set_speed ();
void non_realtime_locate ();
SerializedRCUManager<RouteList> routes;
- void add_routes (RouteList&, bool save);
+ void add_routes (RouteList&, bool auto_connect, bool save);
uint32_t destructive_index;
boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
void route_processors_changed (RouteProcessorChange);
- bool find_route_name (const char* base, uint32_t& id, char* name, size_t name_len);
- void count_existing_route_channels (ChanCount& in, ChanCount& out);
- void auto_connect_route (
- Route* route,
- ChanCount& existing_inputs,
- ChanCount& existing_outputs,
- bool connect_inputs = true,
- ChanCount input_start = ChanCount (),
- ChanCount output_start = ChanCount ()
- );
+ bool find_route_name (std::string const &, uint32_t& id, char* name, size_t name_len, bool);
+ void count_existing_track_channels (ChanCount& in, ChanCount& out);
+ void auto_connect_route (boost::shared_ptr<Route> route, ChanCount& existing_inputs, ChanCount& existing_outputs,
+ bool with_lock, bool connect_inputs = true,
+ ChanCount input_start = ChanCount (), ChanCount output_start = ChanCount ());
+ void midi_output_change_handler (IOChange change, void* /*src*/, boost::weak_ptr<Route> midi_track);
/* mixer stuff */
mutable Glib::Mutex region_lock;
int load_regions (const XMLNode& node);
+ int load_compounds (const XMLNode& node);
void route_group_changed ();
mutable Glib::Mutex source_lock;
- public:
+ public:
typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap;
- private:
+ private:
SourceMap sources;
public:
void remove_playlist (boost::weak_ptr<Playlist>);
void track_playlist_changed (boost::weak_ptr<Track>);
+ void playlist_region_added (boost::weak_ptr<Region>);
+ void playlist_ranges_moved (std::list<Evoral::RangeMove<framepos_t> > const &);
+ void playlist_regions_extended (std::list<Evoral::Range<framepos_t> > const &);
/* NAMED SELECTIONS */
void reverse_track_buffers ();
- UndoHistory _history;
- std::stack<UndoTransaction*> _current_trans;
+ UndoHistory _history;
+ /** current undo transaction, or 0 */
+ UndoTransaction* _current_trans;
+ /** GQuarks to describe the reversible commands that are currently in progress.
+ * These may be nested, in which case more recently-started commands are toward
+ * the front of the list.
+ */
+ std::list<GQuark> _current_trans_quarks;
void jack_timebase_callback (jack_transport_state_t, pframes_t, jack_position_t*, int);
int jack_sync_callback (jack_transport_state_t, jack_position_t*);
void reset_jack_connection (jack_client_t* jack);
void process_rtop (SessionEvent*);
+ void update_latency (bool playback);
+
XMLNode& state(bool);
/* click track */
Click *get_click();
void setup_click_sounds (int which);
+ void setup_click_sounds (Sample**, Sample const *, framecnt_t*, framecnt_t, std::string const &);
void clear_clicks ();
void click (framepos_t start, framecnt_t nframes);
Glib::Mutex controllables_lock;
Controllables controllables;
+ boost::shared_ptr<PBD::Controllable> _solo_cut_control;
+
void reset_native_file_format();
bool first_file_data_format_reset;
bool first_file_header_format_reset;
/* realtime "apply to set of routes" operations */
SessionEvent* get_rt_event (
boost::shared_ptr<RouteList> rl, bool yn,
- SessionEvent::RTeventCallback after, bool group_override,
+ SessionEvent::RTeventCallback after, bool group_override,
void (Session::*method) (boost::shared_ptr<RouteList>, bool, bool));
void rt_set_solo (boost::shared_ptr<RouteList>, bool yn, bool group_override);
void add_session_range_location (framepos_t, framepos_t);
void setup_midi_machine_control ();
- void cleanup_stubfiles ();
void route_order_key_changed ();
void start_time_changed (framepos_t);
void end_time_changed (framepos_t);
- Speakers* _speakers;
+ void set_track_monitor_input_status (bool);
+ framepos_t compute_stop_limit () const;
+
+ boost::shared_ptr<Speakers> _speakers;
+ void load_nested_sources (const XMLNode& node);
};
} // namespace ARDOUR