diff options
Diffstat (limited to 'libs/ardour/ardour')
37 files changed, 1049 insertions, 118 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index f48204d7ab..33126b5baf 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -209,9 +209,8 @@ class LIBARDOUR_API AudioDiskstream : public Diskstream /* The two central butler operations */ int do_flush (RunContext context, bool force = false); - int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer); } + int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer, 0); } - int do_refill_with_alloc (); int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, framepos_t& start, framecnt_t cnt, @@ -250,7 +249,6 @@ class LIBARDOUR_API AudioDiskstream : public Diskstream static void allocate_working_buffers(); static void free_working_buffers(); - static size_t _working_buffers_size; static Sample* _mixdown_buffer; static gain_t* _gain_buffer; @@ -258,9 +256,12 @@ class LIBARDOUR_API AudioDiskstream : public Diskstream SerializedRCUManager<ChannelList> channels; + protected: + int _do_refill_with_alloc (bool one_chunk_only); + /* really */ private: - int _do_refill (Sample *mixdown_buffer, float *gain_buffer); + int _do_refill (Sample *mixdown_buffer, float *gain_buffer, framecnt_t fill_level); int add_channel_to (boost::shared_ptr<ChannelList>, uint32_t how_many); int remove_channel_from (boost::shared_ptr<ChannelList>, uint32_t how_many); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 13b16827cb..8fcdcf75a4 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -241,7 +241,7 @@ class LIBARDOUR_API AUPluginInfo : public PluginInfo { bool reconfigurable_io() const { return true; } - static PluginInfoList* discover (); + static PluginInfoList* discover (bool scan_only); static bool au_get_crashlog (std::string &msg); static void get_names (CAComponentDescription&, std::string& name, std::string& maker); static std::string stringify_descriptor (const CAComponentDescription&); @@ -252,6 +252,7 @@ class LIBARDOUR_API AUPluginInfo : public PluginInfo { boost::shared_ptr<CAComponentDescription> descriptor; UInt32 version; static FILE * _crashlog_fd; + static bool _scan_only; static void au_start_crashlog (void); static void au_remove_crashlog (void); @@ -267,7 +268,7 @@ class LIBARDOUR_API AUPluginInfo : public PluginInfo { typedef std::map<std::string,AUPluginCachedInfo> CachedInfoMap; static CachedInfoMap cached_info; - static bool cached_io_configuration (const std::string&, UInt32, CAComponent&, AUPluginCachedInfo&, const std::string& name); + static int cached_io_configuration (const std::string&, UInt32, CAComponent&, AUPluginCachedInfo&, const std::string& name); static void add_cached_info (const std::string&, AUPluginCachedInfo&); static void save_cached_info (); }; diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 330de4e285..d1e3f8a7ef 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -209,6 +209,9 @@ class LIBARDOUR_API AudioEngine : public SessionHandlePtr, public PortManager void latency_callback (bool for_playback); void halted_callback (const char* reason); + /* checks if current thread is properly set up for audio processing */ + static bool thread_initialised_for_audio_processing (); + /* sets up the process callback thread */ static void thread_init_callback (void *); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 8e510b3e43..086544f3aa 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -73,7 +73,11 @@ class LIBARDOUR_API AudioRegion : public Region bool speed_mismatch (float) const; boost::shared_ptr<AudioSource> audio_source (uint32_t n=0) const; - + + // if several audio files associated with a region, + // information about file with MAX channel count will be provided + uint32_t get_related_audio_file_channel_count () const; + void set_scale_amplitude (gain_t); gain_t scale_amplitude() const { return _scale_amplitude; } diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 095d9d2169..c02310ea28 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -109,8 +109,6 @@ class LIBARDOUR_API AudioSource : virtual public Source, static bool _build_missing_peakfiles; static bool _build_peakfiles; - static size_t _working_buffers_size; - /* these collections of working buffers for supporting playlist's reading from potentially nested/recursive sources assume SINGLE THREADED reads by the butler diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h index 94b6fb876b..7f0847498e 100644 --- a/libs/ardour/ardour/butler.h +++ b/libs/ardour/ardour/butler.h @@ -61,6 +61,8 @@ class LIBARDOUR_API Butler : public SessionHandleRef bool transport_work_requested() const; void drop_references (); + void map_parameters (); + framecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; } framecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; } uint32_t midi_diskstream_buffer_size() const { return midi_dstream_buffer_size; } diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 5e8e696bf9..44016b46a4 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -39,6 +39,8 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource { float sample_rate() const; int update_header (framepos_t when, struct tm&, time_t); + uint32_t channel_count () const { return n_channels; } + int flush_header () {return 0;}; void set_header_timeline_position () {}; bool clamped_at_unity () const { return false; } diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index 1c19d855bc..94974a1dcd 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -69,6 +69,7 @@ namespace PBD { LIBARDOUR_API extern DebugBits AudioEngine; LIBARDOUR_API extern DebugBits Soundcloud; LIBARDOUR_API extern DebugBits Butler; + LIBARDOUR_API extern DebugBits GenericMidi; } } diff --git a/libs/ardour/ardour/directory_names.h b/libs/ardour/ardour/directory_names.h index db3fc1d533..5c0eae909c 100644 --- a/libs/ardour/ardour/directory_names.h +++ b/libs/ardour/ardour/directory_names.h @@ -42,6 +42,10 @@ namespace ARDOUR { LIBARDOUR_API extern const char* const ladspa_dir_name; LIBARDOUR_API extern const char* const panner_dir_name; LIBARDOUR_API extern const char* const backend_dir_name; + LIBARDOUR_API extern const char* const automation_dir_name; + LIBARDOUR_API extern const char* const analysis_dir_name; + LIBARDOUR_API extern const char* const plugins_dir_name; + LIBARDOUR_API extern const char* const externals_dir_name; }; diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index fc41d10160..fb9be653e1 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -103,8 +103,8 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream framecnt_t roll_delay() const { return _roll_delay; } void set_roll_delay (framecnt_t); - bool record_enabled() const { return g_atomic_int_get (&_record_enabled); } - bool record_safe () const { return g_atomic_int_get (&_record_safe); } + bool record_enabled() const { return g_atomic_int_get (const_cast<gint*>(&_record_enabled)); } + bool record_safe () const { return g_atomic_int_get (const_cast<gint*>(&_record_safe)); } virtual void set_record_enabled (bool yn) = 0; virtual void set_record_safe (bool yn) = 0; @@ -147,6 +147,8 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream static framecnt_t default_disk_read_chunk_frames (); static framecnt_t default_disk_write_chunk_frames (); + static void set_buffering_parameters (BufferingPreset bp); + /* Stateful */ virtual XMLNode& get_state(void); virtual int set_state(const XMLNode&, int version); @@ -169,8 +171,15 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<framepos_t> > const &); - /** For non-butler contexts (allocates temporary working buffers) */ - virtual int do_refill_with_alloc() = 0; + /** For non-butler contexts (allocates temporary working buffers) + * + * This accessible method has a default argument; derived classes + * must inherit the virtual method that we call which does NOT + * have a default argument, to avoid complications with inheritance + */ + int do_refill_with_alloc(bool partial_fill = true) { + return _do_refill_with_alloc (partial_fill); + } virtual void set_block_size (pframes_t) = 0; bool pending_overwrite () const { @@ -203,6 +212,11 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream virtual int can_internal_playback_seek (framecnt_t distance) = 0; virtual void reset_write_sources (bool, bool force = false) = 0; virtual void non_realtime_input_change () = 0; + /* accessible method has default argument, so use standard C++ "trick" + to avoid complications with inheritance, by adding this virtual + method which does NOT have a default argument. + */ + virtual int _do_refill_with_alloc (bool partial_fill) = 0; protected: friend class Auditioner; @@ -345,6 +359,12 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream XMLNode* deprecated_io_node; void route_going_away (); + + static bool get_buffering_presets (BufferingPreset bp, + framecnt_t& read_chunk_size, + framecnt_t& read_buffer_size, + framecnt_t& write_chunk_size, + framecnt_t& write_buffer_size); }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/engine_state_controller.h b/libs/ardour/ardour/engine_state_controller.h new file mode 100644 index 0000000000..737fb3b579 --- /dev/null +++ b/libs/ardour/ardour/engine_state_controller.h @@ -0,0 +1,653 @@ +/* + Copyright (C) 2014 Waves Audio Ltd. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __gtk2_ardour__engine_state_controller__ +#define __gtk2_ardour__engine_state_controller__ + +#include <vector> +#include <list> + +#include "ardour/types.h" +#include "ardour/audio_backend.h" + +namespace ARDOUR { + +class AudioBackendInfo; + +/** + * @class EngineStateController + * @brief EngineStateController class. + * + * Implements usecases for Audio devices and Audio/Midi ports. + * Persistantly saves to the config device configuration settings and audio/midi port states + */ +class EngineStateController +{ + public: + + // public data types: + + /** + * @struct PortState + * Structure which represents AudioPort state + */ + struct PortState { + std::string name; ///< Audio Port name + bool active; ///< Audio Port state + + PortState () + : name("") + , active(false) + { + } + + PortState (const std::string& name) + : name(name) + , active(false) + { + } + + bool operator==(const PortState& rhs) {return rhs.name == name; } + + }; + + /// @typedef Type for the list of all available audio ports + typedef std::list<PortState> PortStateList; + + /** + * @struct MidiPortState + * Structure which represents MidiPort state. + */ + struct MidiPortState + { + std::string name; ///< Midi Port name + bool active; ///< Midi Port state + bool available; ///< Midi Port availability - if it is physicaly available or not + bool scene_connected; ///< Is midi port used for scene MIDI marker in/out + bool mtc_in; ///< Is midi port used as MTC in + + MidiPortState(const std::string& name) + : name(name) + , active(false) + , available(false) + , scene_connected(false) + , mtc_in(false) + {} + + bool operator==(const MidiPortState& rhs) + { + return name == rhs.name; + } + }; + + /// @typedef Type for the list of MidiPorts ever registered in the system + typedef std::list<MidiPortState> MidiPortStateList; + + + //Interfaces + + /** Get an instance of EngineStateController singleton. + * @return EngineStateController instance pointer + */ + static EngineStateController* instance (); + + /** Associate session with EngineStateController instance. + */ + void set_session (Session* session); + + /** Remove link to the associated session. + */ + void remove_session (); + + ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // General backend/device information methods + + /** Provides names of all available backends. + * + * @param[out] available_backends - vector of available backends + */ + void available_backends (std::vector<const AudioBackendInfo*>& available_backends); + + /** Provides the name of currently used backend. + * + * @return the name of currently used backend + */ + const std::string& get_current_backend_name() const; + + /** Provides the name of currently used device. + * + * @return the name of currently used device + */ + const std::string& get_current_device_name () const; + + /** Provides names for all available devices. + * + * @param[out] device_vector - vector of available devices + */ + void enumerate_devices (std::vector<ARDOUR::AudioBackend::DeviceStatus>& device_vector) const; + + /** Get sample rate used by current device. + * + * @return current sample rate + */ + ARDOUR::framecnt_t get_current_sample_rate () const; + + /** Get default sample rate for current backend. + * + * @return default sample rate for current backend + */ + ARDOUR::framecnt_t get_default_sample_rate () const; + + /** Get sample rates which are supported by current device and current backend. + * + * @param[out] sample_rates - vector of supported sample rates + */ + void available_sample_rates_for_current_device (std::vector<float>& sample_rates) const; + + /** Get buffer size used by current device. + * + * @return current buffer size + */ + ARDOUR::pframes_t get_current_buffer_size () const; + + /** Get default buffer size for current backend. + * + * @return default buffer size for current backend + */ + ARDOUR::pframes_t get_default_buffer_size () const; + + /** Get buffer sizes which are supported by current device and current backend. + * + * @param[out] buffer_sizes - vector of supported buffer_sizes + */ + void available_buffer_sizes_for_current_device (std::vector<ARDOUR::pframes_t>& buffer_sizes) const; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // device state control methods + + /** Get the number of all enabled Audio inputs. + * + * @return number of all enabled Audio inputs + */ + uint32_t get_available_inputs_count() const; + /** Get the number of all enabled Audio outputs. + * + * @return number of all enabled Audio outputs + */ + uint32_t get_available_outputs_count () const; + + /** Get vector of all enabled physical Audio input port names. + * + * @param[out] port_names - vector of all enabled Audio input names + */ + void get_physical_audio_inputs (std::vector<std::string>& port_names); + /** Get vector of all enabled physical Audio input port names. + * + * @param[out] port_names - vector of all enabled Audio input names + */ + void get_physical_audio_outputs (std::vector<std::string>& port_names); + + /** Get vector of all enabled physical MIDI input port names. + * + * @param[out] port_names - vector of all enabled MIDI input names + */ + void get_physical_midi_inputs (std::vector<std::string>& port_names); + /** Get vector of all enabled physical MIDI output port names. + * + * @param[out] port_names - vector of all enabled MIDI output names + */ + void get_physical_midi_outputs (std::vector<std::string>& port_names); + + /** Sets new state to all Audio inputs. + * + * @param[in] state - new state + */ + void set_state_to_all_inputs(bool state); + /** Sets new state to all Audio outputs. + * @note Does nothing in Stereo Out mode + * @param[in] state - new state + */ + void set_state_to_all_outputs(bool state); + + /** Get vector of states for all physical Audio input ports. + * + * @param[out] channel_states - vector of input port states + */ + void get_physical_audio_input_states(std::vector<PortState>& channel_states); + /** Get vector of states for all physical Audio output ports. + * + * @param[out] channel_states - vector of output port states + */ + void get_physical_audio_output_states(std::vector<PortState>& channel_states); + + /** Set state of the specified Audio input port. + * + * @param[in] port_name - input name + * @param[in] state - new state + */ + void set_physical_audio_input_state(const std::string& port_name, bool state); + /** Set state of the specified Audio output port. + * + * @param[in] port_name - output name + * @param[in] state - new state + */ + void set_physical_audio_output_state(const std::string& port_name, bool state); + + /** Get state of the specified Audio input port. + * + * @param[in] port_name - input name + * @return input state + */ + bool get_physical_audio_input_state(const std::string& port_name); + /** Get state of the specified Audi output port. + * + * @param[in] port_name - output name + * @return output state + */ + bool get_physical_audio_output_state(const std::string& port_name); + + + /** Get vector of all enabled MIDI input port names. + * + * @param[out] channel_states - vector of enabled inputs + */ + void get_physical_midi_input_states (std::vector<MidiPortState>& channel_states); + /** Get vector of all enabled MIDI output port names. + * + * @param[out] channel_states - vector of enabled outputs + */ + void get_physical_midi_output_states (std::vector<MidiPortState>& channel_states); + + /** Get name of mtc source port + * + * return name of mtc source port + */ + std::string get_mtc_source_port (); + + /** Set ltc source port + * + * @param[in] port - name of ltc source port + */ + void set_ltc_source_port (const std::string& port); + /** Get name of ltc source port + * + * return name of ltc source port + */ + std::string get_ltc_source_port (); + + /** Set ltc output port + * + * @param[in] port - name of ltc output port + */ + void set_ltc_output_port (const std::string&); + /** Get name of ltc output port + * + * return name of ltc output port + */ + std::string get_ltc_output_port (); + + /** Set state of the specified MIDI input port. + * + * @param[in] port_name - input name + * @param[in] state - new state + */ + void set_physical_midi_input_state(const std::string& port_name, bool state); + /** Set state of the specified MIDI output port. + * + * @param[in] port_name - output name + * @param[in] state - new state + */ + void set_physical_midi_output_state(const std::string& port_name, bool state); + /** Get state of the specified MIDI input port. + * + * @param[in] port_name - input name + * @param[out] scene_connected - is port used as Scene In or not + * @return input state + */ + bool get_physical_midi_input_state(const std::string& port_name, bool& scene_connected); + /** Get state of the specified MIDI output port. + * + * @param[in] port_name - output name + * @param[out] scene_connected - is port used as Scene Out or not + * @return output state + */ + bool get_physical_midi_output_state(const std::string& port_name, bool& scene_connected); + + /** Set state of Scene In connection for the specified MIDI input port. + * + * @param[in] port_name - input name + * @param[in] state - new state + */ + void set_physical_midi_scene_in_connection_state(const std::string& port_name, bool state); + /** Set state of Scene Out connection for the specified MIDI output port. + * + * @param[in] port_name - input name + * @param[in] state - new state + */ + void set_physical_midi_scenen_out_connection_state(const std::string&, bool); + + /** Disocnnect all MIDI input ports from Scene In. + */ + void set_all_midi_scene_inputs_disconnected(); + /** Disocnnect all MIDI output ports from Scene Out. + */ + void set_all_midi_scene_outputs_disconnected(); + + /** Set MIDI TimeCode input port + * @note There is a sense to choose MIDI TimeCode input only because + * our MIDI TimeCode is propagated to all midi output ports. + */ + void set_mtc_source_port (const std::string&); + + /** Check if AudioEngine setup is required + * @return true if setup is required, otherwise - false + */ + bool is_setup_required() const {return ARDOUR::AudioEngine::instance()->setup_required (); } + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Methods set parameters inside the controller + // the state of engine won't change untill we make a "push" of this state to the backend + // NOTE: Use push_state_to_backend() method to update backend with the most recent controller state + + /** Set new sample rate for current device in EngineStateController database + * @note Use push_state_to_backend() method to update backend/device state with the most recent controller state + * @param sample_rate - new sample rate + */ + bool set_new_sample_rate_in_controller(framecnt_t sample_rate); + /** Set new buffer size for current device in EngineStateController database + * @note Use push_state_to_backend() method to update backend/device state with the most recent controller state + * @param buffer_size - new buffer size + */ + bool set_new_buffer_size_in_controller(pframes_t buffer_size); + + /** @brief push current controller state to backend. + * Propagate and set all current EngineStateController parameters to the backend + * @note Engine will be restarted if it's running when this method is called. + * @note If an attempt ot set parameters is unsuccessful current device will be switched to "None". + * @param start - start the Engine if it was not running when this function was called. + * @return true on success, otherwise - false + */ + bool push_current_state_to_backend(bool start); + /** Switch to new backend + * @note The change will be propagated emmidiatelly as if push_current_state_to_backend () was called. + * @param backend_name - new backend name. + * @return true on success, otherwise - false + */ + bool set_new_backend_as_current(const std::string& backend_name); + /** Switch to new device + * @note The change will be propagated emmidiatelly as if push_current_state_to_backend () was called. + * @param device_name - new device name. + * @return true on success, otherwise - false + */ + bool set_new_device_as_current(const std::string& device_name); + + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Methods to save/serialize setting states + + /** Serialize Audio/Midi settings (entire EngineStateController database) to XML + * @return XML note with serialized states + */ + XMLNode& serialize_audio_midi_settings(); + /** Save Audio/Midi settings (entire EngineStateController database) to config persistently + */ + void save_audio_midi_settings(); + + //////////////////////////////////////////////////////////////////////////////////////////////////// + //UPDATE SIGNALS + /** This signal is emitted if the sample rate changes */ + PBD::Signal0<void> SampleRateChanged; + /** This signal is emitted if the buffer size changes */ + PBD::Signal0<void> BufferSizeChanged; + /** This signal is emitted if the device list changes */ + PBD::Signal1<void, bool> DeviceListChanged; + /** This signal is emitted if the device cannot operate properly */ + PBD::Signal0<void> DeviceError; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + //ENGINE STATE SIGNALS + /** This signal is emitted when the engine is started */ + PBD::Signal0<void> EngineRunning; + /** This signal is emitted when the engine is stopped */ + PBD::Signal0<void> EngineStopped; + /** This signal is emitted if Engine processing is terminated */ + PBD::Signal0<void> EngineHalted; + + /** This signal is emitted if the AUDIO input channel configuration changes */ + PBD::Signal0<void> InputConfigChanged; + /** This signal is emitted if the AUDIO output channel configuration changes */ + PBD::Signal0<void> OutputConfigChanged; + /** This signal is emitted if the AUDIO output connection mode changes + * @note By output connection mode "Stereo Out" or "Multi Out" is meant + */ + PBD::Signal0<void> OutputConnectionModeChanged; + + /** This signals is emitted if the MIDI input channel configuration changes */ + PBD::Signal0<void> MIDIInputConfigChanged; + /** This signals is emitted if the MIDI output channel configuration changes */ + PBD::Signal0<void> MIDIOutputConfigChanged; + /** This signals is emitted if the MIDI Scene In connection changes */ + PBD::Signal2<void, const std::vector<std::string>&, bool> MIDISceneInputConnectionChanged; + /** This signals is emitted if the MIDI Scene Out connection changes */ + PBD::Signal2<void, const std::vector<std::string>&, bool> MIDISceneOutputConnectionChanged; + + /** This signal is emitted if the MTC Input channel is changed */ + PBD::Signal1<void, const std::string&> MTCInputChanged; + + /** This signal is emitted if new Audio/MIDI ports are registered or unregistered */ + PBD::Signal0<void> PortRegistrationChanged; + + private: + + EngineStateController(); /// singleton + ~EngineStateController(); /// singleton + EngineStateController(const EngineStateController& ); /// prohibited + EngineStateController& operator=(const EngineStateController&); /// prohibited + + //////////////////////////////////////////////////////////////////////////////////////////// + // private data structures + + /** @struct Engine state + * @brief State structure. + * Contains information about single device/backend state + */ + struct State { + std::string backend_name; ///< state backend name + std::string device_name; ///< state device name + ARDOUR::framecnt_t sample_rate; ///< sample rate used by the device in this state + ARDOUR::pframes_t buffer_size; ///< buffer size used by the device in this state + + PortStateList input_channel_states; ///< states of device Audio inputs + PortStateList multi_out_channel_states; ///< states of device Audio inputs in Multi Out mode + PortStateList stereo_out_channel_states; ///< states of device Audio inputs in Stereo Out mode + bool active; ///< was this state the most recent active one + + State() + : sample_rate(0) + , buffer_size(0) + , input_channel_states (0) + , multi_out_channel_states (0) + , stereo_out_channel_states (0) + , active (false) + { + } + + bool operator==(const State& rhs) + { + return (backend_name == rhs.backend_name) && (device_name == rhs.device_name); + } + + /** Forms string name for the state + * @return name string + */ + std::string form_state_name() { + return std::string("State:" + backend_name + ":" + device_name); + } + + /** @struct StatepPredicate + * This predicate is used to identify a state during search in the list of states + */ + struct StatePredicate + { + StatePredicate(const std::string& backend_name, const std::string& device_name) + : _backend_name (backend_name) + , _device_name (device_name) + {} + + bool operator()(boost::shared_ptr<ARDOUR::EngineStateController::State> rhs) + { + return (_backend_name == rhs->backend_name) && (_device_name == rhs->device_name); + } + + private: + std::string _backend_name; + std::string _device_name; + }; + }; + + /// @typedef Type for the state pointer + typedef boost::shared_ptr<State> StatePtr; + /// @typedef Type for the list of states + typedef std::list<StatePtr> StateList; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // methods to manage setting states + + /** Deserializes and loads Engine and Audio port states from the config to EngineStateController + */ + void _deserialize_and_load_engine_states(); + /** Deserializes and loads MIDI port states from the config to EngineStateController + */ + void _deserialize_and_load_midi_port_states(); + /** Serializes Engine and Audio port states from EngineStateController to XML node + * @param[in,out] audio_midi_settings_node - node to serialize the satets to + */ + void _serialize_engine_states(XMLNode* audio_midi_settings_node); + /** Serializes MIDI port states from EngineStateController to XML node + * @param[in,out] audio_midi_settings_node - node to serialize the satets to + */ + void _serialize_midi_port_states(XMLNode* audio_midi_settings_node); + + /** Provides initial state configuration. + * It loades the last active state if there is one and it is aplicable. + * Otherwise default state (None device with default sample rate and buffer size) is loaded. + */ + void _do_initial_engine_setup(); + + /** Loades provided state. + * @note It's possible that provided state can't be loaded + * (device disconnected or reqested parameters are not supported anymore). + * @param state - state to apply + * @return true on success, otherwise - false + */ + bool _apply_state(const StatePtr& state); + + /** Gets available device channels from engine and updates internal controller state + */ + void _update_device_channels_state(); + + /** Check "Stereo Out" mode channels state configuration and make it correspond Stereo Out mode requirements + */ + void _refresh_stereo_out_channel_states(); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////// + // internal helper functions + /** make sure that current device parameters are supported and fit session requirements + * @return true if current state is valid and all parameters are supported, otherwise - false + */ + bool _validate_current_device_state(); + + /** change ltc source port in case of the input ports list change + */ + void _update_ltc_source_port (); + /** change ltc source port in case of the output ports list change + */ + void _update_ltc_output_port (); + + /** check that port is still existed in the list of input ports + @param[in] port - port name + @return true if current port is existed, otherwise - false + */ + bool _audio_input_port_exists (const std::string& port); + /** check that port is still existed in the list of output ports + @param[in] port - port name + @return true if current port is existed, otherwise - false + */ + bool _audio_output_port_exists (const std::string& port); + + + + //////////////////////////////////////// + // callbacks + /** Invoked when Engine starts running + */ + void _on_engine_running(); + /** Invoked when Engine is halted + */ + void _on_engine_halted(); + /** Invoked when Engine processing is terminated + */ + void _on_engine_stopped(); + /** Invoked when Device error accured, it failed to start or didn't accept the change which should + */ + void _on_device_error(); + /** Invoked when current device changes sample rate + */ + void _on_sample_rate_change(ARDOUR::framecnt_t); + /** Invoked when current device changes buffer size + */ + void _on_buffer_size_change(ARDOUR::pframes_t); + /** Invoked when the list of available devices is changed + */ + void _on_device_list_change(); + /** Invoked when the config parameter is changed + */ + void _on_parameter_changed (const std::string&); + /** Invoked when Audio/MIDI ports are registered or unregistered + */ + void _on_ports_registration_update (); + /** Invoked when session loading process is complete + */ + void _on_session_loaded(); + //////////////////////////////////////// + + //////////////////////////////////////// + // attributes + StatePtr _current_state; ///< current state pointer + // list of system states + StateList _states; ///< list of all available states + + MidiPortStateList _midi_inputs; ///< midi input states + MidiPortStateList _midi_outputs; ///< midi output states + + std::string _last_used_real_device; ///< last active non-default (real) device + + Session* _session; ///< current session + + // Engine connections stuff + PBD::ScopedConnectionList update_connections; ///< connection container for update signals + PBD::ScopedConnectionList session_connections; ///< connection container for session signals + PBD::ScopedConnection running_connection; ///< connection container for EngineRunning signal + PBD::ScopedConnection halt_connection; ///< connection container for EngineHalted signal + PBD::ScopedConnection stopped_connection; ///< connection container for EngineStopped signal +}; + +} // namespace ARDOUR + +#endif /* defined(__gtk2_ardour__engine_state_controller__) */ diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h index aa2ef69240..093913e294 100644 --- a/libs/ardour/ardour/export_format_base.h +++ b/libs/ardour/ardour/export_format_base.h @@ -102,6 +102,7 @@ class LIBARDOUR_API ExportFormatBase { SR_48 = 48000, SR_88_2 = 88200, SR_96 = 96000, + SR_176_4 = 176400, SR_192 = 192000 }; diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index ed6e259644..87a7729887 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -114,11 +114,42 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { std::string format_name () const { return _format_name; } Type type () const { return _type; } - FormatId format_id () const { return *format_ids.begin(); } - Endianness endianness () const { return *endiannesses.begin(); } - SampleFormat sample_format () const { return *sample_formats.begin(); } - SampleRate sample_rate () const { return *sample_rates.begin(); } - Quality quality () const { return *qualities.begin(); } + + FormatId format_id () const { + if (!format_ids.empty() ) + return *format_ids.begin(); + else + return FormatId(0); + } + + Endianness endianness () const { + if (!endiannesses.empty() ) + return *endiannesses.begin(); + else + return Endianness(0); + } + + SampleFormat sample_format () const { + if (!sample_formats.empty() ) + return *sample_formats.begin(); + else + return SampleFormat(0); + } + + SampleRate sample_rate () const { + if (!sample_rates.empty() ) + return *sample_rates.begin(); + else + return SampleRate(0); + + } + + Quality quality () const { + if (!qualities.empty() ) + return *qualities.begin(); + else + return Quality(0); + } DitherType dither_type () const { return _dither_type; } SRCQuality src_quality () const { return _src_quality; } diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index 40960b2b38..5dc6cd7ac2 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -68,22 +68,25 @@ class LIBARDOUR_API ExportGraphBuilder unsigned get_normalize_cycle_count() const; void reset (); + void cleanup (bool remove_out_files = false); void set_current_timespan (boost::shared_ptr<ExportTimespan> span); void add_config (FileSpec const & config); private: void add_split_config (FileSpec const & config); - + class Encoder { - public: + public: template <typename T> boost::shared_ptr<AudioGrapher::Sink<T> > init (FileSpec const & new_config); void add_child (FileSpec const & new_config); + void remove_children (); + void destroy_writer (bool delete_out_file); bool operator== (FileSpec const & other_config) const; static int get_real_format (FileSpec const & config); - private: + private: typedef boost::shared_ptr<AudioGrapher::SndfileWriter<Sample> > FloatWriterPtr; typedef boost::shared_ptr<AudioGrapher::SndfileWriter<int> > IntWriterPtr; typedef boost::shared_ptr<AudioGrapher::SndfileWriter<short> > ShortWriterPtr; @@ -95,6 +98,8 @@ class LIBARDOUR_API ExportGraphBuilder std::list<ExportFilenamePtr> filenames; PBD::ScopedConnection copy_files_connection; + std::string writer_filename; + // Only one of these should be available at a time FloatWriterPtr float_writer; IntWriterPtr int_writer; @@ -103,14 +108,15 @@ class LIBARDOUR_API ExportGraphBuilder // sample format converter class SFC { - public: + public: // This constructor so that this can be constructed like a Normalizer SFC (ExportGraphBuilder &, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<Sample> > FloatConverterPtr; typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<int> > IntConverterPtr; typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<short> > ShortConverterPtr; @@ -126,10 +132,11 @@ class LIBARDOUR_API ExportGraphBuilder }; class Normalizer { - public: + public: Normalizer (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; unsigned get_normalize_cycle_count() const; @@ -137,7 +144,7 @@ class LIBARDOUR_API ExportGraphBuilder /// Returns true when finished bool process (); - private: + private: typedef boost::shared_ptr<AudioGrapher::PeakReader> PeakReaderPtr; typedef boost::shared_ptr<AudioGrapher::Normalizer> NormalizerPtr; typedef boost::shared_ptr<AudioGrapher::TmpFile<Sample> > TmpFilePtr; @@ -163,13 +170,15 @@ class LIBARDOUR_API ExportGraphBuilder // sample rate converter class SRC { - public: + public: SRC (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); + bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr<AudioGrapher::SampleRateConverter> SRConverterPtr; template<typename T> @@ -185,13 +194,14 @@ class LIBARDOUR_API ExportGraphBuilder // Silence trimmer + adder class SilenceHandler { - public: + public: SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr<AudioGrapher::SilenceTrimmer<Sample> > SilenceTrimmerPtr; ExportGraphBuilder & parent; @@ -203,12 +213,13 @@ class LIBARDOUR_API ExportGraphBuilder // channel configuration class ChannelConfig { - public: + public: ChannelConfig (ExportGraphBuilder & parent, FileSpec const & new_config, ChannelMap & channel_map); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr<AudioGrapher::Interleaver<Sample> > InterleaverPtr; typedef boost::shared_ptr<AudioGrapher::Chunker<Sample> > ChunkerPtr; diff --git a/libs/ardour/ardour/filter.h b/libs/ardour/ardour/filter.h index 2b6476c49f..e80d1fcfd5 100644 --- a/libs/ardour/ardour/filter.h +++ b/libs/ardour/ardour/filter.h @@ -43,7 +43,7 @@ class LIBARDOUR_API Filter { protected: Filter (ARDOUR::Session& s) : session(s) {} - int make_new_sources (boost::shared_ptr<ARDOUR::Region>, ARDOUR::SourceList&, std::string suffix = ""); + int make_new_sources (boost::shared_ptr<ARDOUR::Region>, ARDOUR::SourceList&, std::string suffix = "", bool use_session_sample_rate = true); int finish (boost::shared_ptr<ARDOUR::Region>, ARDOUR::SourceList&, std::string region_name = ""); ARDOUR::Session& session; diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index f809dbf280..6b1f89dab3 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -62,7 +62,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest Location (Session &, const XMLNode&); Location* operator= (const Location& other); - bool operator==(const Location& other); + bool operator==(const Location& other); bool locked() const { return _locked; } void lock (); @@ -86,8 +86,8 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest void set_hidden (bool yn, void *src); void set_cd (bool yn, void *src); void set_is_range_marker (bool yn, void* src); - void set_skip (bool yn); - void set_skipping (bool yn); + void set_skip (bool yn); + void set_skipping (bool yn); bool is_auto_punch () const { return _flags & IsAutoPunch; } bool is_auto_loop () const { return _flags & IsAutoLoop; } @@ -105,28 +105,29 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest boost::shared_ptr<SceneChange> scene_change() const { return _scene_change; } void set_scene_change (boost::shared_ptr<SceneChange>); - /* these are static signals for objects that want to listen to all - locations at once. - */ + /* these are static signals for objects that want to listen to all + locations at once. + */ static PBD::Signal1<void,Location*> name_changed; static PBD::Signal1<void,Location*> end_changed; static PBD::Signal1<void,Location*> start_changed; static PBD::Signal1<void,Location*> flags_changed; - static PBD::Signal1<void,Location*> lock_changed; + static PBD::Signal1<void,Location*> lock_changed; static PBD::Signal1<void,Location*> position_lock_style_changed; /* this is sent only when both start and end change at the same time */ static PBD::Signal1<void,Location*> changed; - /* these are member signals for objects that care only about - changes to this object - */ + /* these are member signals for objects that care only about + changes to this object + */ + PBD::Signal0<void> Changed; + PBD::Signal0<void> NameChanged; PBD::Signal0<void> EndChanged; PBD::Signal0<void> StartChanged; - PBD::Signal0<void> Changed; PBD::Signal0<void> FlagsChanged; PBD::Signal0<void> LockChanged; PBD::Signal0<void> PositionLockStyleChanged; @@ -143,8 +144,9 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest void set_position_lock_style (PositionLockStyle ps); void recompute_frames_from_bbt (); - static PBD::Signal0<void> scene_changed; - + static PBD::Signal0<void> scene_changed; /* for use by backend scene change management, class level */ + PBD::Signal0<void> SceneChangeChanged; /* for use by objects interested in this object */ + private: std::string _name; framepos_t _start; @@ -155,7 +157,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest bool _locked; PositionLockStyle _position_lock_style; boost::shared_ptr<SceneChange> _scene_change; - + void set_mark (bool yn); bool set_flag_internal (bool yn, Flags flag); void recompute_bbt_from_frames (); @@ -193,32 +195,32 @@ class LIBARDOUR_API Locations : public SessionHandleRef, public PBD::StatefulDes Location* mark_at (framepos_t, framecnt_t slop = 0) const; - framepos_t first_mark_before (framepos_t, bool include_special_ranges = false); + framepos_t first_mark_before (framepos_t, bool include_special_ranges = false); framepos_t first_mark_after (framepos_t, bool include_special_ranges = false); void marks_either_side (framepos_t const, framepos_t &, framepos_t &) const; void find_all_between (framepos_t start, framepos_t, LocationList&, Location::Flags); - + PBD::Signal1<void,Location*> current_changed; - /* Objects that care about individual addition and removal of Locations should connect to added/removed. - If an object additionally cares about potential mass clearance of Locations, they should connect to changed. - */ + /* Objects that care about individual addition and removal of Locations should connect to added/removed. + If an object additionally cares about potential mass clearance of Locations, they should connect to changed. + */ PBD::Signal1<void,Location*> added; PBD::Signal1<void,Location*> removed; PBD::Signal0<void> changed; /* emitted when any action that could have added/removed more than 1 location actually removed 1 or more */ template<class T> void apply (T& obj, void (T::*method)(const LocationList&)) const { - /* We don't want to hold the lock while the given method runs, so take a copy - of the list and pass that instead. - */ - Locations::LocationList copy; - { - Glib::Threads::Mutex::Lock lm (lock); - copy = locations; - } + /* We don't want to hold the lock while the given method runs, so take a copy + of the list and pass that instead. + */ + Locations::LocationList copy; + { + Glib::Threads::Mutex::Lock lm (lock); + copy = locations; + } (obj.*method)(copy); } diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 6610708581..dac262e269 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -128,10 +128,10 @@ class LIBARDOUR_API MidiDiskstream : public Diskstream protected: friend class MidiTrack; friend class Auditioner; - int seek (framepos_t which_sample, bool complete_refill = false); + int seek (framepos_t which_sample, bool complete_refill = false); + int _do_refill_with_alloc (bool one_chunk_only); int process (BufferSet&, framepos_t transport_frame, pframes_t nframes, framecnt_t &, bool need_diskstream); - frameoffset_t calculate_playback_distance (pframes_t nframes); bool commit (framecnt_t nframes); @@ -143,8 +143,6 @@ class LIBARDOUR_API MidiDiskstream : public Diskstream int do_flush (RunContext context, bool force = false); int do_refill (); - int do_refill_with_alloc(); - int read (framepos_t& start, framecnt_t cnt, bool reversed); void finish_capture (); diff --git a/libs/ardour/ardour/midiport_manager.h b/libs/ardour/ardour/midiport_manager.h index 5e87238c22..4d6453b5cb 100644 --- a/libs/ardour/ardour/midiport_manager.h +++ b/libs/ardour/ardour/midiport_manager.h @@ -60,6 +60,9 @@ class LIBARDOUR_API MidiPortManager { MIDI::Port* scene_input_port () const { return _scene_input_port; } MIDI::Port* scene_output_port () const { return _scene_output_port; } + boost::shared_ptr<MidiPort> mmc_in() const { return boost::dynamic_pointer_cast<MidiPort>(_mmc_in); } + boost::shared_ptr<MidiPort> mmc_out() const { return boost::dynamic_pointer_cast<MidiPort>(_mmc_out); } + boost::shared_ptr<MidiPort> scene_in() const { return boost::dynamic_pointer_cast<MidiPort>(_scene_in); } boost::shared_ptr<MidiPort> scene_out() const { return boost::dynamic_pointer_cast<MidiPort>(_scene_out); } diff --git a/libs/ardour/ardour/mix.h b/libs/ardour/ardour/mix.h index 3cd9a3e60f..4676c01046 100644 --- a/libs/ardour/ardour/mix.h +++ b/libs/ardour/ardour/mix.h @@ -27,13 +27,23 @@ extern "C" { /* SSE functions */ - LIBARDOUR_API float x86_sse_compute_peak (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float current); - LIBARDOUR_API void x86_sse_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); - LIBARDOUR_API void x86_sse_mix_buffers_with_gain(ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); - LIBARDOUR_API void x86_sse_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); + LIBARDOUR_API float x86_sse_compute_peak (const float * buf, uint32_t nsamples, float current); + LIBARDOUR_API void x86_sse_apply_gain_to_buffer (float * buf, uint32_t nframes, float gain); + LIBARDOUR_API void x86_sse_mix_buffers_with_gain(float * dst, const float * src, uint32_t nframes, float gain); + LIBARDOUR_API void x86_sse_mix_buffers_no_gain (float * dst, const float * src, uint32_t nframes); } -LIBARDOUR_API void x86_sse_find_peaks (const ARDOUR::Sample * buf, ARDOUR::pframes_t nsamples, float *min, float *max); +extern "C" { +/* AVX functions */ + LIBARDOUR_API float x86_sse_avx_compute_peak (const float * buf, uint32_t nsamples, float current); + LIBARDOUR_API void x86_sse_avx_apply_gain_to_buffer (float * buf, uint32_t nframes, float gain); + LIBARDOUR_API void x86_sse_avx_mix_buffers_with_gain(float * dst, const float * src, uint32_t nframes, float gain); + LIBARDOUR_API void x86_sse_avx_mix_buffers_no_gain (float * dst, const float * src, uint32_t nframes); + LIBARDOUR_API void x86_sse_avx_copy_vector (float * dst, const float * src, uint32_t nframes); +} + +LIBARDOUR_API void x86_sse_find_peaks (const float * buf, uint32_t nsamples, float *min, float *max); +LIBARDOUR_API void x86_sse_avx_find_peaks (const float * buf, uint32_t nsamples, float *min, float *max); /* debug wrappers for SSE functions */ @@ -41,6 +51,7 @@ LIBARDOUR_API float debug_compute_peak (const ARDOUR::Sample * buf LIBARDOUR_API void debug_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); LIBARDOUR_API void debug_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); LIBARDOUR_API void debug_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); +LIBARDOUR_API void debug_copy_vector (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); #endif @@ -61,5 +72,6 @@ LIBARDOUR_API void default_find_peaks (const ARDOUR::Sample * bu LIBARDOUR_API void default_apply_gain_to_buffer (ARDOUR::Sample * buf, ARDOUR::pframes_t nframes, float gain); LIBARDOUR_API void default_mix_buffers_with_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes, float gain); LIBARDOUR_API void default_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); +LIBARDOUR_API void default_copy_vector (ARDOUR::Sample * dst, const ARDOUR::Sample * src, ARDOUR::pframes_t nframes); #endif /* __ardour_mix_h__ */ diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index e01f56d8bf..7504478e87 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -53,6 +53,7 @@ class LIBARDOUR_API PluginInsert : public Processor XMLNode& state(bool); XMLNode& get_state(void); int set_state(const XMLNode&, int version); + void update_id (PBD::ID); void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool); void silence (framecnt_t nframes); diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 3a6a210b5f..663bb92324 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -144,6 +144,8 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable { std::string get_ladspa_category (uint32_t id); std::vector<uint32_t> ladspa_plugin_whitelist; + Glib::Threads::Mutex _lock; + static PluginManager* _instance; // singleton PluginManager (); }; diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 327080984a..54d8583d9a 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -64,6 +64,8 @@ class LIBARDOUR_API PortInsert : public IOProcessor void activate (); void deactivate (); + void set_pre_fader (bool); + uint32_t bit_slot() const { return _bitslot; } void start_latency_detection (); diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index fa75876580..c7d3608b5e 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -107,7 +107,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public XMLNode& get_state (void); int set_state (const XMLNode&, int version); - void set_pre_fader (bool); + virtual void set_pre_fader (bool); PBD::Signal0<void> ActiveChanged; PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged; diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 52c3309b65..5bd23f16b1 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -29,15 +29,21 @@ DO dump the config using cfgtool to system_config after modifying this file. - ./waf && build/cfgtool/cfgtool system_config + ./waf && gtk2_ardour/arcfg system_config *****************************************************/ /* IO connection */ CONFIG_VARIABLE (bool, auto_connect_standard_busses, "auto-connect-standard-busses", true) +/* this variable is used to indicate output mode in Waves Tracks: + "Multi Out" == AutoConnectPhysical and "Stereo Out" == AutoConnectMaster +*/ CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect", AutoConnectMaster) CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectPhysical) +/* Naming */ +CONFIG_VARIABLE (TracksAutoNamingRule, tracks_auto_naming, "tracks-auto-naming", UseDefaultNames) + /* MIDI and MIDI related */ CONFIG_VARIABLE (bool, trace_midi_input, "trace-midi-input", false) @@ -51,15 +57,23 @@ CONFIG_VARIABLE (int32_t, mmc_receive_device_id, "mmc-receive-device-id", 0x7f) CONFIG_VARIABLE (int32_t, mmc_send_device_id, "mmc-send-device-id", 0) CONFIG_VARIABLE (int32_t, initial_program_change, "initial-program-change", -1) CONFIG_VARIABLE (bool, first_midi_bank_is_zero, "display-first-midi-bank-as-zero", false) -CONFIG_VARIABLE (int32_t, inter_scene_gap_msecs, "inter-scene-gap-msecs", 1) +CONFIG_VARIABLE (int32_t, inter_scene_gap_frames, "inter-scene-gap-frames", 1) /* Timecode and related */ CONFIG_VARIABLE (int, mtc_qf_speed_tolerance, "mtc-qf-speed-tolerance", 5) CONFIG_VARIABLE (bool, timecode_sync_frame_rate, "timecode-sync-frame-rate", true) +#ifdef USE_TRACKS_CODE_FEATURES +CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true) +#else CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", false) +#endif CONFIG_VARIABLE (bool, timecode_source_2997, "timecode-source-2997", false) +#ifdef USE_TRACKS_CODE_FEATURES +CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", MTC) +#else CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", Engine) +#endif CONFIG_VARIABLE (std::string, ltc_source_port, "ltc-source-port", "system:capture_1") CONFIG_VARIABLE (bool, send_ltc, "send-ltc", false) CONFIG_VARIABLE (bool, ltc_send_continuously, "ltc-send-continuously", true) @@ -77,6 +91,7 @@ CONFIG_VARIABLE (RemoteModel, remote_model, "remote-model", MixerOrdered) CONFIG_VARIABLE (uint32_t, minimum_disk_read_bytes, "minimum-disk-read-bytes", ARDOUR::Diskstream::default_disk_read_chunk_frames() * sizeof (ARDOUR::Sample)) CONFIG_VARIABLE (uint32_t, minimum_disk_write_bytes, "minimum-disk-write-bytes", ARDOUR::Diskstream::default_disk_write_chunk_frames() * sizeof (ARDOUR::Sample)) CONFIG_VARIABLE (float, midi_readahead, "midi-readahead", 1.0) +CONFIG_VARIABLE (BufferingPreset, buffering_preset, "buffering-preset", Medium) CONFIG_VARIABLE (float, audio_capture_buffer_seconds, "capture-buffer-seconds", 5.0) CONFIG_VARIABLE (float, audio_playback_buffer_seconds, "playback-buffer-seconds", 5.0) CONFIG_VARIABLE (float, midi_track_buffer_seconds, "midi-track-buffer-seconds", 1.0) @@ -99,7 +114,11 @@ CONFIG_VARIABLE (RegionSelectionAfterSplit, region_selection_after_split, "regio /* monitoring, mute, solo etc */ +#ifdef USE_TRACKS_CODE_FEATURES +CONFIG_VARIABLE (bool, mute_affects_pre_fader, "mute-affects-pre-fader", true) +#else CONFIG_VARIABLE (bool, mute_affects_pre_fader, "mute-affects-pre-fader", false) +#endif CONFIG_VARIABLE (bool, mute_affects_post_fader, "mute-affects-post-fader", true) CONFIG_VARIABLE (bool, mute_affects_control_outs, "mute-affects-control-outs", true) CONFIG_VARIABLE (bool, mute_affects_main_outs, "mute-affects-main-outs", true) @@ -141,20 +160,39 @@ CONFIG_VARIABLE (bool, stop_recording_on_xrun, "stop-recording-on-xrun", false) CONFIG_VARIABLE (bool, create_xrun_marker, "create-xrun-marker", true) CONFIG_VARIABLE (bool, stop_at_session_end, "stop-at-session-end", false) CONFIG_VARIABLE (bool, seamless_loop, "seamless-loop", false) +#ifdef USE_TRACKS_CODE_FEATURES +CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", true) +#else CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", false) +#endif CONFIG_VARIABLE (framecnt_t, preroll, "preroll", 0) CONFIG_VARIABLE (framecnt_t, postroll, "postroll", 0) CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f) -CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) -CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) +CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle +CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) // used for MMC shuttle CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung) CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) +CONFIG_VARIABLE (float, shuttle_max_speed, "shuttle-max-speed", 8.0f) CONFIG_VARIABLE (bool, locate_while_waiting_for_sync, "locate-while-waiting-for-sync", false) CONFIG_VARIABLE (bool, disable_disarm_during_roll, "disable-disarm-during-roll", false) +#ifdef USE_TRACKS_CODE_FEATURES +CONFIG_VARIABLE (AutoReturnTarget, auto_return_target_list, "auto-return-target-list", AutoReturnTarget(LastLocate) ) +#else +CONFIG_VARIABLE (AutoReturnTarget, auto_return_target_list, "auto-return-target-list", AutoReturnTarget(LastLocate|RangeSelectionStart|Loop|RegionSelectionStart)) +#endif /* metering */ +#ifdef USE_TRACKS_CODE_FEATURES +CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 60.0f) +CONFIG_VARIABLE (MeterType, meter_type_master, "meter-type-master", MeterPeak) +#else CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 13.3f) +CONFIG_VARIABLE (MeterType, meter_type_master, "meter-type-master", MeterK20) +#endif +CONFIG_VARIABLE (MeterType, meter_type_track, "meter-type-track", MeterPeak) +CONFIG_VARIABLE (MeterType, meter_type_bus, "meter-type-bus", MeterPeak) + /* miscellany */ @@ -170,11 +208,18 @@ CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", false CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true) CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120) CONFIG_VARIABLE (float, automation_interval_msecs, "automation-interval-msecs", 30) -CONFIG_VARIABLE (std::string, default_session_parent_dir, "default-session-parent-dir", "~") +#ifdef __APPLE__ +CONFIG_VARIABLE_SPECIAL (std::string, default_session_parent_dir, "default-session-parent-dir", "~/Music", poor_mans_glob) +#elif defined (PLATFORM_WINDOWS) +CONFIG_VARIABLE_SPECIAL (std::string, default_session_parent_dir, "default-session-parent-dir", "~\\Documents", poor_mans_glob) +#else +CONFIG_VARIABLE_SPECIAL (std::string, default_session_parent_dir, "default-session-parent-dir", "~", poor_mans_glob) +#endif CONFIG_VARIABLE (bool, allow_special_bus_removal, "allow-special-bus-removal", false) CONFIG_VARIABLE (int32_t, processor_usage, "processor-usage", -1) CONFIG_VARIABLE (gain_t, max_gain, "max-gain", 2.0) /* +6.0dB */ CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10) +CONFIG_VARIABLE (uint32_t, max_recent_templates, "max-recent-templates", 10) CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0) CONFIG_VARIABLE (std::string, freesound_download_dir, "freesound-download-dir", Glib::get_home_dir() + "/Freesound/snd") CONFIG_VARIABLE (framecnt_t, range_location_minimum, "range-location-minimum", 128) /* samples */ @@ -187,6 +232,7 @@ CONFIG_VARIABLE (bool, use_plugin_own_gui, "use-plugin-own-gui", true) CONFIG_VARIABLE (bool, use_windows_vst, "use-windows-vst", true) CONFIG_VARIABLE (bool, use_lxvst, "use-lxvst", true) CONFIG_VARIABLE (bool, discover_vst_on_start, "discover-vst-on-start", false) +CONFIG_VARIABLE (bool, verbose_plugin_scan, "verbose-plugin-scan", true) CONFIG_VARIABLE (int, vst_scan_timeout, "vst-scan-timeout", 600) /* deciseconds, per plugin, <= 0 no timeout */ CONFIG_VARIABLE (bool, discover_audio_units, "discover-audio-units", false) @@ -206,7 +252,8 @@ CONFIG_VARIABLE (DenormalModel, denormal_model, "denormal-model", DenormalFTZDAZ CONFIG_VARIABLE (std::string, osx_pingback_url, "osx-pingback-url", "http://community.ardour.org/pingback/osx/") CONFIG_VARIABLE (std::string, linux_pingback_url, "linux-pingback-url", "http://community.ardour.org/pingback/linux/") -CONFIG_VARIABLE (std::string, tutorial_manual_url, "tutorial-manual-url", "http://ardour.org/flossmanual") +CONFIG_VARIABLE (std::string, windows_pingback_url, "windows-pingback-url", "http://community.ardour.org/pingback/windows/") +CONFIG_VARIABLE (std::string, tutorial_manual_url, "tutorial-manual-url", "http://ardour.org/tutorial") CONFIG_VARIABLE (std::string, reference_manual_url, "reference-manual-url", "http://manual.ardour.org/") CONFIG_VARIABLE (std::string, updates_url, "updates-url", "http://ardour.org/whatsnew.html") CONFIG_VARIABLE (std::string, donate_url, "donate-url", "http://ardour.org/donate") diff --git a/libs/ardour/ardour/recent_sessions.h b/libs/ardour/ardour/recent_sessions.h index 03134da6d2..7c4158c9b5 100644 --- a/libs/ardour/ardour/recent_sessions.h +++ b/libs/ardour/ardour/recent_sessions.h @@ -30,8 +30,11 @@ namespace ARDOUR { typedef std::deque<std::pair<std::string,std::string> > RecentSessions; LIBARDOUR_API int read_recent_sessions (RecentSessions& rs); + LIBARDOUR_API int read_recent_templates (std::deque<std::string>& rt); LIBARDOUR_API int store_recent_sessions (std::string name, std::string path); + LIBARDOUR_API int store_recent_templates (const std::string& session_template_full_name); LIBARDOUR_API int write_recent_sessions (RecentSessions& rs); + LIBARDOUR_API int write_recent_templates (std::deque<std::string>& rt); LIBARDOUR_API int remove_recent_sessions (const std::string& path); }; // namespace ARDOUR diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index cce1e152a2..ec6fa8ca8d 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -547,7 +547,10 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou uint32_t _soloed_by_others_upstream; uint32_t _soloed_by_others_downstream; uint32_t _solo_isolated; + uint32_t _solo_isolated_by_upstream; + void mod_solo_isolated_by_upstream (bool, void*); + bool _denormal_protection; bool _recordable : 1; diff --git a/libs/ardour/ardour/runtime_functions.h b/libs/ardour/ardour/runtime_functions.h index e1d6b99f61..45d6ec7015 100644 --- a/libs/ardour/ardour/runtime_functions.h +++ b/libs/ardour/ardour/runtime_functions.h @@ -25,17 +25,19 @@ namespace ARDOUR { - typedef float (*compute_peak_t) (const ARDOUR::Sample *, pframes_t, float); - typedef void (*find_peaks_t) (const ARDOUR::Sample *, pframes_t, float *, float*); + typedef float (*compute_peak_t) (const ARDOUR::Sample *, pframes_t, float); + typedef void (*find_peaks_t) (const ARDOUR::Sample *, pframes_t, float *, float*); typedef void (*apply_gain_to_buffer_t) (ARDOUR::Sample *, pframes_t, float); typedef void (*mix_buffers_with_gain_t) (ARDOUR::Sample *, const ARDOUR::Sample *, pframes_t, float); typedef void (*mix_buffers_no_gain_t) (ARDOUR::Sample *, const ARDOUR::Sample *, pframes_t); + typedef void (*copy_vector_t) (ARDOUR::Sample *, const ARDOUR::Sample *, pframes_t); LIBARDOUR_API extern compute_peak_t compute_peak; LIBARDOUR_API extern find_peaks_t find_peaks; LIBARDOUR_API extern apply_gain_to_buffer_t apply_gain_to_buffer; LIBARDOUR_API extern mix_buffers_with_gain_t mix_buffers_with_gain; LIBARDOUR_API extern mix_buffers_no_gain_t mix_buffers_no_gain; + LIBARDOUR_API extern copy_vector_t copy_vector; } #endif /* __ardour_runtime_functions_h__ */ diff --git a/libs/ardour/ardour/scene_change.h b/libs/ardour/ardour/scene_change.h index ee711985b5..661d2238b7 100644 --- a/libs/ardour/ardour/scene_change.h +++ b/libs/ardour/ardour/scene_change.h @@ -36,17 +36,21 @@ class SceneChange : public PBD::Stateful static boost::shared_ptr<SceneChange> factory (const XMLNode&, int version); static std::string xml_node_name; - uint32_t color() const; - void set_color (uint32_t); - bool color_out_of_bounds() const { return _color == out_of_bound_color; } - static const uint32_t out_of_bound_color; - - PBD::Signal0<void> ColorChanged; + uint32_t color() const; + void set_color (uint32_t); + bool color_out_of_bounds() const { return _color == out_of_bound_color; } + static const uint32_t out_of_bound_color; -protected: - /* derived classes are responsible for serializing & deserializing this value */ - uint32_t _color; + bool active () const { return _active; } + void set_active (bool); + + PBD::Signal0<void> ColorChanged; + PBD::Signal0<void> ActiveChanged; + protected: + /* derived classes are responsible for serializing & deserializing this value */ + uint32_t _color; + bool _active; }; } /* namespace */ diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index bbc82939c7..f75e38cff6 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -176,9 +176,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop bool dirty() const { return _state_of_the_state & Dirty; } void set_deletion_in_progress (); void clear_deletion_in_progress (); + bool reconnection_in_progress() const { return _reconnecting_routes_in_progress; } bool deletion_in_progress() const { return _state_of_the_state & Deletion; } + bool routes_deletion_in_progress() const { return _route_deletion_in_progress; } + PBD::Signal0<void> DirtyChanged; + PBD::Signal1<void, bool> RouteAddedOrRemoved; + const SessionDirectory& session_directory () const { return *(_session_dir.get()); } static PBD::Signal1<void,std::string> Dialog; @@ -214,6 +219,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO); bool have_rec_enabled_track () const; + bool have_rec_disabled_track () const; bool have_captured() const { return _have_captured; } @@ -292,9 +298,20 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop PBD::Signal0<void> IOConnectionsComplete; + /* Timecode status signals */ + PBD::Signal1<void, bool> MTCSyncStateChanged; + PBD::Signal1<void, bool> LTCSyncStateChanged; + /* Record status signals */ - PBD::Signal0<void> RecordStateChanged; + PBD::Signal0<void> RecordStateChanged; /* signals changes in recording state (i.e. are we recording) */ + /* XXX may 2015: paul says: it isn't clear to me that this has semantics that cannot be inferrred + from the previous signal and session state. + */ + PBD::Signal0<void> RecordArmStateChanged; /* signals changes in recording arming */ + + /* Emited when session is loaded */ + PBD::Signal0<void> SessionLoaded; /* Transport mechanism signals */ @@ -331,6 +348,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* Step Editing status changed */ PBD::Signal1<void,bool> StepEditStatusChange; + /* Timecode state signals */ + PBD::Signal0<void> MtcOrLtcInputPortChanged; + void queue_event (SessionEvent*); void request_roll_at_and_return (framepos_t start, framepos_t return_to); @@ -539,13 +559,17 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop RouteGroup* route_group = 0, uint32_t how_many = 1, std::string name_template = "" ); - void remove_route (boost::shared_ptr<Route>); - void resort_routes (); - void resort_routes_using (boost::shared_ptr<RouteList>); + void remove_routes (boost::shared_ptr<RouteList>); + void remove_route (boost::shared_ptr<Route>); + + void resort_routes (); + void resort_routes_using (boost::shared_ptr<RouteList>); AudioEngine & engine() { return _engine; } AudioEngine const & engine () const { return _engine; } + static std::string default_track_name_pattern (DataType); + /* Time */ framepos_t transport_frame () const {return _transport_frame; } @@ -586,7 +610,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void request_sync_source (Slave*); bool synced_to_engine() const { return _slave && config.get_external_sync() && Config->get_sync_source() == Engine; } - + bool synced_to_mtc () const { return config.get_external_sync() && Config->get_sync_source() == MTC && g_atomic_int_get (const_cast<gint*>(&_mtc_active)); } + bool synced_to_ltc () const { return config.get_external_sync() && Config->get_sync_source() == LTC && g_atomic_int_get (const_cast<gint*>(&_ltc_active)); } + double transport_speed() const { return _transport_speed; } bool transport_stopped() const { return _transport_speed == 0.0f; } bool transport_rolling() const { return _transport_speed != 0.0f; } @@ -709,6 +735,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop PBD::Signal0<void> SoloChanged; PBD::Signal0<void> IsolatedChanged; + PBD::Signal0<void> session_routes_reconnected; + /* monitor/master out */ void add_monitor_section (); @@ -824,6 +852,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void maybe_update_session_range (framepos_t, framepos_t); + /* temporary hacks to allow selection to be pushed from GUI into backend. + Whenever we move the selection object into libardour, these will go away. + */ + void set_range_selection (framepos_t start, framepos_t end); + void set_object_selection (framepos_t start, framepos_t end); + void clear_range_selection (); + void clear_object_selection (); + /* buffers for gain and pan */ gain_t* gain_automation_buffer () const; @@ -979,6 +1015,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop MIDI::MachineControl& mmc() { return *_mmc; } + void reconnect_midi_scene_ports (bool); + void reconnect_mtc_ports (); + void reconnect_mmc_ports (bool); + + void reconnect_ltc_input (); + void reconnect_ltc_output (); + protected: friend class AudioEngine; void set_block_size (pframes_t nframes); @@ -1050,6 +1093,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop bool _under_nsm_control; unsigned int _xrun_count; + void mtc_status_changed (bool); + PBD::ScopedConnection mtc_status_connection; + void ltc_status_changed (bool); + PBD::ScopedConnection ltc_status_connection; + void initialize_latencies (); void set_worst_io_latencies (); void set_worst_playback_latency (); @@ -1087,6 +1135,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop bool have_first_delta_accumulator; SlaveState _slave_state; + gint _mtc_active; + gint _ltc_active; framepos_t slave_wait_end; void reset_slave_state (); @@ -1229,7 +1279,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void update_skips (Location*, bool consolidate); void update_marks (Location* loc); - void update_loop (Location* loc); void consolidate_skips (Location*); void sync_locations_to_skips (); void _sync_locations_to_skips (); @@ -1251,6 +1300,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop int post_engine_init (); int immediately_post_engine (); void remove_empty_sounds (); + + void session_loaded (); void setup_midi_control (); int midi_read (MIDI::Port *); @@ -1413,6 +1464,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void engine_halted (); void xrun_recovery (); void set_track_loop (bool); + bool select_playhead_priority_target (framepos_t&); + void follow_playhead_priority (); /* These are synchronous and so can only be called from within the process * cycle @@ -1440,6 +1493,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void add_routes (RouteList&, bool input_auto_connect, bool output_auto_connect, bool save); void add_routes_inner (RouteList&, bool input_auto_connect, bool output_auto_connect); bool _adding_routes_in_progress; + bool _reconnecting_routes_in_progress; + bool _route_deletion_in_progress; + uint32_t destructive_index; boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int); @@ -1447,7 +1503,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void route_processors_changed (RouteProcessorChange); - bool find_route_name (std::string const &, uint32_t& id, char* name, size_t name_len, bool); + bool find_route_name (std::string const &, uint32_t& id, std::string& name, bool); void count_existing_track_channels (ChanCount& in, ChanCount& out); void auto_connect_route (boost::shared_ptr<Route> route, ChanCount& existing_inputs, ChanCount& existing_outputs, bool with_lock, bool connect_inputs = true, @@ -1634,6 +1690,12 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void set_play_range (std::list<AudioRange>&, bool leave_rolling); void unset_play_range (); + /* temporary hacks to allow selection to be pushed from GUI into backend + Whenever we move the selection object into libardour, these will go away. + */ + Evoral::Range<framepos_t> _range_selection; + Evoral::Range<framepos_t> _object_selection; + /* main outs */ uint32_t main_outs; @@ -1676,8 +1738,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop mutable bool have_looped; ///< Used in ::audible_frame(*) - void update_have_rec_enabled_track (); + void update_route_record_state (); gint _have_rec_enabled_track; + gint _have_rec_disabled_track; static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>); @@ -1706,7 +1769,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /** temporary list of Diskstreams used only during load of 2.X sessions */ std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X; - void add_session_range_location (framepos_t, framepos_t); + void set_session_range_location (framepos_t, framepos_t); void setup_midi_machine_control (); @@ -1741,9 +1804,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr<IO> _ltc_input; boost::shared_ptr<IO> _ltc_output; - void reconnect_ltc_input (); - void reconnect_ltc_output (); - /* Scene Changing */ SceneChanger* _scene_changer; @@ -1759,6 +1819,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void save_as_bring_callback (uint32_t, uint32_t, std::string); static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath); + static const uint32_t session_end_shift; }; diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index ec11fc545d..823cf5fe07 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -27,7 +27,6 @@ CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2) CONFIG_VARIABLE (bool, use_region_fades, "use-region-fades", true) -CONFIG_VARIABLE (bool, show_region_fades, "show-region-fades", true) CONFIG_VARIABLE (SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat) CONFIG_VARIABLE (HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE) CONFIG_VARIABLE (bool, auto_play, "auto-play", false) @@ -46,8 +45,6 @@ CONFIG_VARIABLE (std::string, take_name, "take-name", "Take1") CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true) CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false) CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f) -CONFIG_VARIABLE (bool, show_summary, "show-summary", true) -CONFIG_VARIABLE (bool, show_group_tabs, "show-group-tabs", true) CONFIG_VARIABLE (bool, external_sync, "external-sync", false) CONFIG_VARIABLE (InsertMergePolicy, insert_merge_policy, "insert-merge-policy", InsertMergeRelax) CONFIG_VARIABLE (framecnt_t, timecode_offset, "timecode-offset", 0) @@ -57,6 +54,15 @@ CONFIG_VARIABLE (std::string, timecode_generator_offset, "timecode-generator-off CONFIG_VARIABLE (bool, glue_new_markers_to_bars_and_beats, "glue-new-markers-to-bars-and-beats", false) CONFIG_VARIABLE (bool, midi_copy_is_fork, "midi-copy-is-fork", false) CONFIG_VARIABLE (bool, glue_new_regions_to_bars_and_beats, "glue-new-regions-to-bars-and-beats", false) +/* These are GUI-only properties and should not be present in this + * context. There needs to be a new GUI-level session-scoped configuration + * variable header. + */ +CONFIG_VARIABLE (double, wave_amplitude_zoom, "wave-amplitude-zoom", 0.0) +CONFIG_VARIABLE (uint16_t, wave_zoom_factor, "wave-zoom-factor", 2) +CONFIG_VARIABLE (bool, show_summary, "show-summary", true) +CONFIG_VARIABLE (bool, show_group_tabs, "show-group-tabs", true) +CONFIG_VARIABLE (bool, show_region_fades, "show-region-fades", true) CONFIG_VARIABLE (bool, use_video_file_fps, "use-video-file-fps", false) CONFIG_VARIABLE (bool, videotimeline_pullup, "videotimeline-pullup", true) CONFIG_VARIABLE (bool, show_busses_on_meterbridge, "show-busses-on-meterbridge", false) @@ -68,3 +74,14 @@ CONFIG_VARIABLE (bool, show_solo_on_meterbridge, "show-solo-on-meterbridge", fal CONFIG_VARIABLE (bool, show_monitor_on_meterbridge, "show-monitor-on-meterbridge", false) CONFIG_VARIABLE (bool, show_name_on_meterbridge, "show-name-on-meterbridge", true) CONFIG_VARIABLE (uint32_t, meterbridge_label_height, "meterbridge-label-height", 0) + +#ifdef USE_TRACKS_CODE_FEATURES +/* This variable was not discussed with Ardour developers and is considered + weakly conceived. It is also poorly named, since we have "groups" already + present in libardour but this variable has nothing to do with it. There + should have been more discussion about what was required and the best + way to accomplish it. +*/ +CONFIG_VARIABLE (bool, enable_group_edit, "enable-group-edit", false) +/* These are GUI-only properties and should not be present in this context */ +#endif diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 96145e7b29..a8c17a1ddb 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -134,6 +134,7 @@ public: static const framepos_t Immediate = -1; + static bool has_per_thread_pool (); static void create_per_thread_pool (const std::string& n, uint32_t nitems); static void init_event_pool (); diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 8396a337d7..bda47ceba0 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -237,19 +237,21 @@ struct LIBARDOUR_API SafeTime { class LIBARDOUR_API TimecodeSlave : public Slave { public: - TimecodeSlave () {} - - virtual Timecode::TimecodeFormat apparent_timecode_format() const = 0; - - /* this is intended to be used by a UI and polled from a timeout. it should - return a string describing the current position of the TC source. it - should NOT do any computation, but should use a cached value - of the TC source position. - */ - virtual std::string approximate_current_position() const = 0; - - framepos_t timecode_offset; - bool timecode_negative_offset; + TimecodeSlave () {} + + virtual Timecode::TimecodeFormat apparent_timecode_format() const = 0; + + /* this is intended to be used by a UI and polled from a timeout. it should + return a string describing the current position of the TC source. it + should NOT do any computation, but should use a cached value + of the TC source position. + */ + virtual std::string approximate_current_position() const = 0; + + framepos_t timecode_offset; + bool timecode_negative_offset; + + PBD::Signal1<void, bool> ActiveChanged; }; class LIBARDOUR_API MTC_Slave : public TimecodeSlave { diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 5a4a11515c..45e049e35f 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -66,6 +66,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { bool set_destructive (bool yn); bool one_of_several_channels () const; + uint32_t channel_count () const { return _info.channels; } bool clamped_at_unity () const; diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 24a3f53fe9..d5ae2959c6 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -323,7 +323,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible void change_initial_tempo (double bpm, double note_type); void insert_time (framepos_t, framecnt_t); - bool cut_time (framepos_t where, framecnt_t amount); //returns true if anything was moved + bool remove_time (framepos_t where, framecnt_t amount); //returns true if anything was moved int n_tempos () const; int n_meters () const; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index b1b4388a74..17e0b0d7e4 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -456,6 +456,11 @@ namespace ARDOUR { AutoConnectPhysical = 0x1, AutoConnectMaster = 0x2 }; + + enum TracksAutoNamingRule { + UseDefaultNames = 0x1, + NameAfterDriver = 0x2 + }; enum SampleFormat { FormatFloat = 0, @@ -623,6 +628,20 @@ namespace ARDOUR { uint32_t max; //< samples }; + enum BufferingPreset { + Small, + Medium, + Large, + Custom, + }; + + enum AutoReturnTarget { + LastLocate = 0x1, + RangeSelectionStart = 0x2, + Loop = 0x4, + RegionSelectionStart = 0x8, + }; + } // namespace ARDOUR @@ -632,6 +651,7 @@ namespace ARDOUR { std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf); +std::istream& operator>>(std::istream& o, ARDOUR::TracksAutoNamingRule& sf); std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf); std::istream& operator>>(std::istream& o, ARDOUR::MonitorModel& sf); std::istream& operator>>(std::istream& o, ARDOUR::PFLPosition& sf); @@ -648,10 +668,14 @@ std::istream& operator>>(std::istream& o, ARDOUR::DenormalModel& sf); std::istream& operator>>(std::istream& o, ARDOUR::PositionLockStyle& sf); std::istream& operator>>(std::istream& o, ARDOUR::FadeShape& sf); std::istream& operator>>(std::istream& o, ARDOUR::RegionSelectionAfterSplit& sf); +std::istream& operator>>(std::istream& o, ARDOUR::BufferingPreset& var); +std::istream& operator>>(std::istream& o, ARDOUR::AutoReturnTarget& sf); +std::istream& operator>>(std::istream& o, ARDOUR::MeterType& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoConnectOption& sf); +std::ostream& operator<<(std::ostream& o, const ARDOUR::TracksAutoNamingRule& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::EditMode& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::MonitorModel& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::PFLPosition& sf); @@ -668,7 +692,9 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::DenormalModel& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::PositionLockStyle& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::FadeShape& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::RegionSelectionAfterSplit& sf); - +std::ostream& operator<<(std::ostream& o, const ARDOUR::BufferingPreset& var); +std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoReturnTarget& sf); +std::ostream& operator<<(std::ostream& o, const ARDOUR::MeterType& sf); /* because these operators work on types which can be used when making a UI_CONFIG_VARIABLE (in gtk2_ardour) we need them to be exported. diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 4b71c1586e..682206f58a 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -161,8 +161,6 @@ LIBARDOUR_API double slider_position_to_gain_with_max (double g, double max_gain #define METER_FALLOFF_MODERATE 13.3f // EBU-PPM, IRT PPM- 20dB / 1.5 sec #define METER_FALLOFF_MEDIUM 20.0f #define METER_FALLOFF_FAST 32.0f -#define METER_FALLOFF_FASTER 46.0f -#define METER_FALLOFF_FASTEST 70.0f LIBARDOUR_API float meter_falloff_to_float (ARDOUR::MeterFalloff); LIBARDOUR_API ARDOUR::MeterFalloff meter_falloff_from_float (float); diff --git a/libs/ardour/ardour/vst_info_file.h b/libs/ardour/ardour/vst_info_file.h index 5e613801a6..62c3484c80 100644 --- a/libs/ardour/ardour/vst_info_file.h +++ b/libs/ardour/ardour/vst_info_file.h @@ -25,6 +25,20 @@ #include "ardour/vst_types.h" #include <vector> +/* Cache File extensions */ +# if ( defined(__x86_64__) || defined(_M_X64) ) +# define VST_EXT_BLACKLIST ".fsb64" +#else +# define VST_EXT_BLACKLIST ".fsb" +#endif + +#define VST_EXT_ERRORFILE ".err" +# if ( defined(__x86_64__) || defined(_M_X64) ) +#define VST_EXT_INFOFILE ".fsi64" +#else +#define VST_EXT_INFOFILE ".fsi" +#endif + #ifndef VST_SCANNER_APP namespace ARDOUR { #endif |