2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_session_h__
21 #define __ardour_session_h__
31 #include <boost/dynamic_bitset.hpp>
32 #include <boost/scoped_ptr.hpp>
33 #include <boost/weak_ptr.hpp>
34 #include <boost/utility.hpp>
38 #include <glibmm/thread.h>
40 #include "pbd/error.h"
43 #include "pbd/statefuldestructible.h"
46 #include "midi++/mmc.h"
47 #include "midi++/types.h"
49 #include "pbd/destructible.h"
50 #include "pbd/stateful.h"
52 #include "ardour/ardour.h"
53 #include "ardour/chan_count.h"
54 #include "ardour/rc_configuration.h"
55 #include "ardour/session_configuration.h"
56 #include "ardour/location.h"
57 #include "ardour/timecode.h"
58 #include "ardour/interpolation.h"
78 class AudioDiskstream;
80 class AudioFileSource;
90 class ControlProtocolInfo;
101 class NamedSelection;
113 class SessionDirectory;
114 class SessionMetadata;
120 class Session : public PBD::StatefulDestructible, public boost::noncopyable
123 typedef std::pair<boost::weak_ptr<Route>,bool> RouteBooleanState;
124 typedef std::vector<RouteBooleanState> GlobalRouteBooleanState;
125 typedef std::pair<boost::weak_ptr<Route>,MeterPoint> RouteMeterState;
126 typedef std::vector<RouteMeterState> GlobalRouteMeterState;
150 InputConfigurationChange,
153 /* only one of each of these events can be queued at any one time */
168 nframes64_t action_frame;
169 nframes64_t target_frame;
175 nframes64_t target2_frame;
176 SyncSource sync_source;
181 bool second_yes_or_no;
184 std::list<AudioRange> audio_range;
185 std::list<MusicRange> music_range;
187 boost::shared_ptr<Region> region;
189 Event(Type t, Action a, nframes_t when, nframes_t where, double spd, bool yn = false, bool yn2 = false)
192 , action_frame (when)
193 , target_frame (where)
196 , second_yes_or_no (yn2)
199 void set_ptr (void* p) {
203 bool before (const Event& other) const {
204 return action_frame < other.action_frame;
207 bool after (const Event& other) const {
208 return action_frame > other.action_frame;
211 static bool compare (const Event *e1, const Event *e2) {
212 return e1->before (*e2);
215 void *operator new (size_t) {
216 return pool.alloc ();
219 void operator delete (void *ptr, size_t /*size*/) {
223 static const nframes_t Immediate = 0;
226 static MultiAllocSingleReleasePool pool;
229 /* creating from an XML file */
231 Session (AudioEngine&,
232 const std::string& fullpath,
233 const std::string& snapshot_name,
234 std::string mix_template = "");
236 /* creating a new Session */
238 Session (AudioEngine&,
239 std::string fullpath,
240 std::string snapshot_name,
241 AutoConnectOption input_auto_connect,
242 AutoConnectOption output_auto_connect,
243 uint32_t control_out_channels,
244 uint32_t master_out_channels,
245 uint32_t n_physical_in,
246 uint32_t n_physical_out,
247 nframes_t initial_length);
251 std::string path() const { return _path; }
252 std::string name() const { return _name; }
253 std::string snap_name() const { return _current_snapshot_name; }
254 std::string raid_path () const;
256 void set_snap_name ();
258 bool writable() const { return _writable; }
261 bool dirty() const { return _state_of_the_state & Dirty; }
262 void set_deletion_in_progress ();
263 void clear_deletion_in_progress ();
264 bool deletion_in_progress() const { return _state_of_the_state & Deletion; }
265 sigc::signal<void> DirtyChanged;
267 const SessionDirectory& session_directory () const { return *(_session_dir.get()); }
269 static sigc::signal<void> AutoBindingOn;
270 static sigc::signal<void> AutoBindingOff;
272 static sigc::signal<void,std::string> Dialog;
274 std::string sound_dir (bool with_path = true) const;
275 std::string peak_dir () const;
276 std::string dead_sound_dir () const;
277 std::string automation_dir () const;
278 std::string analysis_dir() const;
280 int ensure_subdirs ();
282 Glib::ustring peak_path (Glib::ustring) const;
284 static std::string change_source_path_by_name (std::string oldpath, std::string oldname, std::string newname, bool destructive);
286 std::string peak_path_from_audio_path (std::string) const;
287 std::string new_audio_source_name (const std::string&, uint32_t nchans, uint32_t chan, bool destructive);
288 std::string new_midi_source_name (const std::string&);
289 std::string new_source_path_from_name (DataType type, const std::string&);
290 RouteList new_route_from_template (uint32_t how_many, const std::string& template_path);
292 void process (nframes_t nframes);
294 BufferSet& get_silent_buffers (ChanCount count = ChanCount::ZERO);
295 BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO);
296 BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
298 void add_diskstream (boost::shared_ptr<Diskstream>);
299 boost::shared_ptr<Diskstream> diskstream_by_id (const PBD::ID& id);
300 boost::shared_ptr<Diskstream> diskstream_by_name (std::string name);
301 bool have_rec_enabled_diskstream () const;
303 bool have_captured() const { return _have_captured; }
305 void refill_all_diskstream_buffers ();
306 Butler* butler() { return _butler; }
307 void butler_transport_work ();
309 uint32_t get_next_diskstream_id() const { return n_diskstreams(); }
310 uint32_t n_diskstreams() const;
312 void refresh_disk_space ();
314 typedef std::list<boost::shared_ptr<Diskstream> > DiskstreamList;
316 SerializedRCUManager<DiskstreamList>& diskstream_list() { return diskstreams; }
318 int load_routes (const XMLNode&, int);
319 boost::shared_ptr<RouteList> get_routes() const {
320 return routes.reader ();
323 boost::shared_ptr<RouteList> get_routes_with_internal_returns() const;
325 uint32_t nroutes() const { return routes.reader()->size(); }
326 uint32_t ntracks () const;
327 uint32_t nbusses () const;
329 boost::shared_ptr<BundleList> bundles () {
330 return _bundles.reader ();
333 struct RoutePublicOrderSorter {
334 bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
337 void sync_order_keys (std::string const &);
339 template<class T> void foreach_route (T *obj, void (T::*func)(Route&));
340 template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
341 template<class T, class A> void foreach_route (T *obj, void (T::*func)(Route&, A), A arg);
343 boost::shared_ptr<Route> route_by_name (std::string);
344 boost::shared_ptr<Route> route_by_id (PBD::ID);
345 boost::shared_ptr<Route> route_by_remote_id (uint32_t id);
347 bool route_name_unique (std::string) const;
348 bool route_name_internal (std::string) const;
350 bool get_record_enabled() const {
351 return (record_status () >= Enabled);
354 RecordState record_status() const {
355 return (RecordState) g_atomic_int_get (&_record_status);
358 bool actively_recording () {
359 return record_status() == Recording;
362 bool record_enabling_legal () const;
363 void maybe_enable_record ();
364 void disable_record (bool rt_context, bool force = false);
365 void step_back_from_record ();
367 void maybe_write_autosave ();
369 /* Proxy signal for region hidden changes */
371 sigc::signal<void,boost::shared_ptr<Region> > RegionHiddenChange;
373 /* Emitted when all i/o connections are complete */
375 sigc::signal<void> IOConnectionsComplete;
377 /* Record status signals */
379 sigc::signal<void> RecordStateChanged;
381 /* Transport mechanism signals */
383 sigc::signal<void> TransportStateChange; /* generic */
384 sigc::signal<void,nframes64_t> PositionChanged; /* sent after any non-sequential motion */
385 sigc::signal<void> DurationChanged;
386 sigc::signal<void,nframes64_t> Xrun;
387 sigc::signal<void> TransportLooped;
389 /** emitted when a locate has occurred */
390 sigc::signal<void> Located;
392 sigc::signal<void,RouteList&> RouteAdded;
393 sigc::signal<void> RouteGroupChanged;
395 void request_roll_at_and_return (nframes_t start, nframes_t return_to);
396 void request_bounded_roll (nframes_t start, nframes_t end);
397 void request_stop (bool abort = false, bool clear_state = false);
398 void request_locate (nframes_t frame, bool with_roll = false);
400 void request_play_loop (bool yn, bool leave_rolling = false);
401 bool get_play_loop () const { return play_loop; }
403 nframes_t last_transport_start() const { return _last_roll_location; }
404 void goto_end () { request_locate (end_location->start(), false);}
405 void goto_start () { request_locate (start_location->start(), false); }
406 void set_session_start (nframes_t start) { start_location->set_start(start); }
407 void set_session_end (nframes_t end) { end_location->set_start(end); config.set_end_marker_is_free (false); }
408 void use_rf_shuttle_speed ();
409 void allow_auto_play (bool yn);
410 void request_transport_speed (double speed);
411 void request_overwrite_buffer (Diskstream*);
412 void request_diskstream_speed (Diskstream&, double speed);
413 void request_input_change_handling ();
415 bool locate_pending() const { return static_cast<bool>(post_transport_work()&PostTransportLocate); }
416 bool transport_locked () const;
420 int remove_region_from_region_list (boost::shared_ptr<Region>);
422 nframes_t get_maximum_extent () const;
423 nframes_t current_end_frame() const { return end_location->start(); }
424 nframes_t current_start_frame() const { return start_location->start(); }
425 /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
426 nframes_t frame_rate() const { return _current_frame_rate; }
427 /// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
428 nframes_t nominal_frame_rate() const { return _nominal_frame_rate; }
429 nframes_t frames_per_hour() const { return _frames_per_hour; }
431 double frames_per_timecode_frame() const { return _frames_per_timecode_frame; }
432 nframes_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; }
434 MIDI::byte get_mtc_timecode_bits() const {
435 return mtc_timecode_bits; /* encoding of SMTPE type for MTC */
438 float timecode_frames_per_second() const;
439 bool timecode_drop_frames() const;
443 Locations *locations() { return &_locations; }
445 sigc::signal<void,Location*> auto_loop_location_changed;
446 sigc::signal<void,Location*> auto_punch_location_changed;
447 sigc::signal<void> locations_modified;
449 void set_auto_punch_location (Location *);
450 void set_auto_loop_location (Location *);
451 int location_name(std::string& result, std::string base = std::string(""));
453 void reset_input_monitor_state ();
455 void add_event (nframes_t action_frame, Event::Type type, nframes_t target_frame = 0);
456 void remove_event (nframes_t frame, Event::Type type);
457 void clear_events (Event::Type type);
459 nframes_t get_block_size() const { return current_block_size; }
460 nframes_t worst_output_latency () const { return _worst_output_latency; }
461 nframes_t worst_input_latency () const { return _worst_input_latency; }
462 nframes_t worst_track_latency () const { return _worst_track_latency; }
464 int save_state (std::string snapshot_name, bool pending = false);
465 int restore_state (std::string snapshot_name);
466 int save_template (std::string template_name);
467 int save_history (std::string snapshot_name = "");
468 int restore_history (std::string snapshot_name);
469 void remove_state (std::string snapshot_name);
470 void rename_state (std::string old_name, std::string new_name);
471 void remove_pending_capture_state ();
473 static int rename_template (std::string old_name, std::string new_name);
474 static int delete_template (std::string name);
476 sigc::signal<void,std::string> StateSaved;
477 sigc::signal<void> StateReady;
479 std::vector<std::string*>* possible_states() const;
480 static std::vector<std::string*>* possible_states (std::string path);
482 XMLNode& get_state();
483 int set_state(const XMLNode& node, int version); // not idempotent
484 XMLNode& get_template();
486 /// The instant xml file is written to the session directory
487 void add_instant_xml (XMLNode&, bool write_to_config = true);
488 XMLNode* instant_xml (const std::string& str);
490 enum StateOfTheState {
495 InitialConnecting = 0x8,
500 StateOfTheState state_of_the_state() const { return _state_of_the_state; }
502 void add_route_group (RouteGroup *);
503 void remove_route_group (RouteGroup&);
505 RouteGroup *route_group_by_name (std::string);
507 sigc::signal<void,RouteGroup*> route_group_added;
508 sigc::signal<void> route_group_removed;
510 void foreach_route_group (sigc::slot<void,RouteGroup*> sl) {
511 for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) {
516 /* fundamental operations. duh. */
518 std::list<boost::shared_ptr<AudioTrack> > new_audio_track (
519 int input_channels, int output_channels, TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1
522 RouteList new_audio_route (bool aux, int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many);
524 std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
525 TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1
528 void remove_route (boost::shared_ptr<Route>);
529 void resort_routes ();
530 void resort_routes_using (boost::shared_ptr<RouteList>);
532 void set_remote_control_ids();
534 AudioEngine & engine() { return _engine; }
535 AudioEngine const & engine () const { return _engine; }
542 nframes64_t transport_frame () const {return _transport_frame; }
543 nframes64_t audible_frame () const;
544 nframes64_t requested_return_frame() const { return _requested_return_frame; }
558 void sync_time_vars();
560 void bbt_time (nframes_t when, BBT_Time&);
561 void timecode_to_sample(Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const;
562 void sample_to_timecode(nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
563 void timecode_time (Timecode::Time &);
564 void timecode_time (nframes_t when, Timecode::Time&);
565 void timecode_time_subframes (nframes_t when, Timecode::Time&);
567 void timecode_duration (nframes_t, Timecode::Time&) const;
568 void timecode_duration_string (char *, nframes_t) const;
570 void set_timecode_offset (nframes_t);
571 nframes_t timecode_offset () const { return _timecode_offset; }
572 void set_timecode_offset_negative (bool);
573 bool timecode_offset_negative () const { return _timecode_offset_negative; }
575 nframes_t convert_to_frames_at (nframes_t position, AnyTime const &);
577 static sigc::signal<void> StartTimeChanged;
578 static sigc::signal<void> EndTimeChanged;
579 static sigc::signal<void> TimecodeOffsetChanged;
581 std::vector<SyncSource> get_available_sync_options() const;
582 void request_sync_source (SyncSource);
583 bool synced_to_jack() const { return config.get_external_sync() && config.get_sync_source() == JACK; }
585 double transport_speed() const { return _transport_speed; }
586 bool transport_stopped() const { return _transport_speed == 0.0f; }
587 bool transport_rolling() const { return _transport_speed != 0.0f; }
589 void set_silent (bool yn);
590 bool silent () { return _silent; }
592 int jack_slave_sync (nframes_t);
594 TempoMap& tempo_map() { return *_tempo_map; }
596 /// signals the current transport position in frames, bbt and timecode time (in that order)
597 sigc::signal<void, const nframes_t&, const BBT_Time&, const Timecode::Time&> tick;
601 void add_regions (std::vector<boost::shared_ptr<Region> >&);
603 sigc::signal<void,boost::weak_ptr<Region> > RegionAdded;
604 sigc::signal<void,std::vector<boost::weak_ptr<Region> >& > RegionsAdded;
605 sigc::signal<void,boost::weak_ptr<Region> > RegionRemoved;
607 int region_name (std::string& result, std::string base = std::string(""), bool newlevel = false);
608 std::string new_region_name (std::string);
609 std::string path_from_region_name (DataType type, std::string name, std::string identifier);
611 boost::shared_ptr<Region> find_whole_file_parent (boost::shared_ptr<Region const>);
613 void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
615 boost::shared_ptr<Region> XMLRegionFactory (const XMLNode&, bool full);
616 boost::shared_ptr<AudioRegion> XMLAudioRegionFactory (const XMLNode&, bool full);
617 boost::shared_ptr<MidiRegion> XMLMidiRegionFactory (const XMLNode&, bool full);
619 template<class T> void foreach_region (T *obj, void (T::*func)(boost::shared_ptr<Region>));
621 /* source management */
623 void import_audiofiles (ImportStatus&);
624 bool sample_rate_convert (ImportStatus&, std::string infile, std::string& outfile);
625 std::string build_tmp_convert_name (std::string file);
627 boost::shared_ptr<ExportHandler> get_export_handler ();
628 boost::shared_ptr<ExportStatus> get_export_status ();
630 int start_audio_export (nframes_t position, bool realtime);
632 sigc::signal<int, nframes_t> ProcessExport;
633 sigc::signal<void> ExportReadFinished;
634 static sigc::signal<void, std::string, std::string> Exported;
636 void add_source (boost::shared_ptr<Source>);
637 void remove_source (boost::weak_ptr<Source>);
639 uint32_t source_use_count (boost::shared_ptr<const Source> src) const;
641 int cleanup_sources (CleanupReport&);
642 int cleanup_trash_sources (CleanupReport&);
644 int destroy_region (boost::shared_ptr<Region>);
645 int destroy_regions (std::list<boost::shared_ptr<Region> >);
647 int remove_last_capture ();
649 /** handlers should return -1 for "stop cleanup",
650 0 for "yes, delete this playlist",
651 1 for "no, don't delete this playlist".
653 sigc::signal<int,boost::shared_ptr<ARDOUR::Playlist> > AskAboutPlaylistDeletion;
655 /** handlers should return 0 for "ignore the rate mismatch",
656 !0 for "do not use this session"
658 static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch;
660 /** handlers should return !0 for use pending state, 0 for ignore it.
662 static sigc::signal<int> AskAboutPendingState;
664 boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
666 boost::shared_ptr<MidiSource> create_midi_source_for_session (ARDOUR::MidiDiskstream&);
668 boost::shared_ptr<Source> source_by_id (const PBD::ID&);
669 boost::shared_ptr<Source> source_by_path_and_channel (const Glib::ustring&, uint16_t);
671 /* playlist management */
673 boost::shared_ptr<Playlist> playlist_by_name (std::string name);
674 void unassigned_playlists (std::list<boost::shared_ptr<Playlist> > & list);
675 void add_playlist (boost::shared_ptr<Playlist>, bool unused = false);
676 sigc::signal<void,boost::shared_ptr<Playlist> > PlaylistAdded;
677 sigc::signal<void,boost::shared_ptr<Playlist> > PlaylistRemoved;
679 uint32_t n_playlists() const;
681 template<class T> void foreach_playlist (T *obj, void (T::*func)(boost::shared_ptr<Playlist>));
682 void get_playlists (std::vector<boost::shared_ptr<Playlist> >&);
684 /* named selections */
686 NamedSelection* named_selection_by_name (std::string name);
687 void add_named_selection (NamedSelection *);
688 void remove_named_selection (NamedSelection *);
690 template<class T> void foreach_named_selection (T& obj, void (T::*func)(NamedSelection&));
691 sigc::signal<void> NamedSelectionAdded;
692 sigc::signal<void> NamedSelectionRemoved;
694 /* Curves and AutomationLists (TODO when they go away) */
695 void add_automation_list(AutomationList*);
699 float get_default_fade_length () const { return default_fade_msecs; }
700 float get_default_fade_steepness () const { return default_fade_steepness; }
701 void set_default_fade (float steepness, float msecs);
705 boost::shared_ptr<Auditioner> the_auditioner() { return auditioner; }
706 void audition_playlist ();
707 void audition_region (boost::shared_ptr<Region>);
708 void cancel_audition ();
709 bool is_auditioning () const;
711 sigc::signal<void,bool> AuditionActive;
713 /* flattening stuff */
715 boost::shared_ptr<Region> write_one_track (AudioTrack&, nframes_t start, nframes_t end,
716 bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
717 bool enable_processing = true);
718 int freeze (InterThreadInfo&);
720 /* session-wide solo/mute/rec-enable */
722 bool soloing() const { return _non_soloed_outs_muted; }
723 bool listening() const { return _listen_cnt > 0; }
725 void set_all_solo (bool);
726 void set_all_mute (bool);
727 void set_all_listen (bool);
729 sigc::signal<void,bool> SoloActive;
730 sigc::signal<void> SoloChanged;
732 void record_disenable_all ();
733 void record_enable_all ();
735 /* control/master out */
737 boost::shared_ptr<Route> control_out() const { return _control_out; }
738 boost::shared_ptr<Route> master_out() const { return _master_out; }
740 void globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p);
741 void globally_set_send_gains_from_track (boost::shared_ptr<Route> dest);
742 void globally_set_send_gains_to_zero (boost::shared_ptr<Route> dest);
743 void globally_set_send_gains_to_unity (boost::shared_ptr<Route> dest);
744 void add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::shared_ptr<RouteList> senders);
746 static void set_disable_all_loaded_plugins (bool yn) {
747 _disable_all_loaded_plugins = yn;
749 static bool get_disable_all_loaded_plugins() {
750 return _disable_all_loaded_plugins;
753 uint32_t next_send_id();
754 uint32_t next_return_id();
755 uint32_t next_insert_id();
756 void mark_send_id (uint32_t);
757 void mark_return_id (uint32_t);
758 void mark_insert_id (uint32_t);
760 /* s/w "RAID" management */
762 nframes_t available_capture_duration();
766 void add_bundle (boost::shared_ptr<Bundle>);
767 void remove_bundle (boost::shared_ptr<Bundle>);
768 boost::shared_ptr<Bundle> bundle_by_name (std::string) const;
770 sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded;
771 sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved;
775 void midi_panic(void);
776 int set_mtc_port (std::string port_tag);
777 int set_mmc_port (std::string port_tag);
778 int set_midi_port (std::string port_tag);
779 int set_midi_clock_port (std::string port_tag);
780 MIDI::Port *mtc_port() const { return _mtc_port; }
781 MIDI::Port *mmc_port() const { return _mmc_port; }
782 MIDI::Port *midi_port() const { return _midi_port; }
783 MIDI::Port *midi_clock_port() const { return _midi_clock_port; }
785 sigc::signal<void> MTC_PortChanged;
786 sigc::signal<void> MMC_PortChanged;
787 sigc::signal<void> MIDI_PortChanged;
788 sigc::signal<void> MIDIClock_PortChanged;
790 void set_trace_midi_input (bool, MIDI::Port* port = 0);
791 void set_trace_midi_output (bool, MIDI::Port* port = 0);
793 bool get_trace_midi_input(MIDI::Port *port = 0);
794 bool get_trace_midi_output(MIDI::Port *port = 0);
796 void set_mmc_receive_device_id (uint32_t id);
797 void set_mmc_send_device_id (uint32_t id);
801 void start_scrub (nframes_t where);
803 void set_scrub_speed (float);
804 nframes_t scrub_buffer_size() const;
805 sigc::signal<void> ScrubReady;
807 /* History (for editors, mixers, UIs etc.) */
809 /** Undo some transactions.
810 * @param n Number of transactions to undo.
812 void undo (uint32_t n) {
816 void redo (uint32_t n) {
820 UndoHistory& history() { return _history; }
822 uint32_t undo_depth() const { return _history.undo_depth(); }
823 uint32_t redo_depth() const { return _history.redo_depth(); }
824 std::string next_undo() const { return _history.next_undo(); }
825 std::string next_redo() const { return _history.next_redo(); }
827 void begin_reversible_command (const std::string& cmd_name);
828 void commit_reversible_command (Command* cmd = 0);
830 void add_command (Command *const cmd) {
831 assert(!_current_trans.empty ());
832 _current_trans.top()->add_command (cmd);
835 std::map<PBD::ID, PBD::StatefulThingWithGoingAway*> registry;
837 // these commands are implemented in libs/ardour/session_command.cc
838 Command* memento_command_factory(XMLNode* n);
839 void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway*);
841 Command* global_state_command_factory (const XMLNode& n);
843 class GlobalRouteStateCommand : public Command
846 GlobalRouteStateCommand (Session&, void*);
847 GlobalRouteStateCommand (Session&, const XMLNode& node);
848 int set_state (const XMLNode&, int version);
849 XMLNode& get_state ();
852 GlobalRouteBooleanState before, after;
857 class GlobalSoloStateCommand : public GlobalRouteStateCommand
860 GlobalSoloStateCommand (Session &, void *src);
861 GlobalSoloStateCommand (Session&, const XMLNode&);
862 void operator()(); //redo
864 XMLNode &get_state();
868 class GlobalMuteStateCommand : public GlobalRouteStateCommand
871 GlobalMuteStateCommand(Session &, void *src);
872 GlobalMuteStateCommand (Session&, const XMLNode&);
873 void operator()(); // redo
875 XMLNode &get_state();
879 class GlobalRecordEnableStateCommand : public GlobalRouteStateCommand
882 GlobalRecordEnableStateCommand(Session &, void *src);
883 GlobalRecordEnableStateCommand (Session&, const XMLNode&);
884 void operator()(); // redo
886 XMLNode &get_state();
890 class GlobalMeteringStateCommand : public Command
893 GlobalMeteringStateCommand(Session &, void *src);
894 GlobalMeteringStateCommand (Session&, const XMLNode&);
897 XMLNode &get_state();
898 int set_state (const XMLNode&, int version);
904 GlobalRouteMeterState before;
905 GlobalRouteMeterState after;
910 boost::shared_ptr<IO> click_io() { return _click_io; }
912 /* disk, buffer loads */
914 uint32_t playback_load ();
915 uint32_t capture_load ();
916 uint32_t playback_load_min ();
917 uint32_t capture_load_min ();
919 void reset_playback_load_min ();
920 void reset_capture_load_min ();
924 void request_play_range (std::list<AudioRange>*, bool leave_rolling = false);
925 bool get_play_range () const { return _play_range; }
927 /* buffers for gain and pan */
929 gain_t* gain_automation_buffer () const { return _gain_automation_buffer; }
930 pan_t** pan_automation_buffer () const { return _pan_automation_buffer; }
932 void ensure_buffer_set (BufferSet& buffers, const ChanCount& howmany);
936 static long vst_callback (AEffect* effect,
943 static sigc::signal<void> SendFeedback;
947 boost::shared_ptr<PBD::Controllable> controllable_by_id (const PBD::ID&);
949 void add_controllable (boost::shared_ptr<PBD::Controllable>);
950 void remove_controllable (PBD::Controllable*);
952 SessionMetadata & metadata () { return *_metadata; }
954 SessionConfiguration config;
956 bool exporting () const {
961 friend class AudioEngine;
962 void set_block_size (nframes_t nframes);
963 void set_frame_rate (nframes_t nframes);
966 friend class Diskstream;
970 void schedule_curve_reallocation ();
971 void update_latency_compensation (bool, bool);
974 int create (bool& new_session, const std::string& mix_template, nframes_t initial_length);
977 nframes_t compute_initial_length ();
980 PendingDeclickIn = 0x1,
981 PendingDeclickOut = 0x2,
982 StopPendingCapture = 0x4,
983 AutoReturning = 0x10,
984 PendingLocate = 0x20,
985 PendingSetLoop = 0x40
988 /* stuff used in process() should be close together to
992 typedef void (Session::*process_function_type)(nframes_t);
994 AudioEngine& _engine;
995 mutable gint processing_prohibited;
996 process_function_type process_function;
997 process_function_type last_process_function;
998 bool waiting_for_sync_offset;
999 nframes_t _base_frame_rate;
1000 nframes_t _current_frame_rate; //this includes video pullup offset
1001 nframes_t _nominal_frame_rate; //ignores audioengine setting, "native" SR
1002 int transport_sub_state;
1003 mutable gint _record_status;
1004 volatile nframes64_t _transport_frame;
1005 Location* end_location;
1006 Location* start_location;
1010 // varispeed playback
1011 volatile double _transport_speed;
1012 double _last_transport_speed;
1013 double _target_transport_speed;
1014 CubicInterpolation interpolation;
1016 bool auto_play_legal;
1017 nframes64_t _last_slave_transport_frame;
1018 nframes_t maximum_output_latency;
1019 volatile nframes64_t _requested_return_frame;
1020 BufferSet* _scratch_buffers;
1021 BufferSet* _silent_buffers;
1022 BufferSet* _mix_buffers;
1023 nframes_t current_block_size;
1024 nframes_t _worst_output_latency;
1025 nframes_t _worst_input_latency;
1026 nframes_t _worst_track_latency;
1027 bool _have_captured;
1029 float _meter_falloff;
1030 bool _non_soloed_outs_muted;
1031 uint32_t _listen_cnt;
1035 void set_worst_io_latencies ();
1036 void set_worst_io_latencies_x (IOChange, void *) {
1037 set_worst_io_latencies ();
1040 void update_latency_compensation_proxy (void* ignored);
1042 void ensure_buffers (ChanCount howmany);
1044 void process_scrub (nframes_t);
1045 void process_without_events (nframes_t);
1046 void process_with_events (nframes_t);
1047 void process_audition (nframes_t);
1048 void process_export (nframes_t);
1049 int process_export_fw (nframes_t);
1051 void block_processing() { g_atomic_int_set (&processing_prohibited, 1); }
1052 void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); }
1053 bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); }
1055 /* slave tracking */
1057 static const int delta_accumulator_size = 25;
1058 int delta_accumulator_cnt;
1059 long delta_accumulator[delta_accumulator_size];
1060 long average_slave_delta;
1062 bool have_first_delta_accumulator;
1070 SlaveState slave_state;
1071 nframes_t slave_wait_end;
1073 void reset_slave_state ();
1074 bool follow_slave (nframes_t);
1075 void calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta);
1076 void track_slave_state(float slave_speed, nframes_t slave_transport_frame,
1077 nframes_t this_delta, bool starting);
1078 void follow_slave_silently(nframes_t nframes, float slave_speed);
1080 void use_sync_source (SyncSource);
1081 void drop_sync_source ();
1083 bool post_export_sync;
1084 nframes_t post_export_position;
1087 bool _exporting_realtime;
1089 boost::shared_ptr<ExportHandler> export_handler;
1090 boost::shared_ptr<ExportStatus> export_status;
1093 int stop_audio_export ();
1094 void finalize_audio_export ();
1096 sigc::connection export_freewheel_connection;
1098 void prepare_diskstreams ();
1099 void commit_diskstreams (nframes_t, bool& session_requires_butler);
1100 int process_routes (nframes_t);
1101 int silent_process_routes (nframes_t);
1103 bool get_rec_monitors_input () {
1104 if (actively_recording()) {
1107 if (config.get_auto_input()) {
1115 int get_transport_declick_required () {
1116 if (transport_sub_state & PendingDeclickIn) {
1117 transport_sub_state &= ~PendingDeclickIn;
1119 } else if (transport_sub_state & PendingDeclickOut) {
1126 bool maybe_stop (nframes_t limit);
1127 bool maybe_sync_start (nframes_t&);
1129 void check_declick_out ();
1131 MIDI::MachineControl* mmc;
1132 MIDI::Port* _mmc_port;
1133 MIDI::Port* _mtc_port;
1134 MIDI::Port* _midi_port;
1135 MIDI::Port* _midi_clock_port;
1138 bool session_send_mmc;
1139 bool session_send_mtc;
1140 bool session_midi_feedback;
1143 nframes_t last_loopend;
1145 boost::scoped_ptr<SessionDirectory> _session_dir;
1147 RingBuffer<Event*> pending_events;
1150 void when_engine_running ();
1151 void graph_reordered ();
1153 std::string _current_snapshot_name;
1155 XMLTree* state_tree;
1156 bool state_was_pending;
1157 StateOfTheState _state_of_the_state;
1160 int load_options (const XMLNode&);
1161 int load_state (std::string snapshot_name);
1163 nframes_t _last_roll_location;
1164 nframes_t _last_record_location;
1166 bool pending_locate_roll;
1167 nframes_t pending_locate_frame;
1168 bool pending_locate_flush;
1170 bool pending_auto_loop;
1174 enum PostTransportWork {
1175 PostTransportStop = 0x1,
1176 PostTransportDisableRecord = 0x2,
1177 PostTransportPosition = 0x8,
1178 PostTransportDidRecord = 0x20,
1179 PostTransportDuration = 0x40,
1180 PostTransportLocate = 0x80,
1181 PostTransportRoll = 0x200,
1182 PostTransportAbort = 0x800,
1183 PostTransportOverWrite = 0x1000,
1184 PostTransportSpeed = 0x2000,
1185 PostTransportAudition = 0x4000,
1186 PostTransportScrub = 0x8000,
1187 PostTransportReverse = 0x10000,
1188 PostTransportInputChange = 0x20000,
1189 PostTransportCurveRealloc = 0x40000,
1190 PostTransportClearSubstate = 0x80000
1193 static const PostTransportWork ProcessCannotProceedMask =
1195 PostTransportInputChange|
1197 PostTransportReverse|
1198 PostTransportCurveRealloc|
1200 PostTransportAudition|
1201 PostTransportLocate|
1203 PostTransportClearSubstate);
1205 gint _post_transport_work; /* accessed only atomic ops */
1206 PostTransportWork post_transport_work() const { return (PostTransportWork) g_atomic_int_get (&_post_transport_work); }
1207 void set_post_transport_work (PostTransportWork ptw) { g_atomic_int_set (&_post_transport_work, (gint) ptw); }
1208 void add_post_transport_work (PostTransportWork ptw);
1210 uint32_t cumulative_rf_motion;
1213 void set_rf_speed (float speed);
1214 void reset_rf_scale (nframes_t frames_moved);
1216 Locations _locations;
1217 void locations_changed ();
1218 void locations_added (Location*);
1219 void handle_locations_changed (Locations::LocationList&);
1221 sigc::connection auto_punch_start_changed_connection;
1222 sigc::connection auto_punch_end_changed_connection;
1223 sigc::connection auto_punch_changed_connection;
1224 void auto_punch_start_changed (Location *);
1225 void auto_punch_end_changed (Location *);
1226 void auto_punch_changed (Location *);
1228 sigc::connection auto_loop_start_changed_connection;
1229 sigc::connection auto_loop_end_changed_connection;
1230 sigc::connection auto_loop_changed_connection;
1231 void auto_loop_changed (Location *);
1233 typedef std::list<Event *> Events;
1235 Events immediate_events;
1236 Events::iterator next_event;
1238 /* there can only ever be one of each of these */
1240 Event *auto_loop_event;
1241 Event *punch_out_event;
1242 Event *punch_in_event;
1246 void dump_events () const;
1247 void queue_event (Event *ev);
1248 void merge_event (Event*);
1249 void replace_event (Event::Type, nframes_t action_frame, nframes_t target = 0);
1250 bool _replace_event (Event*);
1251 bool _remove_event (Event *);
1252 void _clear_event_type (Event::Type);
1254 void first_stage_init (std::string path, std::string snapshot_name);
1255 int second_stage_init (bool new_tracks);
1256 void find_current_end ();
1257 void remove_empty_sounds ();
1259 void setup_midi_control ();
1260 int midi_read (MIDI::Port *);
1262 void enable_record ();
1264 void increment_transport_position (uint32_t val) {
1265 if (max_frames - val < _transport_frame) {
1266 _transport_frame = max_frames;
1268 _transport_frame += val;
1272 void decrement_transport_position (uint32_t val) {
1273 if (val < _transport_frame) {
1274 _transport_frame -= val;
1276 _transport_frame = 0;
1280 void post_transport_motion ();
1281 static void *session_loader_thread (void *arg);
1285 void set_next_event ();
1286 void process_event (Event *ev);
1288 /* MIDI Machine Control */
1290 void deliver_mmc (MIDI::MachineControl::Command, nframes_t);
1292 void spp_start (MIDI::Parser&, nframes_t timestamp);
1293 void spp_continue (MIDI::Parser&, nframes_t timestamp);
1294 void spp_stop (MIDI::Parser&, nframes_t timestamp);
1296 void mmc_deferred_play (MIDI::MachineControl &);
1297 void mmc_stop (MIDI::MachineControl &);
1298 void mmc_step (MIDI::MachineControl &, int);
1299 void mmc_pause (MIDI::MachineControl &);
1300 void mmc_record_pause (MIDI::MachineControl &);
1301 void mmc_record_strobe (MIDI::MachineControl &);
1302 void mmc_record_exit (MIDI::MachineControl &);
1303 void mmc_track_record_status (MIDI::MachineControl &, uint32_t track, bool enabled);
1304 void mmc_fast_forward (MIDI::MachineControl &);
1305 void mmc_rewind (MIDI::MachineControl &);
1306 void mmc_locate (MIDI::MachineControl &, const MIDI::byte *);
1307 void mmc_shuttle (MIDI::MachineControl &mmc, float speed, bool forw);
1308 void mmc_record_enable (MIDI::MachineControl &mmc, size_t track, bool enabled);
1310 struct timeval last_mmc_step;
1313 typedef sigc::slot<bool> MidiTimeoutCallback;
1314 typedef std::list<MidiTimeoutCallback> MidiTimeoutList;
1316 MidiTimeoutList midi_timeouts;
1317 bool mmc_step_timeout ();
1319 MIDI::byte mmc_buffer[32];
1320 MIDI::byte mtc_msg[16];
1321 MIDI::byte mtc_timecode_bits; /* encoding of SMTPE type for MTC */
1322 MIDI::byte midi_msg[16];
1323 nframes_t outbound_mtc_timecode_frame;
1324 Timecode::Time transmitting_timecode_time;
1325 int next_quarter_frame_to_send;
1327 double _frames_per_timecode_frame; /* has to be floating point because of drop frame */
1328 nframes_t _frames_per_hour;
1329 nframes_t _timecode_frames_per_hour;
1330 nframes_t _timecode_offset;
1331 bool _timecode_offset_negative;
1333 /* cache the most-recently requested time conversions. This helps when we
1334 * have multiple clocks showing the same time (e.g. the transport frame) */
1335 bool last_timecode_valid;
1336 nframes_t last_timecode_when;
1337 Timecode::Time last_timecode;
1339 bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle
1341 int send_full_time_code(nframes_t nframes);
1342 int send_midi_time_code_for_cycle(nframes_t nframes);
1344 nframes_t adjust_apparent_position (nframes_t frames);
1346 void reset_record_status ();
1348 int no_roll (nframes_t nframes);
1349 int fail_roll (nframes_t nframes);
1351 bool non_realtime_work_pending() const { return static_cast<bool>(post_transport_work()); }
1352 bool process_can_proceed() const { return !(post_transport_work() & ProcessCannotProceedMask); }
1354 struct MIDIRequest {
1362 Glib::Mutex midi_lock;
1363 pthread_t midi_thread;
1364 int midi_request_pipe[2];
1365 RingBuffer<MIDIRequest*> midi_requests;
1367 int start_midi_thread ();
1368 void terminate_midi_thread ();
1369 void poke_midi_thread ();
1370 static void *_midi_thread_work (void *arg);
1371 void midi_thread_work ();
1372 void change_midi_ports ();
1373 int use_config_midi_ports ();
1375 void set_play_loop (bool yn);
1376 void unset_play_loop ();
1377 void overwrite_some_buffers (Diskstream*);
1378 void flush_all_inserts ();
1379 int micro_locate (nframes_t distance);
1380 void locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false);
1381 void start_locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false);
1382 void force_locate (nframes64_t frame, bool with_roll = false);
1383 void set_diskstream_speed (Diskstream*, double speed);
1384 void set_transport_speed (double speed, bool abort = false, bool clear_state = false);
1385 void stop_transport (bool abort = false, bool clear_state = false);
1386 void start_transport ();
1387 void realtime_stop (bool abort, bool clear_state);
1388 void non_realtime_start_scrub ();
1389 void non_realtime_set_speed ();
1390 void non_realtime_locate ();
1391 void non_realtime_stop (bool abort, int entry_request_count, bool& finished);
1392 void non_realtime_overwrite (int entry_request_count, bool& finished);
1393 void post_transport ();
1394 void engine_halted ();
1395 void xrun_recovery ();
1397 TempoMap *_tempo_map;
1398 void tempo_map_changed (Change);
1400 /* edit/mix groups */
1402 int load_route_groups (const XMLNode&, int);
1404 std::list<RouteGroup *> _route_groups;
1408 SerializedRCUManager<DiskstreamList> diskstreams;
1410 int load_diskstreams (const XMLNode&);
1414 SerializedRCUManager<RouteList> routes;
1416 void add_routes (RouteList&, bool save);
1417 uint32_t destructive_index;
1419 boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
1423 bool solo_update_disabled;
1425 void route_listen_changed (void *src, boost::weak_ptr<Route>);
1426 void route_mute_changed (void *src);
1427 void route_solo_changed (void *src, boost::weak_ptr<Route>);
1428 void update_route_solo_state (boost::shared_ptr<RouteList> r = boost::shared_ptr<RouteList>());
1430 void listen_position_changed ();
1431 void solo_control_mode_changed ();
1433 /* REGION MANAGEMENT */
1435 std::map<std::string,uint32_t> region_name_map;
1436 void update_region_name_map (boost::shared_ptr<Region>);
1438 mutable Glib::Mutex region_lock;
1439 typedef std::map<PBD::ID,boost::shared_ptr<Region> > RegionList;
1442 void add_region (boost::shared_ptr<Region>);
1443 void region_changed (Change, boost::weak_ptr<Region>);
1444 void remove_region (boost::weak_ptr<Region>);
1446 int load_regions (const XMLNode& node);
1448 void route_group_changed ();
1452 mutable Glib::Mutex source_lock;
1453 typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap;
1458 SourceMap get_sources() { return sources; }
1461 int load_sources (const XMLNode& node);
1462 XMLNode& get_sources_as_xml ();
1464 boost::shared_ptr<Source> XMLSourceFactory (const XMLNode&);
1468 mutable Glib::Mutex playlist_lock;
1469 typedef std::set<boost::shared_ptr<Playlist> > PlaylistList;
1470 PlaylistList playlists;
1471 PlaylistList unused_playlists;
1473 int load_playlists (const XMLNode&);
1474 int load_unused_playlists (const XMLNode&);
1475 void remove_playlist (boost::weak_ptr<Playlist>);
1476 void track_playlist (bool, boost::weak_ptr<Playlist>);
1478 boost::shared_ptr<Playlist> playlist_factory (std::string name);
1479 boost::shared_ptr<Playlist> XMLPlaylistFactory (const XMLNode&);
1481 void playlist_length_changed ();
1482 void diskstream_playlist_changed (boost::weak_ptr<Diskstream>);
1484 /* NAMED SELECTIONS */
1486 mutable Glib::Mutex named_selection_lock;
1487 typedef std::set<NamedSelection *> NamedSelectionList;
1488 NamedSelectionList named_selections;
1490 int load_named_selections (const XMLNode&);
1492 NamedSelection *named_selection_factory (std::string name);
1493 NamedSelection *XMLNamedSelectionFactory (const XMLNode&);
1495 /* CURVES and AUTOMATION LISTS */
1496 std::map<PBD::ID, AutomationList*> automation_lists;
1498 /* DEFAULT FADE CURVES */
1500 float default_fade_steepness;
1501 float default_fade_msecs;
1505 boost::shared_ptr<Auditioner> auditioner;
1506 void set_audition (boost::shared_ptr<Region>);
1507 void non_realtime_set_audition ();
1508 boost::shared_ptr<Region> pending_audition_region;
1514 int flatten_one_track (AudioTrack&, nframes_t start, nframes_t cnt);
1516 /* INSERT AND SEND MANAGEMENT */
1518 boost::dynamic_bitset<uint32_t> send_bitset;
1519 boost::dynamic_bitset<uint32_t> return_bitset;
1520 boost::dynamic_bitset<uint32_t> insert_bitset;
1522 void add_processor (Processor *);
1523 void remove_processor (Processor *);
1527 struct space_and_path {
1528 uint32_t blocks; /* 4kB blocks */
1536 struct space_and_path_ascending_cmp {
1537 bool operator() (space_and_path a, space_and_path b) {
1538 return a.blocks > b.blocks;
1542 void setup_raid_path (std::string path);
1544 std::vector<space_and_path> session_dirs;
1545 std::vector<space_and_path>::iterator last_rr_session_dir;
1546 uint32_t _total_free_4k_blocks;
1547 Glib::Mutex space_lock;
1549 std::string get_best_session_directory_for_new_source ();
1551 mutable gint _playback_load;
1552 mutable gint _capture_load;
1553 mutable gint _playback_load_min;
1554 mutable gint _capture_load_min;
1558 SerializedRCUManager<BundleList> _bundles;
1559 XMLNode* _bundle_xml_node;
1560 int load_bundles (XMLNode const &);
1562 void reverse_diskstream_buffers ();
1564 UndoHistory _history;
1565 std::stack<UndoTransaction*> _current_trans;
1567 GlobalRouteBooleanState get_global_route_boolean (bool (Route::*method)(void) const);
1568 GlobalRouteMeterState get_global_route_metering ();
1570 void set_global_route_boolean (GlobalRouteBooleanState s, void (Route::*method)(bool, void*), void *arg);
1571 void set_global_route_metering (GlobalRouteMeterState s, void *arg);
1573 void set_global_mute (GlobalRouteBooleanState s, void *src);
1574 void set_global_solo (GlobalRouteBooleanState s, void *src);
1575 void set_global_record_enable (GlobalRouteBooleanState s, void *src);
1577 void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int);
1578 int jack_sync_callback (jack_transport_state_t, jack_position_t*);
1579 void reset_jack_connection (jack_client_t* jack);
1580 void record_enable_change_all (bool yn);
1582 XMLNode& state(bool);
1592 Click (nframes_t s, nframes_t d, const Sample *b)
1593 : start (s), duration (d), data (b) { offset = 0; }
1595 void *operator new (size_t) {
1596 return pool.alloc ();
1599 void operator delete(void *ptr, size_t /*size*/) {
1607 typedef std::list<Click*> Clicks;
1611 boost::shared_ptr<IO> _click_io;
1613 Sample* click_emphasis_data;
1614 nframes_t click_length;
1615 nframes_t click_emphasis_length;
1616 mutable Glib::RWLock click_lock;
1618 static const Sample default_click[];
1619 static const nframes_t default_click_length;
1620 static const Sample default_click_emphasis[];
1621 static const nframes_t default_click_emphasis_length;
1624 void setup_click_sounds (int which);
1625 void clear_clicks ();
1626 void click (nframes_t start, nframes_t nframes);
1628 std::vector<Route*> master_outs;
1630 /* range playback */
1632 std::list<AudioRange> current_audio_range;
1634 void set_play_range (std::list<AudioRange>&, bool leave_rolling);
1635 void unset_play_range ();
1640 boost::shared_ptr<Route> _master_out;
1641 boost::shared_ptr<Route> _control_out;
1643 gain_t* _gain_automation_buffer;
1644 pan_t** _pan_automation_buffer;
1645 void allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force);
1646 uint32_t _npan_buffers;
1650 long _vst_callback (VSTPlugin*,
1657 /* number of hardware ports we're using,
1658 based on max (requested,available)
1661 uint32_t n_physical_outputs;
1662 uint32_t n_physical_inputs;
1664 uint32_t n_physical_audio_outputs;
1665 uint32_t n_physical_audio_inputs;
1667 uint32_t n_physical_midi_outputs;
1668 uint32_t n_physical_midi_inputs;
1670 int find_all_sources (std::string path, std::set<std::string>& result);
1671 int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot);
1673 typedef std::set<boost::shared_ptr<PBD::Controllable> > Controllables;
1674 Glib::Mutex controllables_lock;
1675 Controllables controllables;
1677 void reset_native_file_format();
1678 bool first_file_data_format_reset;
1679 bool first_file_header_format_reset;
1681 void config_changed (std::string, bool);
1683 XMLNode& get_control_protocol_state ();
1685 void set_history_depth (uint32_t depth);
1686 void sync_order_keys ();
1688 static bool _disable_all_loaded_plugins;
1690 SessionMetadata * _metadata;
1692 mutable bool have_looped; ///< Used in ::audible_frame(*)
1694 void update_have_rec_enabled_diskstream ();
1695 gint _have_rec_enabled_diskstream;
1698 } // namespace ARDOUR
1700 #endif /* __ardour_session_h__ */