summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-09-25 12:16:13 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-09-25 12:16:13 -0600
commit5ec5bc4523e5c0fd998a6a133c6a03ab1475f063 (patch)
treef9ef6c71d72ff95a4824c417ec874e8768627db7
parent13c874d8b071e4d1d540ec7da2d76856ef228918 (diff)
goodbye USE_TRACKS_CODE_FEATURES and is_tracks_build
-rw-r--r--libs/ardour/ardour/audioengine.h2
-rw-r--r--libs/ardour/ardour/engine_state_controller.h652
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h20
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/ardour/session_configuration_vars.h11
-rw-r--r--libs/ardour/audioengine.cc12
-rw-r--r--libs/ardour/engine_state_controller.cc1906
-rw-r--r--libs/ardour/filesystem_paths.cc8
-rw-r--r--libs/ardour/route.cc60
-rw-r--r--libs/ardour/session.cc336
-rw-r--r--libs/ardour/session_transport.cc79
-rw-r--r--libs/ardour/wscript2
-rw-r--r--libs/canvas/xfade_curve.cc4
-rw-r--r--libs/gtkmm2ext/cairo_widget.cc94
-rw-r--r--libs/panners/wscript10
-rw-r--r--wscript13
16 files changed, 4 insertions, 3208 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 09f3b46486..3d08759787 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -156,8 +156,6 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
void remove_session (); // not a replacement for SessionHandle::session_going_away()
Session* session() const { return _session; }
- void reconnect_session_routes (bool reconnect_inputs = true, bool reconnect_outputs = true);
-
class NoBackendAvailable : public std::exception {
public:
virtual const char *what() const throw() { return "could not connect to engine backend"; }
diff --git a/libs/ardour/ardour/engine_state_controller.h b/libs/ardour/ardour/engine_state_controller.h
deleted file mode 100644
index e64a7a6975..0000000000
--- a/libs/ardour/ardour/engine_state_controller.h
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Paul Davis <paul@linuxaudiosystems.com>
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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::samplecnt_t get_current_sample_rate () const;
-
- /** Get default sample rate for current backend.
- *
- * @return default sample rate for current backend
- */
- ARDOUR::samplecnt_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(samplecnt_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::samplecnt_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::samplecnt_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/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h
index 3fb4404756..47ba9c1e7f 100644
--- a/libs/ardour/ardour/rc_configuration_vars.h
+++ b/libs/ardour/ardour/rc_configuration_vars.h
@@ -76,9 +76,6 @@ CONFIG_VARIABLE (bool, midi_input_follows_selection, "midi-input-follows-selecti
CONFIG_VARIABLE (bool, run_all_transport_masters_always, "run-all-transport-masters-always", true)
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 (SyncSource, sync_source, "sync-source", MTC)
-#endif
CONFIG_VARIABLE (bool, send_ltc, "send-ltc", false)
CONFIG_VARIABLE (bool, ltc_send_continuously, "ltc-send-continuously", true)
CONFIG_VARIABLE (std::string, ltc_output_port, "ltc-output-port", "")
@@ -120,11 +117,7 @@ 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)
@@ -169,11 +162,7 @@ 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)
CONFIG_VARIABLE (float, preroll_seconds, "preroll-seconds", -2.0f)
-#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 (samplecnt_t, preroll, "preroll", 0)
CONFIG_VARIABLE (samplecnt_t, postroll, "postroll", 0)
CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle
@@ -183,21 +172,12 @@ 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", MeterK14)
-#endif
CONFIG_VARIABLE (MeterType, meter_type_track, "meter-type-track", MeterPeak)
CONFIG_VARIABLE (MeterType, meter_type_bus, "meter-type-bus", MeterPeak)
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 3e7b4eaea3..a198f0eac6 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1232,9 +1232,6 @@ protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);
void set_sample_rate (samplecnt_t nframes);
-#ifdef USE_TRACKS_CODE_FEATURES
- void reconnect_existing_routes (bool withLock, bool reconnect_master = true, bool reconnect_inputs = true, bool reconnect_outputs = true);
-#endif
friend class Route;
void update_latency_compensation (bool force = false);
diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h
index 22f80dd2b8..75babeb706 100644
--- a/libs/ardour/ardour/session_configuration_vars.h
+++ b/libs/ardour/ardour/session_configuration_vars.h
@@ -89,14 +89,3 @@ 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/audioengine.cc b/libs/ardour/audioengine.cc
index 7fe9bebed1..fe8ed27bbb 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -689,18 +689,6 @@ AudioEngine::remove_session ()
remove_all_ports ();
}
-
-void
-AudioEngine::reconnect_session_routes (bool reconnect_inputs, bool reconnect_outputs)
-{
-#ifdef USE_TRACKS_CODE_FEATURES
- if (_session) {
- _session->reconnect_existing_routes(true, true, reconnect_inputs, reconnect_outputs);
- }
-#endif
-}
-
-
void
AudioEngine::died ()
{
diff --git a/libs/ardour/engine_state_controller.cc b/libs/ardour/engine_state_controller.cc
deleted file mode 100644
index 1a3d9978e6..0000000000
--- a/libs/ardour/engine_state_controller.cc
+++ /dev/null
@@ -1,1906 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Paul Davis <paul@linuxaudiosystems.com>
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "ardour/engine_state_controller.h"
-
-#include "ardour/audioengine.h"
-#include "ardour/session.h"
-#include "ardour/rc_configuration.h"
-#include "ardour/data_type.h"
-
-#include "pbd/pthread_utils.h"
-#include "pbd/error.h"
-#include "pbd/i18n.h"
-
-
-using namespace ARDOUR;
-using namespace PBD;
-
-namespace {
-
-struct DevicePredicate
-{
- DevicePredicate (const std::string& device_name)
- : _device_name (device_name)
- {}
-
- bool operator ()(const AudioBackend::DeviceStatus& rhs)
- {
- return _device_name == rhs.name;
- }
-
- private:
- std::string _device_name;
-};
-}
-
-EngineStateController*
-EngineStateController::instance ()
-{
- static EngineStateController instance;
- return &instance;
-}
-
-
-EngineStateController::EngineStateController ()
- : _current_state ()
- , _last_used_real_device ("")
-
-{
- AudioEngine::instance ()->Running.connect_same_thread (running_connection, boost::bind (&EngineStateController::_on_engine_running, this));
- AudioEngine::instance ()->Stopped.connect_same_thread (stopped_connection, boost::bind (&EngineStateController::_on_engine_stopped, this));
- AudioEngine::instance ()->Halted.connect_same_thread (stopped_connection, boost::bind (&EngineStateController::_on_engine_stopped, this));
-
- /* Subscribe for udpates from AudioEngine */
- AudioEngine::instance ()->PortRegisteredOrUnregistered.connect_same_thread (update_connections, boost::bind (&EngineStateController::_on_ports_registration_update, this));
- AudioEngine::instance ()->SampleRateChanged.connect_same_thread (update_connections, boost::bind (&EngineStateController::_on_sample_rate_change, this, _1));
- AudioEngine::instance ()->BufferSizeChanged.connect_same_thread (update_connections, boost::bind (&EngineStateController::_on_buffer_size_change, this, _1));
- AudioEngine::instance ()->DeviceListChanged.connect_same_thread (update_connections, boost::bind (&EngineStateController::_on_device_list_change, this));
- AudioEngine::instance ()->DeviceError.connect_same_thread (update_connections, boost::bind (&EngineStateController::_on_device_error, this));
-
- /* Global configuration parameters update */
- Config->ParameterChanged.connect_same_thread (update_connections, boost::bind (&EngineStateController::_on_parameter_changed, this, _1));
-
- _deserialize_and_load_engine_states ();
- _deserialize_and_load_midi_port_states ();
- _do_initial_engine_setup ();
-
- // now push the sate to the backend
- push_current_state_to_backend (false);
-}
-
-
-EngineStateController::~EngineStateController ()
-{
-}
-
-
-void
-EngineStateController::set_session (Session* session)
-{
- _session = session;
- _session->SessionLoaded.connect_same_thread (session_connections, boost::bind (&EngineStateController::_on_session_loaded, this));
-}
-
-
-void
-EngineStateController::remove_session ()
-{
- session_connections.drop_connections ();
- _session = 0;
-}
-
-
-XMLNode&
-EngineStateController::serialize_audio_midi_settings ()
-{
-
- XMLNode* root = new XMLNode ("AudioMidiSettings");
-
- _serialize_engine_states (root);
- _serialize_midi_port_states (root);
-
- return *root;
-}
-
-
-void
-EngineStateController::save_audio_midi_settings ()
-{
- Config->add_extra_xml (serialize_audio_midi_settings ());
- Config->save_state ();
-}
-
-
-void
-EngineStateController::_deserialize_and_load_engine_states ()
-{
- XMLNode* audio_midi_settings_root = ARDOUR::Config->extra_xml ("AudioMidiSettings");
-
- if (!audio_midi_settings_root) {
- return;
- }
-
- XMLNode* engine_states = audio_midi_settings_root->child ("EngineStates");
-
- if (!engine_states) {
- return;
- }
-
- XMLNodeList state_nodes_list = engine_states->children ();
- XMLNodeConstIterator state_node_iter = state_nodes_list.begin ();
-
- for (; state_node_iter != state_nodes_list.end (); ++state_node_iter) {
-
- XMLNode* state_node = *state_node_iter;
- StatePtr engine_state (new State);
- XMLProperty const * prop = NULL;
-
- if ((prop = state_node->property ("backend-name")) == 0) {
- continue;
- }
- engine_state->backend_name = prop->value ();
-
- if ((prop = state_node->property ("device-name")) == 0) {
- continue;
- }
- engine_state->device_name = prop->value ();
-
- if ((prop = state_node->property ("sample-rate")) == 0) {
- continue;
- }
- engine_state->sample_rate = atoi (prop->value ());
-
- if ((prop = state_node->property ("buffer-size")) == 0) {
- continue;
- }
- engine_state->buffer_size = atoi (prop->value ());
-
- if ((prop = state_node->property ("active")) == 0) {
- continue;
- }
- engine_state->active = string_is_affirmative (prop->value ());
-
- XMLNodeList state_children_list = state_node->children ();
- XMLNodeConstIterator state_child_iter = state_children_list.begin ();
-
- for (; state_child_iter != state_children_list.end (); ++state_child_iter) {
- XMLNode* state_child = *state_child_iter;
-
- if (state_child->name () == "InputConfiguration") {
-
- XMLNodeList input_states_nodes = state_child->children ();
- XMLNodeConstIterator input_state_node_iter = input_states_nodes.begin ();
- PortStateList& input_states = engine_state->input_channel_states;
-
- for (; input_state_node_iter != input_states_nodes.end (); ++input_state_node_iter) {
-
- XMLNode* input_state_node = *input_state_node_iter;
-
- if (input_state_node->name () != "input") {
- continue;
- }
- PortState input_state (input_state_node->name ());
-
- if ((prop = input_state_node->property ("name")) == 0) {
- continue;
- }
- input_state.name = prop->value ();
-
- if ((prop = input_state_node->property ("active")) == 0) {
- continue;
- }
- input_state.active = string_is_affirmative (prop->value ());
-
- input_states.push_back (input_state);
- }
-
- } else if (state_child->name () == "MultiOutConfiguration") {
-
- XMLNodeList multi_out_state_nodes = state_child->children ();
- XMLNodeConstIterator multi_out_state_node_iter = multi_out_state_nodes.begin ();
- PortStateList& multi_out_states = engine_state->multi_out_channel_states;
-
- for (; multi_out_state_node_iter != multi_out_state_nodes.end (); ++multi_out_state_node_iter) {
-
- XMLNode* multi_out_state_node = *multi_out_state_node_iter;
-
- if (multi_out_state_node->name () != "output") {
- continue;
- }
- PortState multi_out_state (multi_out_state_node->name ());
-
- if ((prop = multi_out_state_node->property ("name")) == 0) {
- continue;
- }
- multi_out_state.name = prop->value ();
-
- if ((prop = multi_out_state_node->property ("active")) == 0) {
- continue;
- }
- multi_out_state.active = string_is_affirmative (prop->value ());
-
- multi_out_states.push_back (multi_out_state);
- }
- } else if (state_child->name () == "StereoOutConfiguration") {
-
- XMLNodeList stereo_out_state_nodes = state_child->children ();
- XMLNodeConstIterator stereo_out_state_node_iter = stereo_out_state_nodes.begin ();
- PortStateList& stereo_out_states = engine_state->stereo_out_channel_states;
-
- for (; stereo_out_state_node_iter != stereo_out_state_nodes.end (); ++stereo_out_state_node_iter) {
-
- XMLNode* stereo_out_state_node = *stereo_out_state_node_iter;
-
- if (stereo_out_state_node->name () != "output") {
- continue;
- }
- PortState stereo_out_state (stereo_out_state_node->name ());
-
- if ((prop = stereo_out_state_node->property ("name")) == 0) {
- continue;
- }
- stereo_out_state.name = prop->value ();
-
- if ((prop = stereo_out_state_node->property ("active")) == 0) {
- continue;
- }
- stereo_out_state.active = string_is_affirmative (prop->value ());
-
- stereo_out_states.push_back (stereo_out_state);
- }
- }
- }
-
- _states.push_back (engine_state);
- }
-}
-
-
-void
-EngineStateController::_deserialize_and_load_midi_port_states ()
-{
- XMLNode* audio_midi_settings_root = ARDOUR::Config->extra_xml ("AudioMidiSettings");
-
- if (!audio_midi_settings_root) {
- return;
- }
-
- XMLNode* midi_states = audio_midi_settings_root->child ("MidiStates");
-
- if (!midi_states) {
- return;
- }
-
- XMLNodeList state_nodes_list = midi_states->children ();
- XMLNodeConstIterator state_node_iter = state_nodes_list.begin ();
- for (; state_node_iter != state_nodes_list.end (); ++state_node_iter) {
-
- XMLNode* state_node = *state_node_iter;
- if (state_node->name () == "MidiInputs") {
-
- XMLNodeList input_state_nodes = state_node->children ();
- XMLNodeConstIterator input_state_node_iter = input_state_nodes.begin ();
- _midi_inputs.clear ();
-
- for (; input_state_node_iter != input_state_nodes.end (); ++input_state_node_iter) {
-
- XMLNode* input_state_node = *input_state_node_iter;
- XMLProperty const * prop = NULL;
-
- if (input_state_node->name () != "input") {
- continue;
- }
- MidiPortState input_state (input_state_node->name ());
-
- if ((prop = input_state_node->property ("name")) == 0) {
- continue;
- }
- input_state.name = prop->value ();
-
- if ((prop = input_state_node->property ("active")) == 0) {
- continue;
- }
- input_state.active = string_is_affirmative (prop->value ());
-
- if ((prop = input_state_node->property ("scene-connected")) == 0) {
- continue;
- }
- input_state.scene_connected = string_is_affirmative (prop->value ());
-
- if ((prop = input_state_node->property ("mtc-in")) == 0) {
- continue;
- }
- input_state.mtc_in = string_is_affirmative (prop->value ());
-
- _midi_inputs.push_back (input_state);
- }
-
- } else if (state_node->name () == "MidiOutputs") {
-
- XMLNodeList output_state_nodes = state_node->children ();
- XMLNodeConstIterator output_state_node_iter = output_state_nodes.begin ();
- _midi_outputs.clear ();
-
- for (; output_state_node_iter != output_state_nodes.end (); ++output_state_node_iter) {
-
- XMLNode* output_state_node = *output_state_node_iter;
- XMLProperty const * prop = NULL;
-
- if (output_state_node->name () != "output") {
- continue;
- }
- MidiPortState output_state (output_state_node->name ());
-
- if ((prop = output_state_node->property ("name")) == 0) {
- continue;
- }
- output_state.name = prop->value ();
-
- if ((prop = output_state_node->property ("active")) == 0) {
- continue;
- }
- output_state.active = string_is_affirmative (prop->value ());
-
- if ((prop = output_state_node->property ("scene-connected")) == 0) {
- continue;
- }
- output_state.scene_connected = string_is_affirmative (prop->value ());
-
- if ((prop = output_state_node->property ("mtc-in")) == 0) {
- continue;
- }
- output_state.mtc_in = string_is_affirmative (prop->value ());
-
- _midi_outputs.push_back (output_state);
- }
- }
- }
-}
-
-
-void
-EngineStateController::_serialize_engine_states (XMLNode* audio_midi_settings_node)
-{
- if (!audio_midi_settings_node) {
- return;
- }
-
- // clean up state data first
- audio_midi_settings_node->remove_nodes_and_delete ("EngineStates" );
-
- XMLNode* engine_states = new XMLNode ("EngineStates" );
-
- StateList::const_iterator state_iter = _states.begin ();
- for (; state_iter != _states.end (); ++state_iter) {
-
- StatePtr state_ptr = *state_iter;
-
- // create new node for the state
- XMLNode* state_node = new XMLNode ("State");
-
- state_node->add_property ("backend-name", state_ptr->backend_name);
- state_node->add_property ("device-name", state_ptr->device_name);
- state_node->add_property ("sample-rate", state_ptr->sample_rate);
- state_node->add_property ("buffer-size", state_ptr->buffer_size);
- state_node->add_property ("active", state_ptr->active ? "yes" : "no");
-
- // store channel states:
- // inputs
- XMLNode* input_config_node = new XMLNode ("InputConfiguration");
- PortStateList& input_channels = state_ptr->input_channel_states;
- PortStateList::const_iterator input_state_iter = input_channels.begin ();
- for (; input_state_iter != input_channels.end (); ++input_state_iter) {
- XMLNode* input_state_node = new XMLNode ("input");
- input_state_node->add_property ("name", input_state_iter->name);
- input_state_node->add_property ("active", input_state_iter->active ? "yes" : "no");
- input_config_node->add_child_nocopy (*input_state_node);
- }
- state_node->add_child_nocopy (*input_config_node);
-
- // multi out outputs
- XMLNode* multi_out_config_node = new XMLNode ("MultiOutConfiguration");
- PortStateList& multi_out_channels = state_ptr->multi_out_channel_states;
- PortStateList::const_iterator multi_out_state_iter = multi_out_channels.begin ();
- for (; multi_out_state_iter != multi_out_channels.end (); ++multi_out_state_iter) {
- XMLNode* multi_out_state_node = new XMLNode ("output" );
- multi_out_state_node->add_property ("name", multi_out_state_iter->name);
- multi_out_state_node->add_property ("active", multi_out_state_iter->active ? "yes" : "no");
- multi_out_config_node->add_child_nocopy (*multi_out_state_node);
- }
- state_node->add_child_nocopy (*multi_out_config_node);
-
- // stereo out outputs
- XMLNode* stereo_out_config_node = new XMLNode ("StereoOutConfiguration");
- PortStateList& stereo_out_channels = state_ptr->stereo_out_channel_states;
- PortStateList::const_iterator stereo_out_state_iter = stereo_out_channels.begin ();
- for (; stereo_out_state_iter != stereo_out_channels.end (); ++stereo_out_state_iter) {
- XMLNode* stereo_out_state_node = new XMLNode ("output" );
- stereo_out_state_node->add_property ("name", stereo_out_state_iter->name);
- stereo_out_state_node->add_property ("active", stereo_out_state_iter->active ? "yes" : "no");
- stereo_out_config_node->add_child_nocopy (*stereo_out_state_node);
- }
- state_node->add_child_nocopy (*stereo_out_config_node);
-
- engine_states->add_child_nocopy (*state_node);
- }
-
- audio_midi_settings_node->add_child_nocopy (*engine_states);
-}
-
-
-void
-EngineStateController::_serialize_midi_port_states (XMLNode* audio_midi_settings_node)
-{
- if (!audio_midi_settings_node) {
- return;
- }
-
- // clean up state data first
- audio_midi_settings_node->remove_nodes_and_delete ("MidiStates" );
-
- XMLNode* midi_states_node = new XMLNode ("MidiStates" );
-
- XMLNode* midi_input_states_node = new XMLNode ("MidiInputs" );
- MidiPortStateList::const_iterator midi_input_state_iter = _midi_inputs.begin ();
- for (; midi_input_state_iter != _midi_inputs.end (); ++midi_input_state_iter) {
- XMLNode* midi_input_node = new XMLNode ("input" );
- midi_input_node->add_property ("name", midi_input_state_iter->name);
- midi_input_node->add_property ("active", midi_input_state_iter->active ? "yes" : "no");
- midi_input_node->add_property ("scene_connected", midi_input_state_iter->scene_connected ? "yes" : "no");
- midi_input_node->add_property ("mtc-in", midi_input_state_iter->mtc_in ? "yes" : "no");
- midi_input_states_node->add_child_nocopy (*midi_input_node);
- }
- midi_states_node->add_child_nocopy (*midi_input_states_node);
-
- XMLNode* midi_output_states_node = new XMLNode ("MidiOutputs" );
- MidiPortStateList::const_iterator midi_output_state_iter = _midi_outputs.begin ();
- for (; midi_output_state_iter != _midi_outputs.end (); ++midi_output_state_iter) {
- XMLNode* midi_output_node = new XMLNode ("output" );
- midi_output_node->add_property ("name", midi_output_state_iter->name);
- midi_output_node->add_property ("active", midi_output_state_iter->active ? "yes" : "no");
- midi_output_node->add_property ("scene_connected", midi_output_state_iter->scene_connected ? "yes" : "no");
- midi_output_node->add_property ("mtc-in", midi_output_state_iter->mtc_in ? "yes" : "no");
- midi_output_states_node->add_child_nocopy (*midi_output_node);
- }
- midi_states_node->add_child_nocopy (*midi_output_states_node);
-
- audio_midi_settings_node->add_child_nocopy (*midi_states_node);
-}
-
-
-bool
-EngineStateController::_apply_state (const StatePtr& state)
-{
- bool applied = false;
-
- if (set_new_backend_as_current (state->backend_name)) {
- applied = set_new_device_as_current (state->device_name);
- }
-
- return applied;
-}
-
-
-void
-EngineStateController::_do_initial_engine_setup ()
-{
- bool state_applied = false;
-
- // if we have no saved state load default values
- if (!_states.empty ()) {
-
- // look for last active state first
- StateList::const_iterator state_iter = _states.begin ();
- for (; state_iter != _states.end (); ++state_iter) {
- if ( (*state_iter)->active ) {
- state_applied = _apply_state (*state_iter);
- break;
- }
- }
-
- // last active state was not applied
- // try others
- if (!state_applied) {
- StateList::const_iterator state_iter = _states.begin ();
- for (; state_iter != _states.end (); ++state_iter) {
- state_applied = _apply_state (*state_iter);
- break;
- }
- }
- }
-
- if (!state_applied ){
- std::vector<const AudioBackendInfo*> backends = AudioEngine::instance ()->available_backends ();
-
- if (!backends.empty ()) {
-
- if (!set_new_backend_as_current (backends.front ()->name )) {
- std::cerr << "\tfailed to set backend [" << backends.front ()->name << "]\n";
- }
- }
-
- }
-}
-
-
-bool
-EngineStateController::_validate_current_device_state ()
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
-
- // check if device parameters from the state record are still valid
- // validate sample rate
- std::vector<float> sample_rates = backend->available_sample_rates (_current_state->device_name);
-
- if (sample_rates.empty ()) {
- return false;
- }
-
- // check if session desired sample rate (if it's set) could be used with this device
- if (_session != 0) {
-
- if ( !set_new_sample_rate_in_controller (_session->nominal_sample_rate ())) {
- if ( !set_new_sample_rate_in_controller (backend->default_sample_rate ()) ) {
- if (!set_new_sample_rate_in_controller (sample_rates.front ()) ) {
- return false;
- }
- }
- }
-
- } else {
- // check if current sample rate is supported because we have no session desired sample rate value
- if ( !set_new_sample_rate_in_controller (_current_state->sample_rate)) {
- if ( !set_new_sample_rate_in_controller (backend->default_sample_rate ()) ) {
- if (!set_new_sample_rate_in_controller (sample_rates.front ()) ) {
- return false;
- }
- }
- }
- }
-
- // validate buffer size
- std::vector<pframes_t> buffer_sizes = backend->available_buffer_sizes (_current_state->device_name);
- // check if buffer size is supported
- std::vector<pframes_t>::iterator bs_iter = std::find (buffer_sizes.begin (), buffer_sizes.end (), _current_state->buffer_size);
- // if current is not found switch to default if is supported
- if (bs_iter == buffer_sizes.end ()) {
- bs_iter = std::find (buffer_sizes.begin (), buffer_sizes.end (), backend->default_buffer_size (_current_state->device_name));
-
- if (bs_iter != buffer_sizes.end ()) {
- _current_state->buffer_size = backend->default_buffer_size (_current_state->device_name);
- } else {
- if (!buffer_sizes.empty ()) {
- _current_state->buffer_size = buffer_sizes.front ();
- }
- }
-
- }
-
- return true;
-}
-
-
-void
-EngineStateController::_update_ltc_source_port ()
-{
- // this method is called if the list of ports is changed
-
- // check that ltc-in port from Config still exists
- if (_audio_input_port_exists (get_ltc_source_port ())) {
- // audio port, that was saved in Config, exists
- return ;
- }
-
- //otherwise set first available audio port
- if (!_current_state->input_channel_states.empty ()) {
- set_ltc_source_port (_current_state->input_channel_states.front ().name);
- return ;
- }
-
- // no available audio-in ports
- set_ltc_source_port ("");
-}
-
-void
-EngineStateController::_update_ltc_output_port ()
-{
- // this method is called if the list of ports is changed
-
- // check that ltc-out port from Config still exists
- if (_audio_output_port_exists (get_ltc_output_port ())) {
- // audio port, that was saved in Config, exists
- return ;
- }
-
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- //otherwise set first available audio port
- if (!output_states->empty ()) {
- set_ltc_output_port (output_states->front ().name);
- return ;
- }
-
- // no available audio-out ports
- set_ltc_output_port ("");
-}
-
-
-bool
-EngineStateController::_audio_input_port_exists (const std::string& port_name)
-{
- PortStateList::const_iterator iter = _current_state->input_channel_states.begin ();
- for (; iter != _current_state->input_channel_states.end (); ++iter ) {
- if (iter->name == port_name)
- return true;
- }
- return false;
-}
-
-bool
-EngineStateController::_audio_output_port_exists (const std::string& port_name)
-{
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- PortStateList::const_iterator iter = output_states->begin ();
- for (; iter != output_states->end (); ++iter ) {
- if (iter->name == port_name)
- return true;
- }
- return false;
-}
-
-
-const std::string&
-EngineStateController::get_current_backend_name () const
-{
- return _current_state->backend_name;
-}
-
-
-const std::string&
-EngineStateController::get_current_device_name () const
-{
- return _current_state->device_name;
-}
-
-
-void
-EngineStateController::available_backends (std::vector<const AudioBackendInfo*>& available_backends)
-{
- available_backends = AudioEngine::instance ()->available_backends ();
-}
-
-
-void
-EngineStateController::enumerate_devices (std::vector<AudioBackend::DeviceStatus>& device_vector) const
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
- device_vector = backend->enumerate_devices ();
-}
-
-
-samplecnt_t
-EngineStateController::get_current_sample_rate () const
-{
- return _current_state->sample_rate;
-}
-
-
-samplecnt_t
-EngineStateController::get_default_sample_rate () const
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
- return backend->default_sample_rate ();
-}
-
-
-void
-EngineStateController::available_sample_rates_for_current_device (std::vector<float>& sample_rates) const
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
- sample_rates = backend->available_sample_rates (_current_state->device_name);
-}
-
-
-uint32_t
-EngineStateController::get_current_buffer_size () const
-{
- return _current_state->buffer_size;
-}
-
-
-uint32_t
-EngineStateController::get_default_buffer_size () const
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
- return backend->default_buffer_size (_current_state->device_name);
-}
-
-
-void
-EngineStateController::available_buffer_sizes_for_current_device (std::vector<pframes_t>& buffer_sizes) const
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
- buffer_sizes = backend->available_buffer_sizes (_current_state->device_name);
-}
-
-
-bool
-EngineStateController::set_new_backend_as_current (const std::string& backend_name)
-{
- if (backend_name == AudioEngine::instance ()->current_backend_name ()) {
- return true;
- }
-
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->set_backend (backend_name, PROGRAM_NAME, "");
- if (backend)
- {
- if (_current_state != NULL) {
- _current_state->active = false;
- }
-
- StateList::iterator found_state_iter = find_if (_states.begin (), _states.end (),
- State::StatePredicate (backend_name, "None"));
-
- if (found_state_iter != _states.end ()) {
- // we found a record for new engine with None device - switch to it
- _current_state = *found_state_iter;
- _validate_current_device_state ();
- } else {
- // create new record for this engine with default device
- _current_state = boost::shared_ptr<State>(new State ());
- _current_state->backend_name = backend_name;
- _current_state->device_name = "None";
- _validate_current_device_state ();
- _states.push_front (_current_state);
- }
-
- push_current_state_to_backend (false);
-
- return true;
- }
-
- return false;
-}
-
-
-bool
-EngineStateController::set_new_device_as_current (const std::string& device_name)
-{
- if (_current_state->device_name == device_name) {
- return true;
- }
-
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
-
- std::vector<AudioBackend::DeviceStatus> device_vector = backend->enumerate_devices ();
-
- // validate the device
- std::vector<AudioBackend::DeviceStatus>::iterator device_iter;
- device_iter = std::find_if (device_vector.begin (), device_vector.end (), DevicePredicate (device_name));
-
- // device is available
- if (device_iter != device_vector.end ()) {
-
- boost::shared_ptr<State> previous_state (_current_state);
-
- // look through state list and find the record for this device and current engine
- StateList::iterator found_state_iter = find_if (_states.begin (), _states.end (),
- State::StatePredicate (backend->name (), device_name));
-
- if (found_state_iter != _states.end ())
- {
- // we found a record for current engine and provided device name - switch to it
-
- _current_state = *found_state_iter;
-
- if (!_validate_current_device_state ()) {
- _current_state = previous_state;
- return false;
- }
-
- } else {
-
- // the record is not found, create new one
- _current_state = boost::shared_ptr<State>(new State ());
-
- _current_state->backend_name = backend->name ();
- _current_state->device_name = device_name;
-
- if (!_validate_current_device_state ()) {
- _current_state = previous_state;
- return false;
- }
-
- _states.push_front (_current_state);
- }
-
- if (previous_state != NULL) {
- previous_state->active = false;
- }
-
- push_current_state_to_backend (false);
-
- _last_used_real_device.clear ();
-
- if (device_name != "None") {
- _last_used_real_device = device_name;
- }
-
- return true;
- }
-
- // device is not supported by current backend
- return false;
-}
-
-
-bool
-EngineStateController::set_new_sample_rate_in_controller (samplecnt_t sample_rate)
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
-
- std::vector<float> sample_rates = backend->available_sample_rates (_current_state->device_name);
- std::vector<float>::iterator iter = std::find (sample_rates.begin (), sample_rates.end (), (float)sample_rate);
-
- if (iter != sample_rates.end ()) {
- _current_state->sample_rate = sample_rate;
- return true;
- }
-
- return false;
-}
-
-
-bool
-EngineStateController::set_new_buffer_size_in_controller (pframes_t buffer_size)
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
-
- std::vector<uint32_t> buffer_sizes = backend->available_buffer_sizes (_current_state->device_name);
- std::vector<uint32_t>::iterator iter = std::find (buffer_sizes.begin (), buffer_sizes.end (), buffer_size);
-
- if (iter != buffer_sizes.end ()) {
- _current_state->buffer_size = buffer_size;
- return true;
- }
-
- return false;
-}
-
-
-uint32_t
-EngineStateController::get_available_inputs_count () const
-{
- uint32_t available_channel_count = 0;
-
- PortStateList::const_iterator iter = _current_state->input_channel_states.begin ();
-
- for (; iter != _current_state->input_channel_states.end (); ++iter) {
- if (iter->active) {
- ++available_channel_count;
- }
- }
-
- return available_channel_count;
-}
-
-
-uint32_t
-EngineStateController::get_available_outputs_count () const
-{
- uint32_t available_channel_count = 0;
-
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- PortStateList::const_iterator iter = output_states->begin ();
-
- for (; iter != output_states->end (); ++iter) {
- if (iter->active) {
- ++available_channel_count;
- }
- }
-
- return available_channel_count;
-}
-
-
-void
-EngineStateController::get_physical_audio_inputs (std::vector<std::string>& port_names)
-{
- port_names.clear ();
-
- PortStateList &input_states = _current_state->input_channel_states;
-
- PortStateList::iterator iter = input_states.begin ();
- for (; iter != input_states.end (); ++iter) {
- if (iter->active) {
- port_names.push_back (iter->name);
- }
- }
-}
-
-
-void
-EngineStateController::get_physical_audio_outputs (std::vector<std::string>& port_names)
-{
- port_names.clear ();
-
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- PortStateList::iterator iter = output_states->begin ();
- for (; iter != output_states->end (); ++iter) {
- if (iter->active) {
- port_names.push_back (iter->name);
- }
- }
-}
-
-
-void
-EngineStateController::get_physical_midi_inputs (std::vector<std::string>& port_names)
-{
- port_names.clear ();
-
- MidiPortStateList::iterator iter = _midi_inputs.begin ();
- for (; iter != _midi_inputs.end (); ++iter) {
- if (iter->available && iter->active) {
- port_names.push_back (iter->name);
- }
- }
-}
-
-
-void
-EngineStateController::get_physical_midi_outputs (std::vector<std::string>& port_names)
-{
- port_names.clear ();
-
- MidiPortStateList::iterator iter = _midi_outputs.begin ();
- for (; iter != _midi_outputs.end (); ++iter) {
- if (iter->available && iter->active) {
- port_names.push_back (iter->name);
- }
- }
-}
-
-
-void
-EngineStateController::set_physical_audio_input_state (const std::string& port_name, bool state)
-{
- PortStateList &input_states = _current_state->input_channel_states;
- PortStateList::iterator found_state_iter;
- found_state_iter = std::find (input_states.begin (), input_states.end (), PortState (port_name));
-
- if (found_state_iter != input_states.end () && found_state_iter->active != state ) {
- found_state_iter->active = state;
- AudioEngine::instance ()->reconnect_session_routes (true, false);
-
- InputConfigChanged ();
- }
-}
-
-
-void
-EngineStateController::set_physical_audio_output_state (const std::string& port_name, bool state)
-{
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- PortStateList::iterator target_state_iter;
- target_state_iter = std::find (output_states->begin (), output_states->end (), PortState (port_name));
-
- if (target_state_iter != output_states->end () && target_state_iter->active != state ) {
- target_state_iter->active = state;
-
- // if StereoOut mode is used
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
-
- // get next element
- PortStateList::iterator next_state_iter (target_state_iter);
-
- // loopback
- if (++next_state_iter == output_states->end ()) {
- next_state_iter = output_states->begin ();
- }
-
-
- // only two outputs should be enabled
- if (output_states->size () <= 2) {
-
- target_state_iter->active = true;
- next_state_iter->active = true;
-
- } else {
-
- // if current was set to active - activate next and disable the rest
- if (target_state_iter->active ) {
- next_state_iter->active = true;
- } else {
- // if current was deactivated but the next is active
- if (next_state_iter->active) {
- if (++next_state_iter == output_states->end ()) {
- next_state_iter = output_states->begin ();
- }
- next_state_iter->active = true;
- } else {
- // if current was deactivated but the previous is active - restore the state of current
- target_state_iter->active = true; // state restored;
- --target_state_iter; // switch to previous to make it stop point in the next cycle
- target_state_iter->active = true;
- }
- }
-
- // now deactivate the rest
- while (++next_state_iter != target_state_iter) {
-
- if (next_state_iter == output_states->end ()) {
- next_state_iter = output_states->begin ();
- // we jumped, so additional check is required
- if (next_state_iter == target_state_iter) {
- break;
- }
- }
-
- next_state_iter->active = false;
- }
-
- }
- }
-
- AudioEngine::instance ()->reconnect_session_routes (false, true);
- OutputConfigChanged ();
- }
-}
-
-
-bool
-EngineStateController::get_physical_audio_input_state (const std::string& port_name)
-{
- bool state = false;
-
- PortStateList &input_states = _current_state->input_channel_states;
- PortStateList::iterator found_state_iter;
- found_state_iter = std::find (input_states.begin (), input_states.end (), PortState (port_name));
-
- if (found_state_iter != input_states.end ()) {
- state = found_state_iter->active;
- }
-
- return state;
-}
-
-
-bool
-EngineStateController::get_physical_audio_output_state (const std::string& port_name)
-{
- bool state = false;
-
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- PortStateList::iterator found_state_iter;
- found_state_iter = std::find (output_states->begin (), output_states->end (), PortState (port_name));
-
- if (found_state_iter != output_states->end ()) {
- state = found_state_iter->active;
- }
-
- return state;
-}
-
-
-void
-EngineStateController::set_physical_midi_input_state (const std::string& port_name, bool state) {
-
- MidiPortStateList::iterator found_state_iter;
- found_state_iter = std::find (_midi_inputs.begin (), _midi_inputs.end (), MidiPortState (port_name));
-
- if (found_state_iter != _midi_inputs.end () && found_state_iter->available && found_state_iter->active != state ) {
- found_state_iter->active = state;
-
- if (_session) {
- // reconnect MTC inputs as well
- if (found_state_iter->mtc_in) {
- _session->reconnect_mtc_ports ();
- }
- _session->reconnect_mmc_ports (true);
- }
-
- MIDIInputConfigChanged ();
- }
-}
-
-
-void
-EngineStateController::set_physical_midi_output_state (const std::string& port_name, bool state) {
-
- MidiPortStateList::iterator found_state_iter;
- found_state_iter = std::find (_midi_outputs.begin (), _midi_outputs.end (), MidiPortState (port_name));
-
- if (found_state_iter != _midi_outputs.end () && found_state_iter->available && found_state_iter->active != state ) {
- found_state_iter->active = state;
-
- if (_session) {
- _session->reconnect_mmc_ports (false);
- }
-
- MIDIOutputConfigChanged ();
- }
-}
-
-
-bool
-EngineStateController::get_physical_midi_input_state (const std::string& port_name, bool& scene_connected) {
-
- bool state = false;
-
- MidiPortStateList::iterator found_state_iter;
- found_state_iter = std::find (_midi_inputs.begin (), _midi_inputs.end (), MidiPortState (port_name));
-
- if (found_state_iter != _midi_inputs.end () && found_state_iter->available) {
- state = found_state_iter->active;
- scene_connected = found_state_iter->scene_connected;
- }
-
- return state;
-}
-
-
-bool
-EngineStateController::get_physical_midi_output_state (const std::string& port_name, bool& scene_connected) {
-
- bool state = false;
-
- MidiPortStateList::iterator found_state_iter;
- found_state_iter = std::find (_midi_outputs.begin (), _midi_outputs.end (), MidiPortState (port_name));
-
- if (found_state_iter != _midi_outputs.end () && found_state_iter->available) {
- state = found_state_iter->active;
- scene_connected = found_state_iter->scene_connected;
- }
-
- return state;
-}
-
-
-void
-EngineStateController::set_physical_midi_scene_in_connection_state (const std::string& port_name, bool state) {
-
- MidiPortStateList::iterator found_state_iter;
- found_state_iter = std::find (_midi_inputs.begin (), _midi_inputs.end (), MidiPortState (port_name));
-
- if (found_state_iter != _midi_inputs.end () && found_state_iter->available && found_state_iter->active ) {
- found_state_iter->scene_connected = state;
-
- std::vector<std::string> ports;
- ports.push_back (port_name);
- MIDISceneInputConnectionChanged (ports, state);
- }
-
-}
-
-
-void
-EngineStateController::set_physical_midi_scenen_out_connection_state (const std::string& port_name, bool state) {
-
- MidiPortStateList::iterator found_state_iter;
- found_state_iter = std::find (_midi_outputs.begin (), _midi_outputs.end (), MidiPortState (port_name));
-
- if (found_state_iter != _midi_outputs.end () && found_state_iter->available && found_state_iter->active ) {
- found_state_iter->scene_connected = state;
-
- std::vector<std::string> ports;
- ports.push_back (port_name);
- MIDISceneOutputConnectionChanged (ports, state);
- }
-
-}
-
-
-void
-EngineStateController::set_all_midi_scene_inputs_disconnected ()
-{
- MidiPortStateList::iterator iter = _midi_inputs.begin ();
- for (; iter != _midi_inputs.end (); ++iter) {
- iter->scene_connected = false;
- }
-
- std::vector<std::string> ports;
- MIDISceneInputConnectionChanged (ports, false);
-}
-
-
-void
-EngineStateController::set_all_midi_scene_outputs_disconnected ()
-{
- MidiPortStateList::iterator iter = _midi_outputs.begin ();
- for (; iter != _midi_outputs.end (); ++iter) {
- iter->scene_connected = false;
- }
-
- std::vector<std::string> ports;
- MIDISceneOutputConnectionChanged (ports, false);
-}
-
-
-void
-EngineStateController::set_mtc_source_port (const std::string& port_name)
-{
- MidiPortStateList::iterator iter = _midi_inputs.begin ();
- for (; iter != _midi_inputs.end (); ++iter) {
- iter->mtc_in = false;
-
- if (iter->name == port_name) {
- iter->mtc_in = true;
-
- if (_session) {
- _session->reconnect_mtc_ports ();
- }
- }
- }
-
- if (_session && port_name.empty ()) {
- _session->reconnect_mtc_ports ();
- }
-
- MTCInputChanged (port_name);
-}
-
-
-void
-EngineStateController::set_state_to_all_inputs (bool state)
-{
- bool something_changed = false;
-
- PortStateList::iterator iter = _current_state->input_channel_states.begin ();
- for (; iter != _current_state->input_channel_states.end (); ++iter) {
- if (iter->active != state) {
- iter->active = state;
- something_changed = true;
- }
- }
-
- if (something_changed) {
- AudioEngine::instance ()->reconnect_session_routes (true, false);
- InputConfigChanged ();
- }
-}
-
-
-void
-EngineStateController::set_state_to_all_outputs (bool state)
-{
- // unapplicable in Stereo Out mode, just return
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- return;
- }
-
- bool something_changed = false;
-
- PortStateList::iterator iter = _current_state->multi_out_channel_states.begin ();
- for (; iter != _current_state->multi_out_channel_states.end (); ++iter) {
- if (iter->active != state) {
- iter->active = state;
- something_changed = true;
- }
- }
-
- if (something_changed) {
- AudioEngine::instance ()->reconnect_session_routes (false, true);
- OutputConfigChanged ();
- }
-}
-
-
-void
-EngineStateController::get_physical_audio_input_states (std::vector<PortState>& channel_states)
-{
- PortStateList &input_states = _current_state->input_channel_states;
- channel_states.assign (input_states.begin (), input_states.end ());
-}
-
-
-void
-EngineStateController::get_physical_audio_output_states (std::vector<PortState>& channel_states)
-{
- PortStateList* output_states;
- if (Config->get_output_auto_connect () & AutoConnectMaster) {
- output_states = &_current_state->stereo_out_channel_states;
- } else {
- output_states = &_current_state->multi_out_channel_states;
- }
-
- channel_states.assign (output_states->begin (), output_states->end ());
-}
-
-
-void
-EngineStateController::get_physical_midi_input_states (std::vector<MidiPortState>& channel_states)
-{
- channel_states.clear ();
-
- MidiPortStateList::iterator iter = _midi_inputs.begin ();
-
- for (; iter != _midi_inputs.end (); ++iter ) {
- if (iter->available) {
- MidiPortState state (iter->name);
- state.active = iter->active;
- state.available = true;
- state.scene_connected = iter->scene_connected;
- state.mtc_in = iter->mtc_in;
- channel_states.push_back (state);
- }
- }
-}
-
-void
-EngineStateController::get_physical_midi_output_states (std::vector<MidiPortState>& channel_states)
-{
- channel_states.clear ();
-
- MidiPortStateList::iterator iter = _midi_outputs.begin ();
-
- for (; iter != _midi_outputs.end (); ++iter ) {
- if (iter->available) {
- MidiPortState state (iter->name);
- state.active = iter->active;
- state.available = true;
- state.scene_connected = iter->scene_connected;
- state.mtc_in = iter->mtc_in;
- channel_states.push_back (state);
- }
- }
-}
-
-
-void
-EngineStateController::_on_session_loaded ()
-{
- if (!_session) {
- return;
- }
-
- AudioEngine::instance ()->reconnect_session_routes (true, true);
- _session->reconnect_mtc_ports ();
- _session->reconnect_mmc_ports (true);
- _session->reconnect_mmc_ports (false);
-
- // This is done during session construction
- // _session->reconnect_ltc_input ();
- // _session->reconnect_ltc_output ();
-
- samplecnt_t desired_sample_rate = _session->nominal_sample_rate ();
- if ( desired_sample_rate > 0 && set_new_sample_rate_in_controller (desired_sample_rate))
- {
- push_current_state_to_backend (false);
- SampleRateChanged (); // emit a signal
- }
-}
-
-
-void
-EngineStateController::_on_sample_rate_change (samplecnt_t new_sample_rate)
-{
- if (_current_state->sample_rate != new_sample_rate) {
-
- // if sample rate has been changed
- samplecnt_t sample_rate_to_set = new_sample_rate;
- if (AudioEngine::instance ()->session ()) {
- // and we have current session we should restore it back to the one tracks uses
- sample_rate_to_set = AudioEngine::instance ()->session ()->sample_rate ();
- }
-
- if ( !set_new_sample_rate_in_controller (sample_rate_to_set)) {
- // if sample rate can't be set
- // switch to NONE device
- set_new_device_as_current ("None");
- DeviceListChanged (false);
- DeviceError ();
- }
- }
-
- SampleRateChanged (); // emit a signal
-}
-
-
-void
-EngineStateController::_on_buffer_size_change (pframes_t new_buffer_size)
-{
- if (_current_state->buffer_size != new_buffer_size) {
- _current_state->buffer_size = new_buffer_size;
- }
-
- BufferSizeChanged (); // emit a signal
-}
-
-
-void
-EngineStateController::_on_device_list_change ()
-{
- bool current_device_disconnected = false;
-
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
-
- std::vector<AudioBackend::DeviceStatus> device_vector = backend->enumerate_devices ();
-
- // find out out if current device is still available if it's not None
- if (_current_state->device_name != "None")
- {
- std::vector<AudioBackend::DeviceStatus>::iterator device_iter;
- device_iter = std::find_if (device_vector.begin (), device_vector.end (), DevicePredicate (_current_state->device_name));
-
- // if current device is not available any more - switch to None device
- if (device_iter == device_vector.end ()) {
-
- StateList::iterator found_state_iter = find_if (_states.begin (), _states.end (),
- State::StatePredicate (_current_state->backend_name, "None"));
-
- if (found_state_iter != _states.end ()) {
- // found the record - switch to it
- _current_state = *found_state_iter;
- _validate_current_device_state ();
- } else {
- // create new record for this engine with default device
- _current_state = boost::shared_ptr<State>(new State ());
- _current_state->backend_name = backend->name ();
- _current_state->device_name = "None";
- _validate_current_device_state ();
- _states.push_front (_current_state);
- }
-
- push_current_state_to_backend (true);
- current_device_disconnected = true;
- }
- } else {
- // if the device which was active before is available now - switch to it
-
- std::vector<AudioBackend::DeviceStatus>::iterator device_iter;
- device_iter = std::find_if (device_vector.begin (), device_vector.end (), DevicePredicate (_last_used_real_device));
-
- if (device_iter != device_vector.end ()) {
- StateList::iterator found_state_iter = find_if (_states.begin (), _states.end (),
- State::StatePredicate (_current_state->backend_name,
- _last_used_real_device));
-
- if (found_state_iter != _states.end ()) {
-
- boost::shared_ptr<State> previous_state (_current_state);
- _current_state = *found_state_iter;
-
- if (_validate_current_device_state ()) {
- push_current_state_to_backend (false);
- } else {
- // cannot use this device right now
- _last_used_real_device.clear ();
- _current_state = previous_state;
- }
- }
- }
- }
-
- DeviceListChanged (current_device_disconnected); // emit a signal
-}
-
-
-void
-EngineStateController::_update_device_channels_state ()
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
- assert (backend);
-
- // update audio input states
- std::vector<std::string> phys_audio_inputs;
- backend->get_physical_inputs (DataType::AUDIO, phys_audio_inputs);
-
- PortStateList new_input_states;
- PortStateList &input_states = _current_state->input_channel_states;
-
- std::vector<std::string>::const_iterator input_iter = phys_audio_inputs.begin ();
- for (; input_iter != phys_audio_inputs.end (); ++input_iter) {
-
- PortState state (*input_iter);
- state.active = true;
- PortStateList::const_iterator found_state_iter = std::find (input_states.begin (), input_states.end (), state);
-
- if (found_state_iter != input_states.end ()) {
- new_input_states.push_back (*found_state_iter);
- } else {
- new_input_states.push_back (state);
- }
- }
- _current_state->input_channel_states = new_input_states;
-
- // update audio output states (multi out mode)
- std::vector<std::string> phys_audio_outputs;
- backend->get_physical_outputs (DataType::AUDIO, phys_audio_outputs);
-
- PortStateList new_output_states;
- PortStateList &output_multi_states = _current_state->multi_out_channel_states;
-
- std::vector<std::string>::const_iterator output_iter = phys_audio_outputs.begin ();
- for (; output_iter != phys_audio_outputs.end (); ++output_iter) {
-
- PortState state (*output_iter);
- state.active = true;
- PortStateList::const_iterator found_state_iter = std::find (output_multi_states.begin (), output_multi_states.end (), state);
-
- if (found_state_iter != output_multi_states.end ()) {
- new_output_states.push_back (*found_state_iter);
- } else {
- new_output_states.push_back (state);
- }
- }
-
- _current_state->multi_out_channel_states = new_output_states;
-
- // update audio output states (stereo out mode)
- new_output_states.clear ();
- PortStateList &output_stereo_states = _current_state->stereo_out_channel_states;
-
- output_iter = phys_audio_outputs.begin ();
- for (; output_iter != phys_audio_outputs.end (); ++output_iter) {
-
- PortState state (*output_iter);
- state.active = true;
- PortStateList::const_iterator found_state_iter = std::find (output_stereo_states.begin (), output_stereo_states.end (), state);
-
- if (found_state_iter != output_stereo_states.end ()) {
- new_output_states.push_back (*found_state_iter);
- } else {
- new_output_states.push_back (state);
- }
- }
-
- _current_state->stereo_out_channel_states = new_output_states;
- _refresh_stereo_out_channel_states ();
-
-
- // update midi ports: unlike audio ports which states are saved per device
- // each midi port state is saved individualy
- // so get all midi ports from the backend
- // and compare to the list of midi ports we have
- // if physical port is new, add it to our state list
- // if physical port is present in our state list - mark it available
- // if there is no corresponding physical port to one we have in a list - leave it unavailable
- MidiPortStateList::iterator iter = _midi_inputs.begin ();
- for (; iter != _midi_inputs.end (); ++iter) {
- iter->available = false;
- }
-
- for (iter = _midi_outputs.begin (); iter != _midi_outputs.end (); ++iter) {
- iter->available = false;
- }
-
- // update midi input ports
- std::vector<std::string> phys_midi_inputs;
- backend->get_physical_inputs (DataType::MIDI, phys_midi_inputs);
-
- std::vector<std::string>::const_iterator midi_input_iter = phys_midi_inputs.begin ();
- for (; midi_input_iter != phys_midi_inputs.end (); ++midi_input_iter) {
-
- MidiPortState state (*midi_input_iter);
- state.active = false;
- state.available = true;
- MidiPortStateList::iterator found_state_iter = std::find (_midi_inputs.begin (), _midi_inputs.end (), state);
-
- if (found_state_iter != _midi_inputs.end ()) {
- found_state_iter->available = true;
- } else {
- _midi_inputs.push_back (state);
- }
- }
-
- // update midi output ports
- std::vector<std::string> phys_midi_outputs;
- backend->get_physical_outputs (DataType::MIDI, phys_midi_outputs);
-
- std::vector<std::string>::const_iterator midi_output_iter = phys_midi_outputs.begin ();
- for (; midi_output_iter != phys_midi_outputs.end (); ++midi_output_iter) {
-
- MidiPortState state (*midi_output_iter);
- state.active = false;
- state.available = true;
- MidiPortStateList::iterator found_state_iter = std::find (_midi_outputs.begin (), _midi_outputs.end (), state);
-
- if (found_state_iter != _midi_outputs.end ()) {
- found_state_iter->available = true;
- } else {
- _midi_outputs.push_back (state);
- }
- }
-}
-
-
-void
-EngineStateController::_refresh_stereo_out_channel_states ()
-{
- PortStateList &output_states = _current_state->stereo_out_channel_states;
- PortStateList::iterator active_iter = output_states.begin ();
-
- for (; active_iter != output_states.end (); ++active_iter) {
- if (active_iter->active) {
- break;
- }
- }
-
- uint32_t pending_active_channels = 2;
- PortStateList::iterator iter = output_states.begin ();
- // if found active
- if (active_iter != output_states.end ()) {
- iter = active_iter;
- if (++iter == output_states.end ()) {
- iter = output_states.begin ();
- }
-
- (iter++)->active = true;
- pending_active_channels = 0;
- }
-
- // drop the rest of the states to false (until we reach the end or first existing active channel)
- for (; iter != output_states.end () && iter != active_iter; ++iter) {
- if (pending_active_channels) {
- iter->active = true;
- --pending_active_channels;
- } else {
- iter->active = false;
- }
- }
-}
-
-
-void
-EngineStateController::_on_engine_running ()
-{
- AudioEngine::instance ()->reconnect_session_routes (true, true);
- _current_state->active = true;
-
- EngineRunning (); // emit a signal
-}
-
-
-void
-EngineStateController::_on_engine_stopped ()
-{
- EngineStopped ();
-}
-
-
-void
-EngineStateController::_on_engine_halted ()
-{
- EngineHalted ();
-}
-
-
-void
-EngineStateController::_on_device_error ()
-{
- set_new_device_as_current ("None");
- push_current_state_to_backend (true);
- DeviceListChanged (false);
- DeviceError ();
-}
-
-
-void
-EngineStateController::_on_parameter_changed (const std::string& parameter_name)
-{
- if (parameter_name == "output-auto-connect") {
-
- AudioEngine::instance ()->reconnect_session_routes (false, true);
- OutputConfigChanged (); // emit a signal
- OutputConnectionModeChanged (); // emit signal
- }
-}
-
-
-void
-EngineStateController::_on_ports_registration_update ()
-{
- _update_device_channels_state ();
-
- // update MIDI connections
- if (_session) {
- _session->reconnect_midi_scene_ports (true);
- _session->reconnect_midi_scene_ports (false);
-
- _session->reconnect_mtc_ports ();
-
- _session->reconnect_mmc_ports (true);
- _session->reconnect_mmc_ports (false);
-
- _session->reconnect_ltc_input ();
- _session->reconnect_ltc_output ();
- }
-
- _update_ltc_source_port ();
- _update_ltc_output_port ();
-
- PortRegistrationChanged (); // emit a signal
-}
-
-
-bool
-EngineStateController::push_current_state_to_backend (bool start)
-{
- boost::shared_ptr<AudioBackend> backend = AudioEngine::instance ()->current_backend ();
-
- if (!backend) {
- return false;
- }
-
- // check if anything changed
- bool state_changed = (_current_state->device_name != backend->device_name ()) ||
- (_current_state->sample_rate != backend->sample_rate ()) ||
- (_current_state->buffer_size != backend->buffer_size ());
-
- bool was_running = AudioEngine::instance ()->running ();
-
- Glib::Threads::RecMutex::Lock sl (AudioEngine::instance ()->state_lock ());
- if (state_changed) {
-
- if (was_running) {
-
- if (_current_state->device_name != backend->device_name ()) {
- // device has been changed
- // the list of ports has been changed too
- // current ltc_source_port and ltc_output_port aren't available
- set_ltc_source_port ("");
- set_ltc_output_port ("");
- }
-
- if (AudioEngine::instance ()->stop ()) {
- return false;
- }
- }
-
- int result = 0;
- {
- std::cout << "EngineStateController::Setting device: " << _current_state->device_name << std::endl;
- if ((_current_state->device_name != backend->device_name ()) && (result = backend->set_device_name (_current_state->device_name))) {
- error << string_compose (_("Cannot set device name to %1"), get_current_device_name ()) << endmsg;
- }
-
- if (!result ) {
- std::cout << "EngineStateController::Setting device sample rate " << _current_state->sample_rate << std::endl;
- result = backend->set_sample_rate (_current_state->sample_rate);
-
- if (result) {
- error << string_compose (_("Cannot set sample rate to %1"), get_current_sample_rate ()) << endmsg;
- }
- }
-
- if (!result ) {
- std::cout << "EngineStateController::Setting device buffer size " << _current_state->buffer_size << std::endl;
- result = backend->set_buffer_size (_current_state->buffer_size);
-
- if (result) {
- error << string_compose (_("Cannot set buffer size to %1"), get_current_buffer_size ()) << endmsg;
- }
- }
- }
-
- if (result) // error during device setup
- {
- //switch to None device and notify about the issue
- set_new_device_as_current ("None");
- DeviceListChanged (false);
- DeviceError ();
- }
-
- if (AudioEngine::instance ()->backend_reset_requested ()) {
- // device asked for reset, do not start engine now
- // free sate lock and let Engine reset the device as it's required
- return true;
- }
- }
-
- if (start || (was_running && state_changed)) {
- if (AudioEngine::instance ()->start () && !AudioEngine::instance ()->is_reset_requested ()) {
- //switch to None device and notify about the issue
- set_new_device_as_current ("None");
- AudioEngine::instance ()->start ();
- DeviceListChanged (false);
- DeviceError ();
- return false;
- }
- }
-
- save_audio_midi_settings ();
-
- return true;
-}
-
-
-std::string
-EngineStateController::get_mtc_source_port ()
-{
- MidiPortStateList::const_iterator state_iter = _midi_inputs.begin ();
- for (; state_iter != _midi_inputs.end (); ++state_iter) {
- if (state_iter->available && state_iter->mtc_in) {
- return (state_iter->name);
- }
- }
-
- return "";
-}
-
-void
-EngineStateController::set_ltc_source_port (const std::string& port)
-{
- Config->set_ltc_source_port (port);
-}
-
-std::string
-EngineStateController::get_ltc_source_port ()
-{
- return Config->get_ltc_source_port ();
-}
-
-void
-EngineStateController::set_ltc_output_port (const std::string& port)
-{
- Config->set_ltc_output_port (port);
-}
-
-std::string
-EngineStateController::get_ltc_output_port ()
-{
- return Config->get_ltc_output_port ();
-}
-
diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc
index a250774ccd..1d1bd125dd 100644
--- a/libs/ardour/filesystem_paths.cc
+++ b/libs/ardour/filesystem_paths.cc
@@ -58,13 +58,6 @@ user_config_directory_name (int version = -1)
product name etc.
*/
-#ifdef USE_TRACKS_CODE_FEATURES
- /* Tracks does not use versioned configuration folders, which may or
- may not be problematic in the future.
- */
- return X_(PROGRAM_NAME);
-
-#else
const string config_dir_name = string_compose ("%1%2", X_(PROGRAM_NAME), version);
#if defined (__APPLE__) || defined (PLATFORM_WINDOWS)
@@ -74,7 +67,6 @@ user_config_directory_name (int version = -1)
/* use lower case folder name on Linux */
return downcase (config_dir_name);
#endif
-#endif
}
std::string
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index f378d1145d..84bd5706d7 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -5975,65 +5975,6 @@ Route::set_loop (Location* l)
}
}
-#ifdef USE_TRACKS_CODE_FEATURES
-
-/* This is the Tracks version of Track::monitoring_state().
- *
- * Ardour developers: try to flag or fix issues if parts of the libardour API
- * change in ways that invalidate this
- */
-
-MonitorState
-Route::monitoring_state () const
-{
- /* Explicit requests */
-
- if (_monitoring != MonitorInput) {
- return MonitoringInput;
- }
-
- if (_monitoring & MonitorDisk) {
- return MonitoringDisk;
- }
-
- /* This is an implementation of the truth table in doc/monitor_modes.pdf;
- I don't think it's ever going to be too pretty too look at.
- */
-
- // GZ: NOT USED IN TRACKS
- //bool const auto_input = _session.config.get_auto_input ();
- //bool const software_monitor = Config->get_monitoring_model() == SoftwareMonitoring;
- //bool const tape_machine_mode = Config->get_tape_machine_mode ();
-
- bool const roll = _session.transport_rolling ();
- bool const track_rec = _diskstream->record_enabled ();
- bool session_rec = _session.actively_recording ();
-
- if (track_rec) {
-
- if (!session_rec && roll) {
- return MonitoringDisk;
- } else {
- return MonitoringInput;
- }
-
- } else {
-
- if (roll) {
- return MonitoringDisk;
- }
- }
-
- return MonitoringSilence;
-}
-
-#else
-
-/* This is the Ardour/Mixbus version of Track::monitoring_state().
- *
- * Tracks developers: do NOT modify this method under any circumstances.
- */
-
MonitorState
Route::monitoring_state () const
{
@@ -6072,4 +6013,3 @@ Route::monitoring_state () const
return get_auto_monitoring_state();
}
-#endif
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index bb7a6e6904..af13f7bfc0 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -79,9 +79,6 @@
#include "ardour/debug.h"
#include "ardour/disk_reader.h"
#include "ardour/directory_names.h"
-#ifdef USE_TRACKS_CODE_FEATURES
-#include "ardour/engine_state_controller.h"
-#endif
#include "ardour/filename_extensions.h"
#include "ardour/gain_control.h"
#include "ardour/graph.h"
@@ -168,13 +165,7 @@ PBD::Signal2<void,std::string,std::string> Session::VersionMismatch;
const samplecnt_t Session::bounce_chunk_size = 8192;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
-
-// seconds should be added after the region exceeds end marker
-#ifdef USE_TRACKS_CODE_FEATURES
-const uint32_t Session::session_end_shift = 5;
-#else
const uint32_t Session::session_end_shift = 0;
-#endif
/** @param snapshot_name Snapshot name, without .ardour suffix */
Session::Session (AudioEngine &eng,
@@ -352,9 +343,6 @@ Session::Session (AudioEngine &eng,
Stateful::loading_state_version = CURRENT_SESSION_FILE_VERSION;
-#ifdef USE_TRACKS_CODE_FEATURES
- sr = EngineStateController::instance()->get_current_sample_rate();
-#endif
if (ensure_engine (sr, true)) {
destroy ();
throw SessionException (_("Cannot connect to audio/midi engine"));
@@ -472,49 +460,6 @@ Session::Session (AudioEngine &eng,
_engine.set_session (this);
_engine.reset_timebase ();
-#ifdef USE_TRACKS_CODE_FEATURES
-
- EngineStateController::instance()->set_session(this);
-
- if (_is_new ) {
- if ( ARDOUR::Profile->get_trx () ) {
-
- /* Waves Tracks: fill session with tracks basing on the amount of inputs.
- * each available input must have corresponding track when session starts.
- */
-
- uint32_t how_many (0);
-
- std::vector<std::string> inputs;
- EngineStateController::instance()->get_physical_audio_inputs(inputs);
-
- how_many = inputs.size();
-
- list<boost::shared_ptr<AudioTrack> > tracks;
-
- // Track names after driver
- if (Config->get_tracks_auto_naming() == NameAfterDriver) {
- string track_name = "";
- for (std::vector<string>::size_type i = 0; i < inputs.size(); ++i) {
- string track_name;
- track_name = inputs[i];
- replace_all (track_name, "system:capture", "");
-
- list<boost::shared_ptr<AudioTrack> > single_track = new_audio_track (1, 1, Normal, 0, 1, track_name);
- tracks.insert(tracks.begin(), single_track.front());
- }
- } else { // Default track names
- tracks = new_audio_track (1, 1, Normal, 0, how_many, string());
- }
-
- if (tracks.size() != how_many) {
- destroy ();
- throw failed_constructor ();
- }
- }
- }
-#endif
-
ensure_subdirs (); // archived or zipped sessions may lack peaks/ analysis/ etc
if (!mix_template.empty ()) {
@@ -685,10 +630,6 @@ Session::destroy ()
_engine.remove_session ();
-#ifdef USE_TRACKS_CODE_FEATURES
- EngineStateController::instance()->remove_session();
-#endif
-
/* deregister all ports - there will be no process or any other
* callbacks from the engine any more.
*/
@@ -2655,254 +2596,6 @@ Session::midi_output_change_handler (IOChange change, void * /*src*/, boost::wea
}
}
-#ifdef USE_TRACKS_CODE_FEATURES
-
-static bool
-compare_routes_by_remote_id (const boost::shared_ptr<Route>& route1, const boost::shared_ptr<Route>& route2)
-{
- return route1->remote_control_id() < route2->remote_control_id();
-}
-
-void
-Session::reconnect_existing_routes (bool withLock, bool reconnect_master, bool reconnect_inputs, bool reconnect_outputs)
-{
- // it is not allowed to perform connection
- if (!IO::connecting_legal) {
- return;
- }
-
- // if we are deleting routes we will call this once at the end
- if (_route_deletion_in_progress) {
- return;
- }
-
- Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK);
-
- if (withLock) {
- lm.acquire ();
- }
-
- // We need to disconnect the route's inputs and outputs first
- // basing on autoconnect configuration
- bool reconnectIputs = !(Config->get_input_auto_connect() & ManualConnect) && reconnect_inputs;
- bool reconnectOutputs = !(Config->get_output_auto_connect() & ManualConnect) && reconnect_outputs;
-
- ChanCount existing_inputs;
- ChanCount existing_outputs;
- count_existing_track_channels (existing_inputs, existing_outputs);
-
- //ChanCount inputs = ChanCount::ZERO;
- //ChanCount outputs = ChanCount::ZERO;
-
- RouteList existing_routes = *routes.reader ();
- existing_routes.sort (compare_routes_by_remote_id);
-
- {
- PBD::Unwinder<bool> protect_ignore_changes (_reconnecting_routes_in_progress, true);
-
- vector<string> physinputs;
- vector<string> physoutputs;
-
- EngineStateController::instance()->get_physical_audio_outputs(physoutputs);
- EngineStateController::instance()->get_physical_audio_inputs(physinputs);
-
- uint32_t input_n = 0;
- uint32_t output_n = 0;
- RouteList::iterator rIter = existing_routes.begin();
- const AutoConnectOption current_input_auto_connection (Config->get_input_auto_connect());
- const AutoConnectOption current_output_auto_connection (Config->get_output_auto_connect());
- for (; rIter != existing_routes.end(); ++rIter) {
- if (*rIter == _master_out || *rIter == _monitor_out ) {
- continue;
- }
-
- if (current_output_auto_connection == AutoConnectPhysical) {
- (*rIter)->amp()->deactivate();
- } else if (current_output_auto_connection == AutoConnectMaster) {
- (*rIter)->amp()->activate();
- }
-
- if (reconnectIputs) {
- (*rIter)->input()->disconnect (this); //GZ: check this; could be heavy
-
- for (uint32_t route_input_n = 0; route_input_n < (*rIter)->n_inputs().get(DataType::AUDIO); ++route_input_n) {
-
- if (current_input_auto_connection & AutoConnectPhysical) {
-
- if ( input_n == physinputs.size() ) {
- break;
- }
-
- string port = physinputs[input_n];
-
- if (port.empty() ) {
- error << "Physical Input number "<< input_n << " is unavailable and cannot be connected" << endmsg;
- }
-
- //GZ: check this; could be heavy
- (*rIter)->input()->connect ((*rIter)->input()->ports().port(DataType::AUDIO, route_input_n), port, this);
- ++input_n;
- }
- }
- }
-
- if (reconnectOutputs) {
-
- //normalize route ouptuts: reduce the amount outputs to be equal to the amount of inputs
- if (current_output_auto_connection & AutoConnectPhysical) {
-
- //GZ: check this; could be heavy
- (*rIter)->output()->disconnect (this);
- size_t route_inputs_count = (*rIter)->n_inputs().get(DataType::AUDIO);
-
- //GZ: check this; could be heavy
- (*rIter)->output()->ensure_io(ChanCount(DataType::AUDIO, route_inputs_count), false, this );
-
- } else if (current_output_auto_connection & AutoConnectMaster){
-
- if (!reconnect_master) {
- continue;
- }
-
- //GZ: check this; could be heavy
- (*rIter)->output()->disconnect (this);
-
- if (_master_out) {
- uint32_t master_inputs_count = _master_out->n_inputs().get(DataType::AUDIO);
- (*rIter)->output()->ensure_io(ChanCount(DataType::AUDIO, master_inputs_count), false, this );
- } else {
- error << error << "Master bus is not available" << endmsg;
- break;
- }
- }
-
- for (uint32_t route_output_n = 0; route_output_n < (*rIter)->n_outputs().get(DataType::AUDIO); ++route_output_n) {
- if (current_output_auto_connection & AutoConnectPhysical) {
-
- if ( output_n == physoutputs.size() ) {
- break;
- }
-
- string port = physoutputs[output_n];
-
- if (port.empty() ) {
- error << "Physical Output number "<< output_n << " is unavailable and cannot be connected" << endmsg;
- }
-
- //GZ: check this; could be heavy
- (*rIter)->output()->connect ((*rIter)->output()->ports().port(DataType::AUDIO, route_output_n), port, this);
- ++output_n;
-
- } else if (current_output_auto_connection & AutoConnectMaster) {
-
- if ( route_output_n == _master_out->n_inputs().get(DataType::AUDIO) ) {
- break;
- }
-
- // connect to master bus
- string port = _master_out->input()->ports().port(DataType::AUDIO, route_output_n)->name();
-
- if (port.empty() ) {
- error << "MasterBus Input number "<< route_output_n << " is unavailable and cannot be connected" << endmsg;
- }
-
-
- //GZ: check this; could be heavy
- (*rIter)->output()->connect ((*rIter)->output()->ports().port(DataType::AUDIO, route_output_n), port, this);
-
- }
- }
- }
- }
-
- _master_out->output()->disconnect (this);
- auto_connect_master_bus ();
- }
-
- graph_reordered ();
-
- session_routes_reconnected (); /* EMIT SIGNAL */
-}
-
-void
-Session::reconnect_midi_scene_ports(bool inputs)
-{
- if (inputs ) {
-
- boost::shared_ptr<MidiPort> scene_in_ptr = scene_in();
- if (scene_in_ptr) {
- scene_in_ptr->disconnect_all ();
-
- std::vector<EngineStateController::MidiPortState> midi_port_states;
- EngineStateController::instance()->get_physical_midi_input_states (midi_port_states);
-
- std::vector<EngineStateController::MidiPortState>::iterator state_iter = midi_port_states.begin();
-
- for (; state_iter != midi_port_states.end(); ++state_iter) {
- if (state_iter->active && state_iter->available && state_iter->scene_connected) {
- scene_in_ptr->connect (state_iter->name);
- }
- }
- }
-
- } else {
-
- boost::shared_ptr<MidiPort> scene_out_ptr = scene_out();
-
- if (scene_out_ptr ) {
- scene_out_ptr->disconnect_all ();
-
- std::vector<EngineStateController::MidiPortState> midi_port_states;
- EngineStateController::instance()->get_physical_midi_output_states (midi_port_states);
-
- std::vector<EngineStateController::MidiPortState>::iterator state_iter = midi_port_states.begin();
-
- for (; state_iter != midi_port_states.end(); ++state_iter) {
- if (state_iter->active && state_iter->available && state_iter->scene_connected) {
- scene_out_ptr->connect (state_iter->name);
- }
- }
- }
- }
-}
-
-void
-Session::reconnect_mmc_ports(bool inputs)
-{
- if (inputs ) { // get all enabled midi input ports
-
- boost::shared_ptr<MidiPort> mmc_in_ptr = _midi_ports->mmc_in();
- if (mmc_in_ptr) {
- mmc_in_ptr->disconnect_all ();
- std::vector<std::string> enabled_midi_inputs;
- EngineStateController::instance()->get_physical_midi_inputs (enabled_midi_inputs);
-
- std::vector<std::string>::iterator port_iter = enabled_midi_inputs.begin();
-
- for (; port_iter != enabled_midi_inputs.end(); ++port_iter) {
- mmc_in_ptr->connect (*port_iter);
- }
-
- }
- } else { // get all enabled midi output ports
-
- boost::shared_ptr<MidiPort> mmc_out_ptr = _midi_ports->mmc_out();
- if (mmc_out_ptr ) {
- mmc_out_ptr->disconnect_all ();
- std::vector<std::string> enabled_midi_outputs;
- EngineStateController::instance()->get_physical_midi_outputs (enabled_midi_outputs);
-
- std::vector<std::string>::iterator port_iter = enabled_midi_outputs.begin();
-
- for (; port_iter != enabled_midi_outputs.end(); ++port_iter) {
- mmc_out_ptr->connect (*port_iter);
- }
- }
- }
-}
-
-#endif
-
bool
Session::ensure_stripable_sort_order ()
{
@@ -3737,15 +3430,10 @@ Session::remove_routes (boost::shared_ptr<RouteList> routes_to_remove)
/* Re-sort routes to remove the graph's current references to the one that is
* going away, then flush old references out of the graph.
- * Wave Tracks: reconnect routes
*/
-#ifdef USE_TRACKS_CODE_FEATURES
- reconnect_existing_routes(true, false);
-#else
- routes.flush (); // maybe unsafe, see below.
- resort_routes ();
-#endif
+ routes.flush (); // maybe unsafe, see below.
+ resort_routes ();
if (_process_graph && !deletion_in_progress() && _engine.running()) {
_process_graph->clear_other_chain ();
@@ -6951,14 +6639,6 @@ Session::notify_presentation_info_change ()
}
reassign_track_numbers();
-
-#ifdef USE_TRACKS_CODE_FEATURES
- /* Waves Tracks: for Waves Tracks session it's required to reconnect their IOs
- * if track order has been changed by user
- */
- reconnect_existing_routes(true, true);
-#endif
-
}
bool
@@ -6992,36 +6672,24 @@ void
Session::set_range_selection (samplepos_t start, samplepos_t end)
{
_range_selection = Evoral::Range<samplepos_t> (start, end);
-#ifdef USE_TRACKS_CODE_FEATURES
- follow_playhead_priority ();
-#endif
}
void
Session::set_object_selection (samplepos_t start, samplepos_t end)
{
_object_selection = Evoral::Range<samplepos_t> (start, end);
-#ifdef USE_TRACKS_CODE_FEATURES
- follow_playhead_priority ();
-#endif
}
void
Session::clear_range_selection ()
{
_range_selection = Evoral::Range<samplepos_t> (-1,-1);
-#ifdef USE_TRACKS_CODE_FEATURES
- follow_playhead_priority ();
-#endif
}
void
Session::clear_object_selection ()
{
_object_selection = Evoral::Range<samplepos_t> (-1,-1);
-#ifdef USE_TRACKS_CODE_FEATURES
- follow_playhead_priority ();
-#endif
}
void
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index f2766f2c7e..dbda0aabb3 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1425,83 +1425,6 @@ Session::non_realtime_locate ()
clear_clicks ();
}
-#ifdef USE_TRACKS_CODE_FEATURES
-bool
-Session::select_playhead_priority_target (samplepos_t& jump_to)
-{
- jump_to = -1;
-
- AutoReturnTarget autoreturn = Config->get_auto_return_target_list ();
-
- if (!autoreturn) {
- return false;
- }
-
- if (Profile->get_trx() && transport_rolling() ) {
- // We're playing, so do nothing.
- // Next stop will put us where we need to be.
- return false;
- }
-
- /* Note that the order of checking each AutoReturnTarget flag defines
- the priority each flag.
-
- Ardour/Mixbus: Last Locate
- Range Selection
- Loop Range
- Region Selection
-
- Tracks: Range Selection
- Loop Range
- Region Selection
- Last Locate
- */
-
- if (autoreturn & RangeSelectionStart) {
- if (!_range_selection.empty()) {
- jump_to = _range_selection.from;
- } else {
- if (transport_rolling ()) {
- /* Range selection no longer exists, but we're playing,
- so do nothing. Next stop will put us where
- we need to be.
- */
- return false;
- }
- }
- }
-
- if (jump_to < 0 && (autoreturn & Loop) && get_play_loop()) {
- /* don't try to handle loop play when synced to JACK */
-
- if (!synced_to_engine()) {
- Location *location = _locations->auto_loop_location();
-
- if (location) {
- jump_to = location->start();
-
- if (Config->get_seamless_loop()) {
- /* need to get track buffers reloaded */
- set_track_loop (true);
- }
- }
- }
- }
-
- if (jump_to < 0 && (autoreturn & RegionSelectionStart)) {
- if (!_object_selection.empty()) {
- jump_to = _object_selection.from;
- }
- }
-
- if (jump_to < 0 && (autoreturn & LastLocate)) {
- jump_to = _last_roll_location;
- }
-
- return jump_to >= 0;
-}
-#else
-
bool
Session::select_playhead_priority_target (samplepos_t& jump_to)
{
@@ -1513,8 +1436,6 @@ Session::select_playhead_priority_target (samplepos_t& jump_to)
return jump_to >= 0;
}
-#endif
-
void
Session::follow_playhead_priority ()
{
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index e8e49b0df3..4ab373b684 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -373,8 +373,6 @@ def build(bld):
# operate on copy to avoid adding sources twice
sources = list(libardour_sources)
- if bld.is_tracks_build():
- sources += [ 'engine_state_controller.cc' ]
# Library
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
diff --git a/libs/canvas/xfade_curve.cc b/libs/canvas/xfade_curve.cc
index 0586a12804..87b6709a5e 100644
--- a/libs/canvas/xfade_curve.cc
+++ b/libs/canvas/xfade_curve.cc
@@ -28,11 +28,7 @@ using namespace ArdourCanvas;
using std::min;
using std::max;
-#ifdef USE_TRACKS_CODE_FEATURES
-static const bool show_bg_fades = false;
-#else
static const bool show_bg_fades = true;
-#endif
XFadeCurve::XFadeCurve (Canvas* c)
: Item (c)
diff --git a/libs/gtkmm2ext/cairo_widget.cc b/libs/gtkmm2ext/cairo_widget.cc
index a85de28490..37d7f3806b 100644
--- a/libs/gtkmm2ext/cairo_widget.cc
+++ b/libs/gtkmm2ext/cairo_widget.cc
@@ -138,98 +138,6 @@ CairoWidget::background_color ()
}
}
-#ifdef USE_TRACKS_CODE_FEATURES
-
-/* This is Tracks version of this method.
-
- The use of get_visible_window() in this method is an abuse of the GDK/GTK
- semantics. It can and may break on different GDK backends, and uses a
- side-effect/unintended behaviour in GDK/GTK to try to accomplish something
- which should be done differently. I (Paul) have confirmed this with the GTK
- development team.
-
- For this reason, this code is not acceptable for ordinary merging into the Ardour libraries.
-
- Ardour Developers: you are not obligated to maintain the internals of this
- implementation in the face of build-time environment changes (e.g. -D
- defines etc).
-*/
-
-bool
-CairoWidget::on_expose_event (GdkEventExpose *ev)
-{
- cairo_rectangle_t expose_area;
- expose_area.width = ev->area.width;
- expose_area.height = ev->area.height;
-
-#ifdef USE_CAIRO_IMAGE_SURFACE_FOR_CAIRO_WIDGET
- Cairo::RefPtr<Cairo::Context> cr;
- if (get_visible_window ()) {
- expose_area.x = 0;
- expose_area.y = 0;
- if (!_image_surface) {
- _image_surface = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, get_width(), get_height());
- }
- cr = Cairo::Context::create (_image_surface);
- } else {
- expose_area.x = ev->area.x;
- expose_area.y = ev->area.y;
- cr = get_window()->create_cairo_context ();
- }
-#else
- expose_area.x = ev->area.x;
- expose_area.y = ev->area.y;
- Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context ();
-#endif
-
- cr->rectangle (expose_area.x, expose_area.y, expose_area.width, expose_area.height);
- cr->clip ();
-
- /* paint expose area the color of the parent window bg
- */
-
- if (get_visible_window ()) {
- Gdk::Color bg (get_parent_bg());
- cr->rectangle (expose_area.x, expose_area.y, expose_area.width, expose_area.height);
- cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
- cr->fill ();
- }
-
- render (cr, &expose_area);
-
-#ifdef USE_CAIRO_IMAGE_SURFACE_FOR_CAIRO_WIDGET
- if(get_visible_window ()) {
- _image_surface->flush();
- /* now blit our private surface back to the GDK one */
-
- Cairo::RefPtr<Cairo::Context> cairo_context = get_window()->create_cairo_context ();
-
- cairo_context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
- cairo_context->clip ();
- cairo_context->set_source (_image_surface, ev->area.x, ev->area.y);
- cairo_context->set_operator (Cairo::OPERATOR_OVER);
- cairo_context->paint ();
- }
-#endif
-
- Gtk::Widget* child = get_child ();
-
- if (child) {
- propagate_expose (*child, ev);
- }
-
- return true;
-}
-
-#else
-
-/* Ardour mainline: not using Tracks code features.
-
- Tracks Developers: please do not modify this version of
- ::on_expose_event(). The version used by Tracks is before the preceding
- #else and contains hacks required for the Tracks GUI to work.
-*/
-
bool
CairoWidget::on_expose_event (GdkEventExpose *ev)
{
@@ -307,8 +215,6 @@ CairoWidget::on_expose_event (GdkEventExpose *ev)
return true;
}
-#endif
-
/** Marks the widget as dirty, so that render () will be called on
* the next GTK expose event.
*/
diff --git a/libs/panners/wscript b/libs/panners/wscript
index 3ee237f2f6..9d30bab51f 100644
--- a/libs/panners/wscript
+++ b/libs/panners/wscript
@@ -20,19 +20,13 @@ def configure(conf):
autowaf.set_recursive()
autowaf.configure(conf)
- if conf.is_tracks_build():
- panners = [ '1in2out', 'vbap', 'stereobalance' ]
- else:
- panners = [ '2in2out', '1in2out', 'vbap', 'stereobalance' ]
+ panners = [ '2in2out', '1in2out', 'vbap', 'stereobalance' ]
for i in panners:
sub_config_and_use(conf, i)
def build(bld):
- if bld.is_tracks_build():
- panners = [ '1in2out', 'vbap', 'stereobalance' ]
- else:
- panners = [ '2in2out', '1in2out', 'vbap', 'stereobalance' ]
+ panners = [ '2in2out', '1in2out', 'vbap', 'stereobalance' ]
for i in panners:
bld.recurse(i)
diff --git a/wscript b/wscript
index ed529b7d59..b760a60c86 100644
--- a/wscript
+++ b/wscript
@@ -27,11 +27,6 @@ class i18n_mo(BuildContext):
cmd = 'i18n_mo'
fun = 'i18n_mo'
-def is_tracks_build(self, *k, **kw):
- return self.env['PROGRAM_NAME'] == 'Tracks Live'
-
-Context.Context.is_tracks_build = is_tracks_build
-
compiler_flags_dictionaries= {
'gcc' : {
# Flags required when building a debug build
@@ -712,9 +707,6 @@ def create_resource_file(icon):
print('Could not open gtk2_ardour/windows_icon.rc for writing\n')
sys.exit(-1)
-def is_tracks_build (conf):
- return conf.env['PROGRAM_NAME'] == 'Tracks Live'
-
#----------------------------------------------------------------
# Waf stages
@@ -1388,11 +1380,6 @@ def build(bld):
# set up target directories
lwrcase_dirname = 'ardour' + bld.env['MAJOR']
- if bld.is_tracks_build():
- bld.env.append_value ('CXXFLAGS', '-DUSE_TRACKS_CODE_FEATURES')
- bld.env.append_value ('CFLAGS', '-DUSE_TRACKS_CODE_FEATURES')
- lwrcase_dirname = 'trx'
-
# configuration files go here
bld.env['CONFDIR'] = os.path.join(bld.env['SYSCONFDIR'], lwrcase_dirname)
# data files loaded at run time go here