#include "pbd/signals.h"
#include "pbd/undo.h"
-#include "midi++/mmc.h"
#include "midi++/types.h"
#include "ardour/ardour.h"
namespace MIDI {
class Port;
+ class MachineControl;
+ class Parser;
}
namespace PBD {
namespace ARDOUR {
-class AudioDiskstream;
class AudioEngine;
class AudioFileSource;
class AudioRegion;
class BufferSet;
class Bundle;
class Butler;
-class ControlProtocolInfo;
class Diskstream;
class ExportHandler;
class ExportStatus;
class IO;
class IOProcessor;
class ImportStatus;
-class MidiDiskstream;
class MidiRegion;
class MidiSource;
class MidiTrack;
class Source;
class TempoMap;
class VSTPlugin;
+class Graph;
+class Track;
extern void setup_enum_writer ();
Glib::ustring peak_path (Glib::ustring) const;
- static std::string change_source_path_by_name (std::string oldpath, std::string oldname, std::string newname, bool destructive);
+ std::string change_source_path_by_name (std::string oldpath, std::string oldname, std::string newname, bool destructive);
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&);
+ std::string new_source_path_from_name (DataType type, const std::string&, bool as_stub = false);
RouteList new_route_from_template (uint32_t how_many, const std::string& template_path);
void process (nframes_t nframes);
BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO);
BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
- void add_diskstream (boost::shared_ptr<Diskstream>);
- boost::shared_ptr<Diskstream> diskstream_by_id (const PBD::ID& id);
- boost::shared_ptr<Diskstream> diskstream_by_name (std::string name);
- bool have_rec_enabled_diskstream () const;
+ bool have_rec_enabled_track () const;
bool have_captured() const { return _have_captured; }
- void refill_all_diskstream_buffers ();
+ void refill_all_track_buffers ();
Butler* butler() { return _butler; }
void butler_transport_work ();
- uint32_t get_next_diskstream_id() const { return n_diskstreams(); }
- uint32_t n_diskstreams() const;
-
void refresh_disk_space ();
- typedef std::list<boost::shared_ptr<Diskstream> > DiskstreamList;
-
- SerializedRCUManager<DiskstreamList>& diskstream_list() { return diskstreams; }
-
+ int load_diskstreams_2X (XMLNode const &, int);
+
int load_routes (const XMLNode&, int);
boost::shared_ptr<RouteList> get_routes() const {
return routes.reader ();
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
template<class T, class A> void foreach_route (T *obj, void (T::*func)(Route&, A), A arg);
+ bool io_name_is_legal (const std::string&);
boost::shared_ptr<Route> route_by_name (std::string);
boost::shared_ptr<Route> route_by_id (PBD::ID);
boost::shared_ptr<Route> route_by_remote_id (uint32_t id);
PBD::Signal0<void> TransportStateChange; /* generic */
PBD::Signal1<void,nframes64_t> PositionChanged; /* sent after any non-sequential motion */
- PBD::Signal0<void> DurationChanged;
PBD::Signal1<void,nframes64_t> Xrun;
PBD::Signal0<void> TransportLooped;
PBD::Signal0<void> Located;
PBD::Signal1<void,RouteList&> RouteAdded;
+ /** Emitted when anything about any of our route groups changes */
PBD::Signal0<void> RouteGroupChanged;
+ /* Step Editing status changed */
+ PBD::Signal1<void,bool> StepEditStatusChange;
+
void queue_event (SessionEvent*);
void request_roll_at_and_return (nframes_t start, nframes_t return_to);
bool get_play_loop () const { return play_loop; }
nframes_t last_transport_start() const { return _last_roll_location; }
- void goto_end () { request_locate (_session_range_location->end(), false);}
- void goto_start () { request_locate (_session_range_location->start(), false); }
- void set_session_start (nframes_t start) { _session_range_location->set_start(start); }
- void set_session_end (nframes_t end) { _session_range_location->set_end(end); config.set_end_marker_is_free (false); }
+ void goto_end ();
+ void goto_start ();
void use_rf_shuttle_speed ();
void allow_auto_play (bool yn);
void request_transport_speed (double speed);
- void request_overwrite_buffer (Diskstream*);
- void request_diskstream_speed (Diskstream&, double speed);
+ void request_overwrite_buffer (Track *);
+ void adjust_playback_buffering();
+ void adjust_capture_buffering();
+ void request_track_speed (Track *, double speed);
void request_input_change_handling ();
bool locate_pending() const { return static_cast<bool>(post_transport_work()&PostTransportLocate); }
int wipe ();
- nframes_t get_maximum_extent () const;
- nframes_t current_end_frame() const { return _session_range_location->end(); }
- nframes_t current_start_frame() const { return _session_range_location->start(); }
+ std::pair<nframes_t, nframes_t> get_extent () const;
+ nframes_t current_end_frame () const;
+ nframes_t current_start_frame () const;
/// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
nframes_t frame_rate() const { return _current_frame_rate; }
/// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
/* Locations */
- Locations *locations() { return &_locations; }
+ Locations *locations() { return _locations; }
PBD::Signal1<void,Location*> auto_loop_location_changed;
PBD::Signal1<void,Location*> auto_punch_location_changed;
#ifdef HAVE_JACK_SESSION
void jack_session_event (jack_session_event_t* event);
#endif
- int save_state (std::string snapshot_name, bool pending = false);
+ int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false);
int restore_state (std::string snapshot_name);
int save_template (std::string template_name);
int save_history (std::string snapshot_name = "");
AudioEngine & engine() { return _engine; }
AudioEngine const & engine () const { return _engine; }
- int32_t max_level;
- int32_t min_level;
-
/* Time */
nframes64_t transport_frame () const {return _transport_frame; }
int cleanup_sources (CleanupReport&);
int cleanup_trash_sources (CleanupReport&);
- int destroy_region (boost::shared_ptr<Region>);
- int destroy_regions (std::list<boost::shared_ptr<Region> >);
+ int destroy_sources (std::list<boost::shared_ptr<Source> >);
int remove_last_capture ();
*/
static PBD::Signal0<int> AskAboutPendingState;
- boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
-
- boost::shared_ptr<MidiSource> create_midi_source_for_session (ARDOUR::MidiDiskstream&);
+ boost::shared_ptr<AudioFileSource> create_audio_source_for_session (size_t, std::string const &, uint32_t,
+ bool destructive, bool as_stub = false);
+
+ boost::shared_ptr<MidiSource> create_midi_source_for_session (Track*, std::string const &, bool as_stub = false);
boost::shared_ptr<Source> source_by_id (const PBD::ID&);
boost::shared_ptr<Source> source_by_path_and_channel (const Glib::ustring&, uint16_t);
/* flattening stuff */
- boost::shared_ptr<Region> write_one_track (AudioTrack&, nframes_t start, nframes_t end,
+ boost::shared_ptr<Region> write_one_track (AudioTrack&, framepos_t start, framepos_t end,
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
bool enable_processing = true);
int freeze_all (InterThreadInfo&);
bool soloing() const { return _non_soloed_outs_muted; }
bool listening() const { return _listen_cnt > 0; }
+ bool solo_isolated() const { return _solo_isolated_cnt > 0; }
static const SessionEvent::RTeventCallback rt_cleanup;
void set_just_one_solo (boost::shared_ptr<Route>, bool, SessionEvent::RTeventCallback after = rt_cleanup);
void set_mute (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
- void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+ void set_record_enabled (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+ void set_solo_isolated (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
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; }
PBD::Signal1<void,boost::shared_ptr<Bundle> > BundleAdded;
PBD::Signal1<void,boost::shared_ptr<Bundle> > BundleRemoved;
- /* MIDI control */
-
- void midi_panic(void);
- int set_mtc_port (std::string port_tag);
- int set_mmc_port (std::string port_tag);
- int set_midi_port (std::string port_tag);
- int set_midi_clock_port (std::string port_tag);
- MIDI::Port *mtc_port() const { return _mtc_port; }
- MIDI::Port *mmc_port() const { return _mmc_port; }
- MIDI::Port *midi_port() const { return _midi_port; }
- MIDI::Port *midi_clock_port() const { return _midi_clock_port; }
-
- PBD::Signal0<void> MTC_PortChanged;
- PBD::Signal0<void> MMC_PortChanged;
- PBD::Signal0<void> MIDI_PortChanged;
- PBD::Signal0<void> MIDIClock_PortChanged;
-
- void set_trace_midi_input (bool, MIDI::Port* port = 0);
- void set_trace_midi_output (bool, MIDI::Port* port = 0);
-
- bool get_trace_midi_input(MIDI::Port *port = 0);
- bool get_trace_midi_output(MIDI::Port *port = 0);
-
- void set_mmc_receive_device_id (uint32_t id);
- void set_mmc_send_device_id (uint32_t id);
+ void midi_panic ();
/* Scrubbing */
uint32_t playback_load ();
uint32_t capture_load ();
- uint32_t playback_load_min ();
- uint32_t capture_load_min ();
-
- void reset_playback_load_min ();
- void reset_capture_load_min ();
/* ranges */
PostTransportReverse = 0x10000,
PostTransportInputChange = 0x20000,
PostTransportCurveRealloc = 0x40000,
- PostTransportClearSubstate = 0x80000
+ PostTransportClearSubstate = 0x80000,
+ PostTransportAdjustPlaybackBuffering = 0x100000,
+ PostTransportAdjustCaptureBuffering = 0x200000
};
enum SlaveState {
boost::shared_ptr<SessionPlaylists> playlists;
+ void send_mmc_locate (nframes64_t);
+ int send_full_time_code (nframes64_t);
+
+ PBD::Signal0<void> RouteOrderKeyChanged;
+
+ bool step_editing() const { return (_step_editors > 0); }
+
+ void request_suspend_timecode_transmission ();
+ void request_resume_timecode_transmission ();
+ bool timecode_transmission_suspended () const;
+
protected:
friend class AudioEngine;
void set_block_size (nframes_t nframes);
void update_latency_compensation (bool, bool);
private:
- int create (const std::string& mix_template, nframes_t initial_length, BusProfile*);
+ int create (const std::string& mix_template, BusProfile*);
void destroy ();
- nframes_t compute_initial_length ();
-
enum SubState {
PendingDeclickIn = 0x1,
PendingDeclickOut = 0x2,
StopPendingCapture = 0x4,
- AutoReturning = 0x10,
PendingLocate = 0x20,
- PendingSetLoop = 0x40
};
/* stuff used in process() should be close together to
int transport_sub_state;
mutable gint _record_status;
volatile nframes64_t _transport_frame;
- Location* _session_range_location;
+ Location* _session_range_location; ///< session range, or 0 if there is nothing in the session yet
Slave* _slave;
bool _silent;
float _meter_falloff;
bool _non_soloed_outs_muted;
uint32_t _listen_cnt;
+ uint32_t _solo_isolated_cnt;
bool _writable;
bool _was_seamless;
static const int delta_accumulator_size = 25;
int delta_accumulator_cnt;
- long delta_accumulator[delta_accumulator_size];
- long average_slave_delta;
+ int32_t delta_accumulator[delta_accumulator_size];
+ int32_t average_slave_delta;
int average_dir;
bool have_first_delta_accumulator;
PBD::ScopedConnection export_freewheel_connection;
- void get_diskstream_statistics ();
+ void get_track_statistics ();
int process_routes (nframes_t, bool& need_butler);
int silent_process_routes (nframes_t, bool& need_butler);
void check_declick_out ();
- MIDI::MachineControl* mmc;
- MIDI::Port* _mmc_port;
- MIDI::Port* _mtc_port;
- MIDI::Port* _midi_port;
- MIDI::Port* _midi_clock_port;
std::string _path;
std::string _name;
bool _is_new;
- bool session_send_mmc;
bool session_send_mtc;
bool session_midi_feedback;
bool play_loop;
int load_state (std::string snapshot_name);
nframes_t _last_roll_location;
+ nframes_t _last_roll_or_reversal_location;
nframes_t _last_record_location;
bool pending_locate_roll;
void set_post_transport_work (PostTransportWork ptw) { g_atomic_int_set (&_post_transport_work, (gint) ptw); }
void add_post_transport_work (PostTransportWork ptw);
+ void schedule_playback_buffering_adjustment ();
+ void schedule_capture_buffering_adjustment ();
+
uint32_t cumulative_rf_motion;
uint32_t rf_scale;
void set_rf_speed (float speed);
void reset_rf_scale (nframes_t frames_moved);
- Locations _locations;
+ Locations* _locations;
void locations_changed ();
void locations_added (Location*);
void handle_locations_changed (Locations::LocationList&);
void first_stage_init (std::string path, std::string snapshot_name);
int second_stage_init ();
- void find_current_end ();
+ void update_session_range_location_marker ();
void remove_empty_sounds ();
void setup_midi_control ();
/* MIDI Machine Control */
- void deliver_mmc (MIDI::MachineControl::Command, nframes_t);
-
void spp_start (MIDI::Parser&, nframes_t timestamp);
void spp_continue (MIDI::Parser&, nframes_t timestamp);
void spp_stop (MIDI::Parser&, nframes_t timestamp);
MidiTimeoutList midi_timeouts;
bool mmc_step_timeout ();
- MIDI::byte mmc_buffer[32];
MIDI::byte mtc_msg[16];
MIDI::byte mtc_timecode_bits; /* encoding of SMTPE type for MTC */
MIDI::byte midi_msg[16];
bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle
- int send_full_time_code(nframes_t nframes);
int send_midi_time_code_for_cycle(nframes_t nframes);
nframes_t adjust_apparent_position (nframes_t frames);
int start_midi_thread ();
void terminate_midi_thread ();
- int use_config_midi_ports ();
-
void set_play_loop (bool yn);
void unset_play_loop ();
- void overwrite_some_buffers (Diskstream*);
+ void overwrite_some_buffers (Track *);
void flush_all_inserts ();
int micro_locate (nframes_t distance);
- void locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false);
+ void locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true);
void start_locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false);
void force_locate (nframes64_t frame, bool with_roll = false);
- void set_diskstream_speed (Diskstream*, double speed);
+ void set_track_speed (Track *, double speed);
void set_transport_speed (double speed, bool abort = false, bool clear_state = false);
void stop_transport (bool abort = false, bool clear_state = false);
void start_transport ();
std::list<RouteGroup *> _route_groups;
- /* disk-streams */
-
- SerializedRCUManager<DiskstreamList> diskstreams;
-
- int load_diskstreams (const XMLNode&);
-
/* routes stuff */
+ boost::shared_ptr<Graph> route_graph;
+
SerializedRCUManager<RouteList> routes;
void add_routes (RouteList&, bool save);
uint32_t destructive_index;
boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
+ boost::shared_ptr<Route> XMLRouteFactory_2X (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 (boost::shared_ptr<Route> route,
- ChanCount& existing_inputs, ChanCount& existing_outputs);
+ void auto_connect_route (boost::shared_ptr<Route> route, ChanCount& existing_inputs, ChanCount& existing_outputs, bool connect_inputs = true);
/* mixer stuff */
void route_listen_changed (void *src, boost::weak_ptr<Route>);
void route_mute_changed (void *src);
- void route_solo_changed (void *src, boost::weak_ptr<Route>);
+ void route_solo_changed (bool self_solo_change, void *src, boost::weak_ptr<Route>);
+ void route_solo_isolated_changed (void *src, boost::weak_ptr<Route>);
void update_route_solo_state (boost::shared_ptr<RouteList> r = boost::shared_ptr<RouteList>());
void listen_position_changed ();
/* SOURCES */
mutable Glib::Mutex source_lock;
+
+ public:
typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap;
+ private:
SourceMap sources;
public:
void remove_playlist (boost::weak_ptr<Playlist>);
void playlist_length_changed ();
- void diskstream_playlist_changed (boost::weak_ptr<Diskstream>);
+ void track_playlist_changed (boost::weak_ptr<Track>);
/* NAMED SELECTIONS */
mutable gint _playback_load;
mutable gint _capture_load;
- mutable gint _playback_load_min;
- mutable gint _capture_load_min;
/* I/O bundles */
XMLNode* _bundle_xml_node;
int load_bundles (XMLNode const &);
- void reverse_diskstream_buffers ();
+ void reverse_track_buffers ();
UndoHistory _history;
std::stack<UndoTransaction*> _current_trans;
based on max (requested,available)
*/
- uint32_t n_physical_outputs;
- uint32_t n_physical_inputs;
-
- uint32_t n_physical_audio_outputs;
- uint32_t n_physical_audio_inputs;
-
- uint32_t n_physical_midi_outputs;
- uint32_t n_physical_midi_inputs;
+ ChanCount n_physical_outputs;
+ ChanCount n_physical_inputs;
int find_all_sources (std::string path, std::set<std::string>& result);
int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot);
mutable bool have_looped; ///< Used in ::audible_frame(*)
- void update_have_rec_enabled_diskstream ();
- gint _have_rec_enabled_diskstream;
+ void update_have_rec_enabled_track ();
+ gint _have_rec_enabled_track;
static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>);
void rt_set_just_one_solo (boost::shared_ptr<RouteList>, bool yn, bool /* ignored*/ );
void rt_set_mute (boost::shared_ptr<RouteList>, bool yn, bool group_override);
void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override);
- void rt_set_record_enable (boost::shared_ptr<RouteList>, bool yn, bool group_override);
+ void rt_set_solo_isolated (boost::shared_ptr<RouteList>, bool yn, bool group_override);
+ void rt_set_record_enabled (boost::shared_ptr<RouteList>, bool yn, bool group_override);
+
+ /** temporary list of Diskstreams used only during load of 2.X sessions */
+ std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X;
+
+ void add_session_range_location (nframes_t, nframes_t);
+
+ void setup_midi_machine_control ();
+ void cleanup_stubfiles ();
+
+ void route_order_key_changed ();
+
+ void step_edit_status_change (bool);
+ uint32_t _step_editors;
+
+ /** true if timecode transmission by the transport is suspended, otherwise false */
+ mutable gint _suspend_timecode_transmission;
+
+ void update_locations_after_tempo_map_change (Locations::LocationList &);
};
} // namespace ARDOUR