X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fsession.h;h=cdc79164e6184cc5724667092b1eac6653464c11;hb=1bd4c5b3a212460eed1773f6b049d18c89625565;hp=b58b0a926b15a4678486f551c2fcf6968265c679;hpb=8af0757b61990767f2a85e68f535a5af9976fd79;p=ardour.git diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index b58b0a926b..cdc79164e6 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -21,34 +21,37 @@ #ifndef __ardour_session_h__ #define __ardour_session_h__ + #include -#if __GNUC__ >= 3 -#include -using __gnu_cxx::slist; -#else -#include -#endif +#include #include #include #include #include + +#include + #include #include +#include + #include -#include -#include #include #include +#include +#include #include #include +#include +#include + #include #include #include -#include #include #include @@ -60,16 +63,22 @@ namespace MIDI { class Port; } +namespace PBD { + class Controllable; +} + namespace ARDOUR { class Port; class AudioEngine; class Slave; -class DiskStream; +class Diskstream; +class AudioDiskstream; class Route; class AuxInput; class Source; -class FileSource; +class AudioSource; +class AudioFileSource; class Auditioner; class Insert; class Send; @@ -84,23 +93,23 @@ class AudioRegion; class Region; class Playlist; class VSTPlugin; +class ControlProtocolInfo; struct AudioExportSpecification; struct RouteGroup; using std::vector; using std::string; -using std::list; using std::map; using std::set; -class Session : public sigc::trackable, public Stateful +class Session : public PBD::StatefulDestructible { private: - typedef std::pair RouteBooleanState; + typedef std::pair,bool> RouteBooleanState; typedef vector GlobalRouteBooleanState; - typedef std::pair RouteMeterState; + typedef std::pair,MeterPoint> RouteMeterState; typedef vector GlobalRouteMeterState; public: @@ -110,17 +119,6 @@ class Session : public sigc::trackable, public Stateful Recording = 2 }; - enum SlaveSource { - None = 0, - MTC, - JACK, - }; - - enum AutoConnectOption { - AutoConnectPhysical = 0x1, - AutoConnectMaster = 0x2 - }; - struct Event { enum Type { SetTransportSpeed, @@ -144,7 +142,7 @@ class Session : public sigc::trackable, public Stateful */ StopOnce, - AutoLoop, + AutoLoop }; enum Action { @@ -154,22 +152,24 @@ class Session : public sigc::trackable, public Stateful Clear }; - Type type; - Action action; - jack_nframes_t action_frame; - jack_nframes_t target_frame; - float speed; + Type type; + Action action; + nframes_t action_frame; + nframes_t target_frame; + float speed; union { - void* ptr; - bool yes_or_no; - Session::SlaveSource slave; + void* ptr; + bool yes_or_no; + SlaveSource slave; }; + boost::shared_ptr region; + list audio_range; list music_range; - Event(Type t, Action a, jack_nframes_t when, jack_nframes_t where, float spd, bool yn = false) + Event(Type t, Action a, nframes_t when, nframes_t where, float spd, bool yn = false) : type (t), action (a), action_frame (when), @@ -201,7 +201,7 @@ class Session : public sigc::trackable, public Stateful pool.release (ptr); } - static const jack_nframes_t Immediate = 0; + static const nframes_t Immediate = 0; private: static MultiAllocSingleReleasePool pool; @@ -225,7 +225,7 @@ class Session : public sigc::trackable, public Stateful uint32_t master_out_channels, uint32_t n_physical_in, uint32_t n_physical_out, - jack_nframes_t initial_length); + nframes_t initial_length); virtual ~Session (); @@ -235,71 +235,72 @@ class Session : public sigc::trackable, public Stateful string path() const { return _path; } string name() const { return _name; } string snap_name() const { return _current_snapshot_name; } + string raid_path () const; void set_snap_name (); void set_dirty (); void set_clean (); bool dirty() const { return _state_of_the_state & Dirty; } + bool deletion_in_progress() const { return _state_of_the_state & Deletion; } sigc::signal DirtyChanged; - string sound_dir () const; - string peak_dir () const; - string dead_sound_dir () const; - string automation_dir () const; + std::string sound_dir (bool with_path = true) const; + std::string peak_dir () const; + std::string dead_sound_dir () const; + std::string automation_dir () const; + + string peak_path_from_audio_path (string) const; + static string suffixed_search_path (std::string suffix, bool data); + static string control_protocol_path (); static string template_path (); static string template_dir (); static void get_template_list (list&); - static string peak_path_from_audio_path (string); - static string old_peak_path_from_audio_path (string); + static string change_audio_path_by_name (string oldpath, string oldname, string newname, bool destructive); + string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive); - void process (jack_nframes_t nframes); + void process (nframes_t nframes); vector& get_passthru_buffers() { return _passthru_buffers; } vector& get_silent_buffers (uint32_t howmany); + vector& get_send_buffers () { return _send_buffers; } - DiskStream *diskstream_by_id (id_t id); - DiskStream *diskstream_by_name (string name); + void add_diskstream (boost::shared_ptr); + boost::shared_ptr diskstream_by_id (const PBD::ID& id); + boost::shared_ptr diskstream_by_name (string name); bool have_captured() const { return _have_captured; } void refill_all_diskstream_buffers (); uint32_t diskstream_buffer_size() const { return dstream_buffer_size; } + uint32_t get_next_diskstream_id() const { return n_diskstreams(); } uint32_t n_diskstreams() const; - typedef list DiskStreamList; + typedef std::list > DiskstreamList; + typedef std::list > RouteList; - Session::DiskStreamList disk_streams() const { - LockMonitor lm (diskstream_lock, __LINE__, __FILE__); - return diskstreams; /* XXX yes, force a copy */ + boost::shared_ptr get_routes() const { + return routes.reader (); } - void foreach_diskstream (void (DiskStream::*func)(void)); - template void foreach_diskstream (T *obj, void (T::*func)(DiskStream&)); - - typedef slist RouteList; - - RouteList get_routes() const { - LockMonitor rlock (route_lock, __LINE__, __FILE__); - return routes; /* XXX yes, force a copy */ - } - - uint32_t nroutes() const { return routes.size(); } + uint32_t nroutes() const { return routes.reader()->size(); } uint32_t ntracks () const; uint32_t nbusses () const; struct RoutePublicOrderSorter { - bool operator() (Route *, Route *b); + bool operator() (boost::shared_ptr, boost::shared_ptr b); }; template void foreach_route (T *obj, void (T::*func)(Route&)); - template void foreach_route (T *obj, void (T::*func)(Route*)); + template void foreach_route (T *obj, void (T::*func)(boost::shared_ptr)); template void foreach_route (T *obj, void (T::*func)(Route&, A), A arg); - Route *route_by_name (string); + boost::shared_ptr route_by_name (string); + boost::shared_ptr route_by_id (PBD::ID); + boost::shared_ptr route_by_remote_id (uint32_t id); bool route_name_unique (string) const; @@ -308,7 +309,7 @@ class Session : public sigc::trackable, public Stateful } RecordState record_status() const { - return (RecordState) atomic_read (&_record_status); + return (RecordState) g_atomic_int_get (&_record_status); } bool actively_recording () { @@ -317,14 +318,12 @@ class Session : public sigc::trackable, public Stateful bool record_enabling_legal () const; void maybe_enable_record (); - void disable_record (); + void disable_record (bool rt_context, bool force = false); void step_back_from_record (); - sigc::signal going_away; - /* Proxy signal for region hidden changes */ - sigc::signal RegionHiddenChange; + sigc::signal > RegionHiddenChange; /* Emitted when all i/o connections are complete */ @@ -332,43 +331,48 @@ class Session : public sigc::trackable, public Stateful /* Record status signals */ - sigc::signal RecordEnabled; - sigc::signal RecordDisabled; + sigc::signal RecordStateChanged; /* Transport mechanism signals */ sigc::signal TransportStateChange; /* generic */ - sigc::signal PositionChanged; /* sent after any non-sequential motion */ + sigc::signal PositionChanged; /* sent after any non-sequential motion */ sigc::signal DurationChanged; sigc::signal HaltOnXrun; - sigc::signal RouteAdded; - sigc::signal DiskStreamAdded; + sigc::signal RouteAdded; void request_roll (); - void request_bounded_roll (jack_nframes_t start, jack_nframes_t end); + void request_bounded_roll (nframes_t start, nframes_t end); void request_stop (bool abort = false); - void request_locate (jack_nframes_t frame, bool with_roll = false); - void request_auto_loop (bool yn); - jack_nframes_t last_transport_start() const { return _last_roll_location; } + void request_locate (nframes_t frame, bool with_roll = false); + void request_play_loop (bool yn); + nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} - void goto_start () { request_locate (0, false); } + void goto_start () { request_locate (start_location->start(), false); } + void set_session_start (nframes_t start) { start_location->set_start(start); } + void set_session_end (nframes_t end) { end_location->set_start(end); _end_location_is_free = false; } void use_rf_shuttle_speed (); void request_transport_speed (float speed); - void request_overwrite_buffer (DiskStream*); - void request_diskstream_speed (DiskStream&, float speed); + void request_overwrite_buffer (Diskstream*); + void request_diskstream_speed (Diskstream&, float speed); void request_input_change_handling (); + bool locate_pending() const { return static_cast(post_transport_work&PostTransportLocate); } + bool transport_locked () const; + int wipe (); - int wipe_diskstream (DiskStream *); - int remove_region_from_region_list (Region&); + int remove_region_from_region_list (boost::shared_ptr); + + nframes_t get_maximum_extent () const; + nframes_t current_end_frame() const { return end_location->start(); } + nframes_t current_start_frame() const { return start_location->start(); } + nframes_t frame_rate() const { return _current_frame_rate; } + nframes_t frames_per_hour() const { return _frames_per_hour; } - jack_nframes_t current_end_frame() const { return end_location->start(); } - jack_nframes_t frame_rate() const { return _current_frame_rate; } double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } - jack_nframes_t frames_per_hour() const { return _frames_per_hour; } - jack_nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } + nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } /* Locations */ @@ -381,96 +385,22 @@ class Session : public sigc::trackable, public Stateful void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); + void reset_input_monitor_state (); - enum ControlType { - AutoPlay, - AutoLoop, - AutoReturn, - AutoInput, - PunchIn, - PunchOut, - SendMTC, - MMCControl, - Live, - RecordingPlugins, - CrossFadesActive, - SendMMC, - SlaveType, - Clicking, - EditingMode, - PlayRange, - AlignChoice, - SeamlessLoop, - MidiFeedback, - MidiControl - }; - - sigc::signal ControlChanged; - - void set_auto_play (bool yn); - void set_auto_return (bool yn); - void set_auto_input (bool yn); - void set_input_auto_connect (bool yn); - void set_output_auto_connect (AutoConnectOption); - void set_punch_in (bool yn); - void set_punch_out (bool yn); - void set_send_mtc (bool yn); - void set_send_mmc (bool yn); - void set_mmc_control (bool yn); - void set_midi_feedback (bool yn); - void set_midi_control (bool yn); - void set_recording_plugins (bool yn); - void set_crossfades_active (bool yn); - void set_seamless_loop (bool yn); - - bool get_auto_play () const { return auto_play; } - bool get_auto_input () const { return auto_input; } - bool get_auto_loop () const { return auto_loop; } - bool get_seamless_loop () const { return seamless_loop; } - bool get_punch_in () const { return punch_in; } - bool get_punch_out () const { return punch_out; } - bool get_all_safe () const { return all_safe; } - bool get_auto_return () const { return auto_return; } - bool get_send_mtc () const; - bool get_send_mmc () const; - bool get_mmc_control () const; - bool get_midi_feedback () const; - bool get_midi_control () const; - bool get_recording_plugins () const { return recording_plugins; } - bool get_crossfades_active () const { return crossfades_active; } - - AutoConnectOption get_input_auto_connect () const { return input_auto_connect; } - AutoConnectOption get_output_auto_connect () const { return output_auto_connect; } - - enum LayerModel { - LaterHigher, - MoveAddHigher, - AddHigher - }; - - void set_layer_model (LayerModel); - LayerModel get_layer_model () const { return layer_model; } - - sigc::signal LayerModelChanged; - - void set_xfade_model (CrossfadeModel); - CrossfadeModel get_xfade_model () const { return xfade_model; } - - void set_align_style (AlignStyle); - AlignStyle get_align_style () const { return align_style; } - - void add_event (jack_nframes_t action_frame, Event::Type type, jack_nframes_t target_frame = 0); - void remove_event (jack_nframes_t frame, Event::Type type); + void add_event (nframes_t action_frame, Event::Type type, nframes_t target_frame = 0); + void remove_event (nframes_t frame, Event::Type type); void clear_events (Event::Type type); - jack_nframes_t get_block_size() const { return current_block_size; } - jack_nframes_t worst_output_latency () const { return _worst_output_latency; } - jack_nframes_t worst_input_latency () const { return _worst_input_latency; } - jack_nframes_t worst_track_latency () const { return _worst_track_latency; } + nframes_t get_block_size() const { return current_block_size; } + nframes_t worst_output_latency () const { return _worst_output_latency; } + nframes_t worst_input_latency () const { return _worst_input_latency; } + nframes_t worst_track_latency () const { return _worst_track_latency; } int save_state (string snapshot_name, bool pending = false); int restore_state (string snapshot_name); int save_template (string template_name); + int save_history (string snapshot_name = ""); + int restore_history (string snapshot_name); static int rename_template (string old_name, string new_name); @@ -483,14 +413,11 @@ class Session : public sigc::trackable, public Stateful static vector* possible_states(string path); XMLNode& get_state(); - int set_state(const XMLNode& node); + int set_state(const XMLNode& node); // not idempotent XMLNode& get_template(); - + void add_instant_xml (XMLNode&, const std::string& dir); - void swap_configuration(Configuration** new_config); - void copy_configuration(Configuration* new_config); - enum StateOfTheState { Clean = 0x0, Dirty = 0x1, @@ -506,157 +433,155 @@ class Session : public sigc::trackable, public Stateful RouteGroup* add_edit_group (string); RouteGroup* add_mix_group (string); + void remove_edit_group (RouteGroup&); + void remove_mix_group (RouteGroup&); + RouteGroup *mix_group_by_name (string); RouteGroup *edit_group_by_name (string); sigc::signal edit_group_added; sigc::signal mix_group_added; + sigc::signal edit_group_removed; + sigc::signal mix_group_removed; - template void foreach_edit_group (T *obj, void (T::*func)(RouteGroup *)) { - list::iterator i; - for (i = edit_groups.begin(); i != edit_groups.end(); i++) { - (obj->*func)(*i); + void foreach_edit_group (sigc::slot sl) { + for (list::iterator i = edit_groups.begin(); i != edit_groups.end(); i++) { + sl (*i); } } - template void foreach_mix_group (T *obj, void (T::*func)(RouteGroup *)) { - list::iterator i; - for (i = mix_groups.begin(); i != mix_groups.end(); i++) { - (obj->*func)(*i); + void foreach_mix_group (sigc::slot sl) { + for (list::iterator i = mix_groups.begin(); i != mix_groups.end(); i++) { + sl (*i); } } /* fundamental operations. duh. */ + std::list > new_audio_track (int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1); + RouteList new_audio_route (int input_channels, int output_channels, uint32_t how_many); - AudioTrack *new_audio_track (int input_channels, int output_channels); + void remove_route (boost::shared_ptr); - Route *new_audio_route (int input_channels, int output_channels); - - void remove_route (Route&); - void resort_routes (void *src); + void resort_routes (); + void resort_routes_using (boost::shared_ptr); AudioEngine &engine() { return _engine; }; - /* configuration. there should really be accessors/mutators - for these - */ - - float meter_hold () { return _meter_hold; } - void set_meter_hold (float); - sigc::signal MeterHoldChanged; - - float meter_falloff () { return _meter_falloff; } - void set_meter_falloff (float); - sigc::signal MeterFalloffChanged; - int32_t max_level; int32_t min_level; - string click_emphasis_sound; - string click_sound; - bool click_requested; - jack_nframes_t over_length_short; - jack_nframes_t over_length_long; - bool send_midi_timecode; - bool send_midi_machine_control; - float shuttle_speed_factor; - float shuttle_speed_threshold; - float rf_speed; - float smpte_frames_per_second; - bool smpte_drop_frames; - AnyTime preroll; - AnyTime postroll; - + /* Time */ - jack_nframes_t transport_frame () const {return _transport_frame; } - jack_nframes_t audible_frame () const; + nframes_t transport_frame () const {return _transport_frame; } + nframes_t audible_frame () const; + + enum SmpteFormat { + smpte_23976, + smpte_24, + smpte_24976, + smpte_25, + smpte_2997, + smpte_2997drop, + smpte_30, + smpte_30drop, + smpte_5994, + smpte_60, + }; + + enum PullupFormat { + pullup_Plus4Plus1, + pullup_Plus4, + pullup_Plus4Minus1, + pullup_Plus1, + pullup_None, + pullup_Minus1, + pullup_Minus4Plus1, + pullup_Minus4, + pullup_Minus4Minus1, + }; int set_smpte_type (float fps, bool drop_frames); - void bbt_time (jack_nframes_t when, BBT_Time&); - - ARDOUR::smpte_wrap_t smpte_increment( SMPTE_Time& smpte ) const; - ARDOUR::smpte_wrap_t smpte_decrement( SMPTE_Time& smpte ) const; - ARDOUR::smpte_wrap_t smpte_increment_subframes( SMPTE_Time& smpte ) const; - ARDOUR::smpte_wrap_t smpte_decrement_subframes( SMPTE_Time& smpte ) const; - ARDOUR::smpte_wrap_t smpte_increment_seconds( SMPTE_Time& smpte ) const; - ARDOUR::smpte_wrap_t smpte_increment_minutes( SMPTE_Time& smpte ) const; - ARDOUR::smpte_wrap_t smpte_increment_hours( SMPTE_Time& smpte ) const; - void smpte_frames_floor( SMPTE_Time& smpte ) const; - void smpte_seconds_floor( SMPTE_Time& smpte ) const; - void smpte_minutes_floor( SMPTE_Time& smpte ) const; - void smpte_hours_floor( SMPTE_Time& smpte ) const; - void smpte_to_sample( SMPTE_Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes ) const; - void sample_to_smpte( jack_nframes_t sample, SMPTE_Time& smpte, bool use_offset, bool use_subframes ) const; - void smpte_time (SMPTE_Time &); - void smpte_time (jack_nframes_t when, SMPTE_Time&); - void smpte_time_subframes (jack_nframes_t when, SMPTE_Time&); - - void smpte_duration (jack_nframes_t, SMPTE_Time&) const; - void smpte_duration_string (char *, jack_nframes_t) const; - - void set_smpte_offset (jack_nframes_t); - jack_nframes_t smpte_offset () const { return _smpte_offset; } + void sync_time_vars(); + + void bbt_time (nframes_t when, BBT_Time&); + void smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const; + void sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const; + void smpte_time (SMPTE::Time &); + void smpte_time (nframes_t when, SMPTE::Time&); + void smpte_time_subframes (nframes_t when, SMPTE::Time&); + + void smpte_duration (nframes_t, SMPTE::Time&) const; + void smpte_duration_string (char *, nframes_t) const; + + void set_smpte_offset (nframes_t); + nframes_t smpte_offset () const { return _smpte_offset; } void set_smpte_offset_negative (bool); bool smpte_offset_negative () const { return _smpte_offset_negative; } - jack_nframes_t convert_to_frames_at (jack_nframes_t position, AnyTime&); + nframes_t convert_to_frames_at (nframes_t position, AnyTime&); + + static sigc::signal StartTimeChanged; + static sigc::signal EndTimeChanged; + static sigc::signal SMPTEOffsetChanged; - sigc::signal SMPTEOffsetChanged; - sigc::signal SMPTETypeChanged; + void request_slave_source (SlaveSource); + bool synced_to_jack() const { return Config->get_slave_source() == JACK; } - void request_slave_source (SlaveSource, jack_nframes_t pos = 0); - SlaveSource slave_source() const { return _slave_type; } - bool synced_to_jack() const { return _slave_type == JACK; } float transport_speed() const { return _transport_speed; } bool transport_stopped() const { return _transport_speed == 0.0f; } bool transport_rolling() const { return _transport_speed != 0.0f; } - int jack_slave_sync (jack_nframes_t); + int jack_slave_sync (nframes_t); TempoMap& tempo_map() { return *_tempo_map; } /* region info */ - sigc::signal AudioRegionAdded; - sigc::signal AudioRegionRemoved; + sigc::signal > AudioRegionAdded; + sigc::signal > AudioRegionRemoved; int region_name (string& result, string base = string(""), bool newlevel = false) const; string new_region_name (string); string path_from_region_name (string name, string identifier); - AudioRegion* find_whole_file_parent (AudioRegion&); - void find_equivalent_playlist_regions (AudioRegion&, std::vector& result); + boost::shared_ptr find_whole_file_parent (boost::shared_ptr); + void find_equivalent_playlist_regions (boost::shared_ptr, std::vector >& result); - AudioRegion *XMLRegionFactory (const XMLNode&, bool full); + boost::shared_ptr XMLRegionFactory (const XMLNode&, bool full); - template void foreach_audio_region (T *obj, void (T::*func)(AudioRegion *)); + template void foreach_audio_region (T *obj, void (T::*func)(boost::shared_ptr)); /* source management */ struct import_status : public InterThreadInfo { - string doing_what; - - /* control info */ - bool multichan; - bool sample_convert; - volatile bool freeze; - string pathname; + string doing_what; + + /* control info */ + bool multichan; + bool sample_convert; + volatile bool freeze; + string pathname; + + /* result */ + std::vector > new_regions; + }; int import_audiofile (import_status&); bool sample_rate_convert (import_status&, string infile, string& outfile); string build_tmp_convert_name (string file); - Session::SlaveSource post_export_slave; - jack_nframes_t post_export_position; + SlaveSource post_export_slave; + nframes_t post_export_position; int start_audio_export (ARDOUR::AudioExportSpecification&); int stop_audio_export (ARDOUR::AudioExportSpecification&); - void add_source (Source *); - int remove_file_source (FileSource&); + void add_source (boost::shared_ptr); + void remove_source (boost::weak_ptr); + int cleanup_audio_file_source (boost::shared_ptr); struct cleanup_report { vector paths; @@ -666,8 +591,8 @@ class Session : public sigc::trackable, public Stateful int cleanup_sources (cleanup_report&); int cleanup_trash_sources (cleanup_report&); - int destroy_region (Region*); - int destroy_regions (list); + int destroy_region (boost::shared_ptr); + int destroy_regions (std::list >); int remove_last_capture (); @@ -685,11 +610,12 @@ class Session : public sigc::trackable, public Stateful static sigc::signal AskAboutPendingState; - sigc::signal SourceAdded; - sigc::signal SourceRemoved; + sigc::signal > SourceAdded; + sigc::signal > SourceRemoved; - FileSource *create_file_source (ARDOUR::DiskStream&, int32_t chan); - Source *get_source (ARDOUR::id_t); + boost::shared_ptr create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive); + + boost::shared_ptr source_by_id (const PBD::ID&); /* playlist management */ @@ -698,8 +624,6 @@ class Session : public sigc::trackable, public Stateful sigc::signal PlaylistAdded; sigc::signal PlaylistRemoved; - Playlist *get_playlist (string name); - uint32_t n_playlists() const; template void foreach_playlist (T *obj, void (T::*func)(Playlist *)); @@ -714,6 +638,10 @@ class Session : public sigc::trackable, public Stateful sigc::signal NamedSelectionAdded; sigc::signal NamedSelectionRemoved; + /* Curves and AutomationLists (TODO when they go away) */ + void add_curve(Curve*); + void add_automation_list(AutomationList*); + /* fade curves */ float get_default_fade_length () const { return default_fade_msecs; } @@ -722,9 +650,9 @@ class Session : public sigc::trackable, public Stateful /* auditioning */ - Auditioner& the_auditioner() { return *auditioner; } + boost::shared_ptr the_auditioner() { return auditioner; } void audition_playlist (); - void audition_region (AudioRegion&); + void audition_region (boost::shared_ptr); void cancel_audition (); bool is_auditioning () const; @@ -732,25 +660,14 @@ class Session : public sigc::trackable, public Stateful /* flattening stuff */ - int write_one_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt, bool overwrite, vector&, - InterThreadInfo& wot); + int write_one_audio_track (AudioTrack&, nframes_t start, nframes_t cnt, bool overwrite, vector >&, + InterThreadInfo& wot); int freeze (InterThreadInfo&); /* session-wide solo/mute/rec-enable */ - - enum SoloModel { - InverseMute, - SoloBus - }; bool soloing() const { return currently_soloing; } - SoloModel solo_model() const { return _solo_model; } - void set_solo_model (SoloModel); - - bool solo_latched() const { return _solo_latched; } - void set_solo_latched (bool yn); - void set_all_solo (bool); void set_all_mute (bool); @@ -761,8 +678,8 @@ class Session : public sigc::trackable, public Stateful /* control/master out */ - IO* control_out() const { return _control_out; } - IO* master_out() const { return _master_out; } + boost::shared_ptr control_out() const { return _control_out; } + boost::shared_ptr master_out() const { return _master_out; } /* insert/send management */ @@ -775,7 +692,7 @@ class Session : public sigc::trackable, public Stateful /* s/w "RAID" management */ - jack_nframes_t available_capture_duration(); + nframes_t available_capture_duration(); /* I/O Connections */ @@ -788,7 +705,7 @@ class Session : public sigc::trackable, public Stateful sigc::signal ConnectionRemoved; /* MIDI */ - + int set_mtc_port (string port_tag); int set_mmc_port (string port_tag); int set_midi_port (string port_tag); @@ -807,16 +724,15 @@ class Session : public sigc::trackable, public Stateful bool get_trace_midi_output(MIDI::Port *port = 0); void send_midi_message (MIDI::Port * port, MIDI::eventType ev, MIDI::channel_t, MIDI::EventTwoBytes); - void send_all_midi_feedback (); void deliver_midi (MIDI::Port*, MIDI::byte*, int32_t size); /* Scrubbing */ - void start_scrub (jack_nframes_t where); + void start_scrub (nframes_t where); void stop_scrub (); void set_scrub_speed (float); - jack_nframes_t scrub_buffer_size() const; + nframes_t scrub_buffer_size() const; sigc::signal ScrubReady; /* History (for editors, mixers, UIs etc.) */ @@ -833,59 +749,89 @@ class Session : public sigc::trackable, public Stateful string next_undo() const { return history.next_undo(); } string next_redo() const { return history.next_redo(); } - void begin_reversible_command (string cmd_name, UndoAction *private_undo = 0); - void commit_reversible_command (UndoAction* private_redo = 0); + void begin_reversible_command (string cmd_name); + void commit_reversible_command (Command* cmd = 0); - void add_undo (const UndoAction& ua) { - current_cmd.add_undo (ua); - } - void add_redo (const UndoAction& ua) { - current_cmd.add_redo (ua); + void add_command (Command *const cmd) { + current_trans->add_command (cmd); } - void add_redo_no_execute (const UndoAction& ua) { - current_cmd.add_redo_no_execute (ua); - } - - UndoAction global_solo_memento (void *src); - UndoAction global_mute_memento (void *src); - UndoAction global_record_enable_memento (void *src); - UndoAction global_metering_memento (void *src); - - /* edit mode */ - void set_edit_mode (EditMode); - EditMode get_edit_mode () const { return _edit_mode; } + std::map registry; + + // these commands are implemented in libs/ardour/session_command.cc + Command *memento_command_factory(XMLNode *n); + void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway *); + + class GlobalSoloStateCommand : public Command + { + GlobalRouteBooleanState before, after; + Session &sess; + void *src; + public: + GlobalSoloStateCommand(Session &, void *src); + void operator()(); + void undo(); + XMLNode &get_state(); + void mark(); + }; + + class GlobalMuteStateCommand : public Command + { + GlobalRouteBooleanState before, after; + Session &sess; + void *src; + public: + GlobalMuteStateCommand(Session &, void *src); + void operator()(); + void undo(); + XMLNode &get_state(); + void mark(); + }; + + class GlobalRecordEnableStateCommand : public Command + { + GlobalRouteBooleanState before, after; + Session &sess; + void *src; + public: + GlobalRecordEnableStateCommand(Session &, void *src); + void operator()(); + void undo(); + XMLNode &get_state(); + void mark(); + }; + + class GlobalMeteringStateCommand : public Command + { + GlobalRouteMeterState before, after; + Session &sess; + void *src; + public: + GlobalMeteringStateCommand(Session &, void *src); + void operator()(); + void undo(); + XMLNode &get_state(); + void mark(); + }; /* clicking */ - IO& click_io() { return *_click_io; } - void set_clicking (bool yn); - bool get_clicking() const; - - void set_click_sound (string path); - void set_click_emphasis_sound (string path); + boost::shared_ptr click_io() { return _click_io; } /* tempo FX */ struct TimeStretchRequest { - ARDOUR::AudioRegion* region; + boost::shared_ptr region; float fraction; /* session: read ; GUI: write */ float progress; /* session: write ; GUI: read */ bool running; /* read/write */ bool quick_seek; /* GUI: write */ bool antialias; /* GUI: write */ - TimeStretchRequest () : region (0) {} + TimeStretchRequest () {} }; - AudioRegion* tempoize_region (TimeStretchRequest&); - - string raid_path() const; - void set_raid_path(string); - - /* need to call this whenever we change native file formats */ - - void reset_native_file_format(); + boost::shared_ptr tempoize_region (TimeStretchRequest&); /* disk, buffer loads */ @@ -926,6 +872,13 @@ class Session : public sigc::trackable, public Stateful gain_t* gain_automation_buffer () const { return _gain_automation_buffer; } pan_t** pan_automation_buffer() const { return _pan_automation_buffer; } + /* buffers for conversion */ + enum RunContext { + ButlerContext = 0, + TransportContext, + ExportContext + }; + /* VST support */ static long vst_callback (AEffect* effect, @@ -935,23 +888,32 @@ class Session : public sigc::trackable, public Stateful void* ptr, float opt); - typedef float (*compute_peak_t) (Sample *, jack_nframes_t, float); - typedef void (*apply_gain_to_buffer_t) (Sample *, jack_nframes_t, float); - typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, jack_nframes_t, float); - typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, jack_nframes_t); + typedef float (*compute_peak_t) (Sample *, nframes_t, float); + typedef void (*apply_gain_to_buffer_t) (Sample *, nframes_t, float); + typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, nframes_t, float); + typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, nframes_t); static compute_peak_t compute_peak; static apply_gain_to_buffer_t apply_gain_to_buffer; static mix_buffers_with_gain_t mix_buffers_with_gain; static mix_buffers_no_gain_t mix_buffers_no_gain; - + + static sigc::signal SendFeedback; + + /* Controllables */ + + PBD::Controllable* controllable_by_id (const PBD::ID&); + + void add_controllable (PBD::Controllable*); + void remove_controllable (PBD::Controllable*); + protected: friend class AudioEngine; - void set_block_size (jack_nframes_t nframes); - void set_frame_rate (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); + void set_frame_rate (nframes_t nframes); protected: - friend class DiskStream; + friend class Diskstream; void stop_butler (); void wait_till_butler_finished(); @@ -961,7 +923,7 @@ class Session : public sigc::trackable, public Stateful void update_latency_compensation (bool, bool); private: - int create (bool& new_session, string* mix_template, jack_nframes_t initial_length); + int create (bool& new_session, string* mix_template, nframes_t initial_length); static const char* _template_suffix; static const char* _statefile_suffix; @@ -980,50 +942,53 @@ class Session : public sigc::trackable, public Stateful maximise cache hits */ - typedef void (Session::*process_function_type)(jack_nframes_t); + typedef void (Session::*process_function_type)(nframes_t); AudioEngine &_engine; - atomic_t processing_prohibited; + mutable gint processing_prohibited; process_function_type process_function; process_function_type last_process_function; - jack_nframes_t _current_frame_rate; + bool waiting_for_sync_offset; + nframes_t _base_frame_rate; + nframes_t _current_frame_rate; //this includes video pullup offset int transport_sub_state; - atomic_t _record_status; - jack_nframes_t _transport_frame; + mutable gint _record_status; + nframes_t _transport_frame; Location* end_location; + Location* start_location; Slave *_slave; - SlaveSource _slave_type; - float _transport_speed; + volatile float _transport_speed; volatile float _desired_transport_speed; float _last_transport_speed; - jack_nframes_t _last_slave_transport_frame; - jack_nframes_t maximum_output_latency; - jack_nframes_t last_stop_frame; + nframes_t _last_slave_transport_frame; + nframes_t maximum_output_latency; + nframes_t last_stop_frame; vector _passthru_buffers; vector _silent_buffers; - jack_nframes_t current_block_size; - jack_nframes_t _worst_output_latency; - jack_nframes_t _worst_input_latency; - jack_nframes_t _worst_track_latency; + vector _send_buffers; + nframes_t current_block_size; + nframes_t _worst_output_latency; + nframes_t _worst_input_latency; + nframes_t _worst_track_latency; bool _have_captured; float _meter_hold; float _meter_falloff; bool _end_location_is_free; - void set_worst_io_latencies (bool take_lock); + void set_worst_io_latencies (); void set_worst_io_latencies_x (IOChange asifwecare, void *ignored) { - set_worst_io_latencies (true); + set_worst_io_latencies (); } void update_latency_compensation_proxy (void* ignored); void ensure_passthru_buffers (uint32_t howmany); - void process_scrub (jack_nframes_t); - void process_without_events (jack_nframes_t); - void process_with_events (jack_nframes_t); - void process_audition (jack_nframes_t); - int process_export (jack_nframes_t, ARDOUR::AudioExportSpecification*); + void process_scrub (nframes_t); + void process_without_events (nframes_t); + void process_with_events (nframes_t); + void process_audition (nframes_t); + int process_export (nframes_t, ARDOUR::AudioExportSpecification*); /* slave tracking */ @@ -1041,24 +1006,25 @@ class Session : public sigc::trackable, public Stateful }; SlaveState slave_state; - jack_nframes_t slave_wait_end; + nframes_t slave_wait_end; void reset_slave_state (); - bool follow_slave (jack_nframes_t, jack_nframes_t); + bool follow_slave (nframes_t, nframes_t); + void set_slave_source (SlaveSource); bool _exporting; int prepare_to_export (ARDOUR::AudioExportSpecification&); void prepare_diskstreams (); - void commit_diskstreams (jack_nframes_t, bool& session_requires_butler); - int process_routes (jack_nframes_t, jack_nframes_t); - int silent_process_routes (jack_nframes_t, jack_nframes_t); + void commit_diskstreams (nframes_t, bool& session_requires_butler); + int process_routes (nframes_t, nframes_t); + int silent_process_routes (nframes_t, nframes_t); bool get_rec_monitors_input () { if (actively_recording()) { return true; } else { - if (auto_input) { + if (Config->get_auto_input()) { return false; } else { return true; @@ -1078,7 +1044,7 @@ class Session : public sigc::trackable, public Stateful } } - bool maybe_stop (jack_nframes_t limit) { + bool maybe_stop (nframes_t limit) { if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) { stop_transport (); return true; @@ -1086,6 +1052,8 @@ class Session : public sigc::trackable, public Stateful return false; } + bool maybe_sync_start (nframes_t&, nframes_t&); + void check_declick_out (); MIDI::MachineControl* mmc; @@ -1094,28 +1062,13 @@ class Session : public sigc::trackable, public Stateful MIDI::Port* _midi_port; string _path; string _name; - bool recording_plugins; - - /* toggles */ - - bool auto_play; - bool punch_in; - bool punch_out; - bool auto_loop; - bool seamless_loop; - bool loop_changing; - jack_nframes_t last_loopend; - bool auto_input; - bool crossfades_active; - bool all_safe; - bool auto_return; - bool monitor_in; - bool send_mtc; - bool send_mmc; - bool mmc_control; - bool midi_feedback; - bool midi_control; - + bool session_send_mmc; + bool session_send_mtc; + bool session_midi_feedback; + bool play_loop; + bool loop_changing; + nframes_t last_loopend; + RingBuffer pending_events; void hookup_io (); @@ -1133,24 +1086,25 @@ class Session : public sigc::trackable, public Stateful int load_options (const XMLNode&); XMLNode& get_options () const; int load_state (string snapshot_name); + bool save_config_options_predicate (ConfigVariableBase::Owner owner) const; - jack_nframes_t _last_roll_location; - jack_nframes_t _last_record_location; + nframes_t _last_roll_location; + nframes_t _last_record_location; bool pending_locate_roll; - jack_nframes_t pending_locate_frame; + nframes_t pending_locate_frame; bool pending_locate_flush; bool pending_abort; bool pending_auto_loop; - Sample* butler_mixdown_buffer; - float* butler_gain_buffer; - pthread_t butler_thread; - PBD::NonBlockingLock butler_request_lock; - pthread_cond_t butler_paused; - bool butler_should_run; - atomic_t butler_should_do_transport_work; - int butler_request_pipe[2]; + Sample* butler_mixdown_buffer; + float* butler_gain_buffer; + pthread_t butler_thread; + Glib::Mutex butler_request_lock; + Glib::Cond butler_paused; + bool butler_should_run; + mutable gint butler_should_do_transport_work; + int butler_request_pipe[2]; struct ButlerRequest { enum Type { @@ -1202,7 +1156,7 @@ class Session : public sigc::trackable, public Stateful uint32_t rf_scale; void set_rf_speed (float speed); - void reset_rf_scale (jack_nframes_t frames_moved); + void reset_rf_scale (nframes_t frames_moved); Locations _locations; void locations_changed (); @@ -1237,7 +1191,7 @@ class Session : public sigc::trackable, public Stateful void dump_events () const; void queue_event (Event *ev); void merge_event (Event*); - void replace_event (Event::Type, jack_nframes_t action_frame, jack_nframes_t target = 0); + void replace_event (Event::Type, nframes_t action_frame, nframes_t target = 0); bool _replace_event (Event*); bool _remove_event (Event *); void _clear_event_type (Event::Type); @@ -1278,7 +1232,7 @@ class Session : public sigc::trackable, public Stateful /* MIDI Machine Control */ - void deliver_mmc (MIDI::MachineControl::Command, jack_nframes_t); + void deliver_mmc (MIDI::MachineControl::Command, nframes_t); void deliver_midi_message (MIDI::Port * port, MIDI::eventType ev, MIDI::channel_t, MIDI::EventTwoBytes); void deliver_data (MIDI::Port* port, MIDI::byte*, int32_t size); @@ -1314,14 +1268,14 @@ class Session : public sigc::trackable, public Stateful MIDI::byte mtc_msg[16]; MIDI::byte mtc_smpte_bits; /* encoding of SMTPE type for MTC */ MIDI::byte midi_msg[16]; - jack_nframes_t outbound_mtc_smpte_frame; - SMPTE_Time transmitting_smpte_time; + nframes_t outbound_mtc_smpte_frame; + SMPTE::Time transmitting_smpte_time; int next_quarter_frame_to_send; double _frames_per_smpte_frame; /* has to be floating point because of drop frame */ - jack_nframes_t _frames_per_hour; - jack_nframes_t _smpte_frames_per_hour; - jack_nframes_t _smpte_offset; + nframes_t _frames_per_hour; + nframes_t _smpte_frames_per_hour; + nframes_t _smpte_offset; bool _smpte_offset_negative; /* cache the most-recently requested time conversions. @@ -1330,8 +1284,8 @@ class Session : public sigc::trackable, public Stateful */ bool last_smpte_valid; - jack_nframes_t last_smpte_when; - SMPTE_Time last_smpte; + nframes_t last_smpte_when; + SMPTE::Time last_smpte; int send_full_time_code (); int send_midi_time_code (); @@ -1339,38 +1293,13 @@ class Session : public sigc::trackable, public Stateful void send_full_time_code_in_another_thread (); void send_midi_time_code_in_another_thread (); void send_time_code_in_another_thread (bool full); - void send_mmc_in_another_thread (MIDI::MachineControl::Command, jack_nframes_t frame = 0); - - /* Feedback */ + void send_mmc_in_another_thread (MIDI::MachineControl::Command, nframes_t frame = 0); - typedef sigc::slot FeedbackFunctionPtr; - static void* _feedback_thread_work (void *); - void* feedback_thread_work (); - int feedback_generic_midi_function (); - std::list feedback_functions; - int active_feedback; - int feedback_request_pipe[2]; - pthread_t feedback_thread; - - struct FeedbackRequest { - enum Type { - Start, - Stop, - Quit - }; - }; - - int init_feedback(); - int start_feedback (); - int stop_feedback (); - void terminate_feedback (); - int poke_feedback (FeedbackRequest::Type); - - jack_nframes_t adjust_apparent_position (jack_nframes_t frames); + nframes_t adjust_apparent_position (nframes_t frames); void reset_record_status (); - int no_roll (jack_nframes_t nframes, jack_nframes_t offset); + int no_roll (nframes_t nframes, nframes_t offset); bool non_realtime_work_pending() const { return static_cast(post_transport_work); } bool process_can_proceed() const { return !(post_transport_work & ProcessCannotProceedMask); } @@ -1389,7 +1318,7 @@ class Session : public sigc::trackable, public Stateful Type type; MIDI::MachineControl::Command mmc_cmd; - jack_nframes_t locate_frame; + nframes_t locate_frame; // for SendMessage type @@ -1419,10 +1348,10 @@ class Session : public sigc::trackable, public Stateful static MultiAllocSingleReleasePool pool; }; - PBD::Lock midi_lock; + Glib::Mutex midi_lock; pthread_t midi_thread; int midi_request_pipe[2]; - atomic_t butler_active; + mutable gint butler_active; RingBuffer midi_requests; int start_midi_thread (); @@ -1435,13 +1364,13 @@ class Session : public sigc::trackable, public Stateful bool waiting_to_start; - void set_auto_loop (bool yn); - void overwrite_some_buffers (DiskStream*); + void set_play_loop (bool yn); + void overwrite_some_buffers (Diskstream*); void flush_all_redirects (); - void locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); - void start_locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); - void force_locate (jack_nframes_t frame, bool with_roll = false); - void set_diskstream_speed (DiskStream*, float speed); + void locate (nframes_t, bool with_roll, bool with_flush, bool with_loop=false); + void start_locate (nframes_t, bool with_roll, bool with_flush, bool with_loop=false); + void force_locate (nframes_t frame, bool with_roll = false); + void set_diskstream_speed (Diskstream*, float speed); void set_transport_speed (float speed, bool abort = false); void stop_transport (bool abort = false); void start_transport (); @@ -1472,30 +1401,28 @@ class Session : public sigc::trackable, public Stateful /* disk-streams */ - DiskStreamList diskstreams; - mutable PBD::Lock diskstream_lock; + SerializedRCUManager diskstreams; + uint32_t dstream_buffer_size; - void add_diskstream (DiskStream*); int load_diskstreams (const XMLNode&); /* routes stuff */ - RouteList routes; - mutable PBD::NonBlockingLock route_lock; - void add_route (Route*); + SerializedRCUManager routes; + + void add_routes (RouteList&, bool save = true); + uint32_t destructive_index; int load_routes (const XMLNode&); - Route* XMLRouteFactory (const XMLNode&); + boost::shared_ptr XMLRouteFactory (const XMLNode&); /* mixer stuff */ - bool _solo_latched; - SoloModel _solo_model; bool solo_update_disabled; bool currently_soloing; void route_mute_changed (void *src); - void route_solo_changed (void *src, Route *); + void route_solo_changed (void *src, boost::weak_ptr); void catch_up_on_solo (); void update_route_solo_state (); void modify_solo_mute (bool, bool); @@ -1503,34 +1430,31 @@ class Session : public sigc::trackable, public Stateful /* REGION MANAGEMENT */ - mutable PBD::Lock region_lock; - typedef map AudioRegionList; + mutable Glib::Mutex region_lock; + typedef map > AudioRegionList; AudioRegionList audio_regions; - void region_renamed (Region *); - void region_changed (Change, Region *); - void add_region (Region *); - void remove_region (Region *); + void add_region (boost::shared_ptr); + void region_changed (Change, boost::weak_ptr); + void remove_region (boost::weak_ptr); int load_regions (const XMLNode& node); /* SOURCES */ - mutable PBD::Lock source_lock; - typedef std::map SourceList; + mutable Glib::Mutex audio_source_lock; + typedef std::map > AudioSourceList; - SourceList sources; + AudioSourceList audio_sources; int load_sources (const XMLNode& node); XMLNode& get_sources_as_xml (); - void remove_source (Source *); - - Source *XMLSourceFactory (const XMLNode&); + boost::shared_ptr XMLSourceFactory (const XMLNode&); /* PLAYLISTS */ - mutable PBD::Lock playlist_lock; + mutable Glib::Mutex playlist_lock; typedef set PlaylistList; PlaylistList playlists; PlaylistList unused_playlists; @@ -1544,11 +1468,11 @@ class Session : public sigc::trackable, public Stateful Playlist *XMLPlaylistFactory (const XMLNode&); void playlist_length_changed (Playlist *); - void diskstream_playlist_changed (DiskStream *); + void diskstream_playlist_changed (boost::shared_ptr); /* NAMED SELECTIONS */ - mutable PBD::Lock named_selection_lock; + mutable Glib::Mutex named_selection_lock; typedef set NamedSelectionList; NamedSelectionList named_selections; @@ -1557,6 +1481,10 @@ class Session : public sigc::trackable, public Stateful NamedSelection *named_selection_factory (string name); NamedSelection *XMLNamedSelectionFactory (const XMLNode&); + /* CURVES and AUTOMATION LISTS */ + std::map curves; + std::map automation_lists; + /* DEFAULT FADE CURVES */ float default_fade_steepness; @@ -1564,22 +1492,22 @@ class Session : public sigc::trackable, public Stateful /* AUDITIONING */ - Auditioner *auditioner; - void set_audition (AudioRegion*); + boost::shared_ptr auditioner; + void set_audition (boost::shared_ptr); void non_realtime_set_audition (); - AudioRegion *pending_audition_region; + boost::shared_ptr pending_audition_region; /* EXPORT */ /* FLATTEN */ - int flatten_one_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt); + int flatten_one_track (AudioTrack&, nframes_t start, nframes_t cnt); /* INSERT AND SEND MANAGEMENT */ - slist _port_inserts; - slist _plugin_inserts; - slist _sends; + list _port_inserts; + list _plugin_inserts; + list _sends; uint32_t send_cnt; uint32_t insert_cnt; @@ -1608,34 +1536,34 @@ class Session : public sigc::trackable, public Stateful vector session_dirs; vector::iterator last_rr_session_dir; uint32_t _total_free_4k_blocks; - PBD::Lock space_lock; + Glib::Mutex space_lock; + static const char* old_sound_dir_name; static const char* sound_dir_name; static const char* dead_sound_dir_name; + static const char* interchange_dir_name; static const char* peak_dir_name; - string discover_best_sound_dir (); + string discover_best_sound_dir (bool destructive = false); int ensure_sound_dir (string, string&); void refresh_disk_space (); - atomic_t _playback_load; - atomic_t _capture_load; - atomic_t _playback_load_min; - atomic_t _capture_load_min; + mutable gint _playback_load; + mutable gint _capture_load; + mutable gint _playback_load_min; + mutable gint _capture_load_min; /* I/O Connections */ typedef list ConnectionList; - mutable PBD::Lock connection_lock; + mutable Glib::Mutex connection_lock; ConnectionList _connections; int load_connections (const XMLNode&); - int set_slave_source (SlaveSource, jack_nframes_t); - void reverse_diskstream_buffers (); UndoHistory history; - UndoCommand current_cmd; + UndoTransaction* current_trans; GlobalRouteBooleanState get_global_route_boolean (bool (Route::*method)(void) const); GlobalRouteMeterState get_global_route_metering (); @@ -1647,7 +1575,7 @@ class Session : public sigc::trackable, public Stateful void set_global_solo (GlobalRouteBooleanState s, void *src); void set_global_record_enable (GlobalRouteBooleanState s, void *src); - void jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int); + void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int); int jack_sync_callback (jack_transport_state_t, jack_position_t*); void record_enable_change_all (bool yn); @@ -1656,12 +1584,12 @@ class Session : public sigc::trackable, public Stateful /* click track */ struct Click { - jack_nframes_t start; - jack_nframes_t duration; - jack_nframes_t offset; + nframes_t start; + nframes_t duration; + nframes_t offset; const Sample *data; - Click (jack_nframes_t s, jack_nframes_t d, const Sample *b) + Click (nframes_t s, nframes_t d, const Sample *b) : start (s), duration (d), data (b) { offset = 0; } void *operator new(size_t ignored) { @@ -1680,27 +1608,25 @@ class Session : public sigc::trackable, public Stateful Clicks clicks; bool _clicking; - IO* _click_io; + boost::shared_ptr _click_io; Sample* click_data; Sample* click_emphasis_data; - jack_nframes_t click_length; - jack_nframes_t click_emphasis_length; + nframes_t click_length; + nframes_t click_emphasis_length; + mutable Glib::RWLock click_lock; static const Sample default_click[]; - static const jack_nframes_t default_click_length; + static const nframes_t default_click_length; static const Sample default_click_emphasis[]; - static const jack_nframes_t default_click_emphasis_length; + static const nframes_t default_click_emphasis_length; Click *get_click(); void setup_click_sounds (int which); void clear_clicks (); - void click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t offset); + void click (nframes_t start, nframes_t nframes, nframes_t offset); vector master_outs; - EditMode _edit_mode; - EditMode pending_edit_mode; - /* range playback */ list current_audio_range; @@ -1711,17 +1637,12 @@ class Session : public sigc::trackable, public Stateful /* main outs */ uint32_t main_outs; - IO* _master_out; - IO* _control_out; - - AutoConnectOption input_auto_connect; - AutoConnectOption output_auto_connect; - - AlignStyle align_style; + boost::shared_ptr _master_out; + boost::shared_ptr _control_out; gain_t* _gain_automation_buffer; pan_t** _pan_automation_buffer; - void allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force); + void allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force); uint32_t _npan_buffers; /* VST support */ @@ -1747,8 +1668,22 @@ class Session : public sigc::trackable, public Stateful LayerModel layer_model; CrossfadeModel xfade_model; + + typedef std::set Controllables; + Glib::Mutex controllables_lock; + Controllables controllables; + + void reset_native_file_format(); + bool first_file_data_format_reset; + bool first_file_header_format_reset; + + void config_changed (const char*); + + void add_control_protocol (const ControlProtocolInfo* const, XMLNode*); + XMLNode& get_control_protocol_state (); + }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_session_h__ */