X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fsession.h;h=03eccd40a32dd45ea29e3758fa94894d339090c6;hb=23e7cf10191270d70357ccf0ed9294f020c7b7ab;hp=381f9fbf4b7e83e6214c05fad0be00dd434ae270;hpb=b855e5f3220027502a3c88f189d511fe2a5a3c2b;p=ardour.git diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 381f9fbf4b..03eccd40a3 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -36,6 +36,8 @@ #include +#include + #include "pbd/error.h" #include "pbd/event_loop.h" #include "pbd/rcu.h" @@ -48,7 +50,6 @@ #include "midi++/types.h" #include "timecode/time.h" -#include "ltc/ltc.h" #include "ardour/ardour.h" #include "ardour/chan_count.h" @@ -128,6 +129,7 @@ class Route; class RouteGroup; class SMFSource; class Send; +class SceneChanger; class SessionDirectory; class SessionMetadata; class SessionPlaylists; @@ -140,7 +142,7 @@ class WindowsVSTPlugin; extern void setup_enum_writer (); -class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager +class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager { public: enum RecordState { @@ -193,13 +195,11 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu std::string peak_path (std::string) const; - std::string change_source_path_by_name (std::string oldpath, std::string oldname, std::string newname, bool destructive); - std::string peak_path_from_audio_path (std::string) const; - std::string new_audio_source_name (const std::string&, uint32_t nchans, uint32_t chan, bool destructive); - std::string new_midi_source_name (const std::string&); - std::string new_source_path_from_name (DataType type, const std::string&); + std::string new_audio_source_path (const std::string&, uint32_t nchans, uint32_t chan, bool destructive, bool take_required); + std::string new_midi_source_path (const std::string&); RouteList new_route_from_template (uint32_t how_many, const std::string& template_path, const std::string& name); + std::vector get_paths_for_new_sources (bool allow_replacing, const std::string& import_file_path, uint32_t channels); void process (pframes_t nframes); @@ -237,12 +237,13 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu return _bundles.reader (); } - struct RoutePublicOrderSorter { + struct LIBARDOUR_API RoutePublicOrderSorter { bool operator() (boost::shared_ptr, boost::shared_ptr b); }; + void set_order_hint (uint32_t order_hint) {_order_hint = order_hint;}; void notify_remote_id_change (); - void sync_order_keys (RouteSortOrderKey); + void sync_order_keys (); template void foreach_route (T *obj, void (T::*func)(Route&)); template void foreach_route (T *obj, void (T::*func)(boost::shared_ptr)); @@ -259,6 +260,10 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu bool route_name_unique (std::string) const; bool route_name_internal (std::string) const; + uint32_t track_number_decimals () const { + return _track_number_decimals; + } + bool get_record_enabled() const { return (record_status () >= Enabled); } @@ -396,13 +401,14 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu int rename (const std::string&); bool get_nsm_state () const { return _under_nsm_control; } void set_nsm_state (bool state) { _under_nsm_control = state; } + bool save_default_options (); PBD::Signal1 StateSaved; PBD::Signal0 StateReady; PBD::Signal0 SaveSession; - std::vector* possible_states() const; - static std::vector* possible_states (std::string path); + std::vector possible_states() const; + static std::vector possible_states (std::string path); XMLNode& get_state(); int set_state(const XMLNode& node, int version); // not idempotent @@ -424,6 +430,23 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu StateOfTheState state_of_the_state() const { return _state_of_the_state; } + class StateProtector { + public: + StateProtector (Session* s) : _session (s) { + g_atomic_int_inc (&s->_suspend_save); + } + ~StateProtector () { + if (g_atomic_int_dec_and_test (&_session->_suspend_save)) { + while (_session->_save_queued) { + _session->_save_queued = false; + _session->save_state (""); + } + } + } + private: + Session * _session; + }; + void add_route_group (RouteGroup *); void remove_route_group (RouteGroup&); void reorder_route_groups (std::list); @@ -502,7 +525,7 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu void timecode_time_subframes (framepos_t when, Timecode::Time&); void timecode_duration (framecnt_t, Timecode::Time&) const; - void timecode_duration_string (char *, framecnt_t) const; + void timecode_duration_string (char *, size_t len, framecnt_t) const; framecnt_t convert_to_frames (AnyTime const & position); framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration); @@ -526,8 +549,6 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu boost::shared_ptr find_whole_file_parent (boost::shared_ptr) const; - std::string path_from_region_name (DataType type, std::string name, std::string identifier); - boost::shared_ptr XMLRegionFactory (const XMLNode&, bool full); boost::shared_ptr XMLAudioRegionFactory (const XMLNode&, bool full); boost::shared_ptr XMLMidiRegionFactory (const XMLNode&, bool full); @@ -580,11 +601,12 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu boost::shared_ptr create_audio_source_for_session ( size_t, std::string const &, uint32_t, bool destructive); - boost::shared_ptr create_midi_source_for_session ( - Track*, std::string const &); + boost::shared_ptr create_midi_source_for_session (std::string const &); + boost::shared_ptr create_midi_source_by_stealing_name (boost::shared_ptr); boost::shared_ptr source_by_id (const PBD::ID&); - boost::shared_ptr source_by_path_and_channel (const std::string&, uint16_t); + boost::shared_ptr audio_source_by_path_and_channel (const std::string&, uint16_t) const; + boost::shared_ptr midi_source_by_path (const std::string&) const; uint32_t count_sources_by_origin (const std::string&); void add_playlist (boost::shared_ptr, bool unused = false); @@ -606,7 +628,8 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu boost::shared_ptr write_one_track (AudioTrack&, framepos_t start, framepos_t end, bool overwrite, std::vector >&, InterThreadInfo& wot, - boost::shared_ptr endpoint, bool include_endpoint, bool for_export); + boost::shared_ptr endpoint, + bool include_endpoint, bool for_export, bool for_freeze); int freeze_all (InterThreadInfo&); /* session-wide solo/mute/rec-enable */ @@ -754,6 +777,10 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu /* VST support */ + static int vst_current_loading_id; + static const char* vst_can_do_strings[]; + static const int vst_can_do_string_count; + static intptr_t vst_callback ( AEffect* effect, int32_t opcode, @@ -785,6 +812,10 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu return _exporting; } + bool bounce_processing() const { + return _bounce_processing_active; + } + /* this is a private enum, but setup_enum_writer() needs it, and i can't find a way to give that function friend access. sigh. @@ -863,23 +894,31 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu */ static PBD::Signal2 VersionMismatch; + SceneChanger* scene_changer() const { return _scene_changer; } + boost::shared_ptr ltc_input_port() const; boost::shared_ptr ltc_output_port() const; boost::shared_ptr ltc_input_io() { return _ltc_input; } boost::shared_ptr ltc_output_io() { return _ltc_output; } - MIDI::Port* midi_input_port () const; - MIDI::Port* midi_output_port () const; - MIDI::Port* mmc_output_port () const; - MIDI::Port* mmc_input_port () const; + MIDI::Port* midi_input_port () const; + MIDI::Port* midi_output_port () const; + MIDI::Port* mmc_output_port () const; + MIDI::Port* mmc_input_port () const; - boost::shared_ptr midi_clock_output_port () const; - boost::shared_ptr midi_clock_input_port () const; - boost::shared_ptr mtc_output_port () const; - boost::shared_ptr mtc_input_port () const; + MIDI::Port* scene_input_port () const; + MIDI::Port* scene_output_port () const; - MIDI::MachineControl& mmc() { return *_mmc; } + boost::shared_ptr scene_in () const; + boost::shared_ptr scene_out () const; + + boost::shared_ptr midi_clock_output_port () const; + boost::shared_ptr midi_clock_input_port () const; + boost::shared_ptr mtc_output_port () const; + boost::shared_ptr mtc_input_port () const; + + MIDI::MachineControl& mmc() { return *_mmc; } protected: friend class AudioEngine; @@ -914,6 +953,7 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu mutable gint processing_prohibited; process_function_type process_function; process_function_type last_process_function; + bool _bounce_processing_active; bool waiting_for_sync_offset; framecnt_t _base_frame_rate; framecnt_t _current_frame_rate; //this includes video pullup offset @@ -968,13 +1008,15 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu void process_without_events (pframes_t); void process_with_events (pframes_t); void process_audition (pframes_t); - int process_export (pframes_t); + int process_export (pframes_t); int process_export_fw (pframes_t); void block_processing() { g_atomic_int_set (&processing_prohibited, 1); } void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); } bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); } + static const framecnt_t bounce_chunk_size; + /* slave tracking */ static const int delta_accumulator_size = 25; @@ -1073,6 +1115,10 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu bool state_was_pending; StateOfTheState _state_of_the_state; + friend class StateProtector; + gint _suspend_save; /* atomic */ + volatile bool _save_queued; + void auto_save(); int load_options (const XMLNode&); int load_state (std::string snapshot_name); @@ -1257,7 +1303,7 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu int start_midi_thread (); - void set_play_loop (bool yn); + void set_play_loop (bool yn, double speed); void unset_play_loop (); void overwrite_some_buffers (Track *); void flush_all_inserts (); @@ -1320,6 +1366,11 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu ChanCount input_start = ChanCount (), ChanCount output_start = ChanCount ()); void midi_output_change_handler (IOChange change, void* /*src*/, boost::weak_ptr midi_track); + /* track numbering */ + + void reassign_track_numbers (); + uint32_t _track_number_decimals; + /* mixer stuff */ bool solo_update_disabled; @@ -1354,9 +1405,6 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu private: SourceMap sources; - public: - SourceMap get_sources() { return sources; } - private: int load_sources (const XMLNode& node); XMLNode& get_sources_as_xml (); @@ -1435,7 +1483,7 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu bool no_questions_about_missing_files; - std::string get_best_session_directory_for_new_source (); + std::string get_best_session_directory_for_new_audio (); mutable gint _playback_load; mutable gint _capture_load; @@ -1594,6 +1642,7 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu GraphEdges _current_route_graph; uint32_t next_control_id () const; + uint32_t _order_hint; bool ignore_route_processor_changes; MidiClockTicker* midi_clock; @@ -1604,18 +1653,22 @@ class LIBARDOUR_API LIBARDOUR_API Session : public PBD::StatefulDestructible, pu void reconnect_ltc_input (); void reconnect_ltc_output (); - /* persistent, non-track related MIDI ports */ - MidiPortManager* _midi_ports; - MIDI::MachineControl* _mmc; - - void setup_ltc (); - void setup_click (); - void setup_click_state (const XMLNode&); - void setup_bundles (); - - static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath); + /* Scene Changing */ + SceneChanger* _scene_changer; + + /* persistent, non-track related MIDI ports */ + MidiPortManager* _midi_ports; + MIDI::MachineControl* _mmc; + + void setup_ltc (); + void setup_click (); + void setup_click_state (const XMLNode*); + void setup_bundles (); + + static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath); }; + } // namespace ARDOUR #endif /* __ardour_session_h__ */