move ownership of LTC I/O ports to Session, and manage as IO objects
git-svn-id: svn://localhost/ardour2/branches/3.0@13341 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
edc8a59355
commit
7b818e9a7f
@ -260,9 +260,6 @@ _ the regular process() call to session->process() is not made.
|
||||
|
||||
int create_process_thread (boost::function<void()>, pthread_t*, size_t stacksize);
|
||||
|
||||
boost::shared_ptr<Port> ltc_input_port() const { return _ltc_input; }
|
||||
boost::shared_ptr<Port> ltc_output_port() const { return _ltc_output; }
|
||||
|
||||
private:
|
||||
static AudioEngine* _instance;
|
||||
|
||||
@ -292,10 +289,6 @@ private:
|
||||
Glib::Threads::Thread* m_meter_thread;
|
||||
ProcessThread* _main_thread;
|
||||
|
||||
boost::shared_ptr<Port> _ltc_input;
|
||||
boost::shared_ptr<Port> _ltc_output;
|
||||
void reconnect_ltc ();
|
||||
|
||||
SerializedRCUManager<Ports> ports;
|
||||
|
||||
boost::shared_ptr<Port> register_port (DataType type, const std::string& portname, bool input);
|
||||
|
@ -847,6 +847,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||
/** Emitted when the session wants Ardour to quit */
|
||||
static PBD::Signal0<void> Quit;
|
||||
|
||||
boost::shared_ptr<Port> ltc_input_port() const;
|
||||
boost::shared_ptr<Port> ltc_output_port() const;
|
||||
|
||||
protected:
|
||||
friend class AudioEngine;
|
||||
void set_block_size (pframes_t nframes);
|
||||
@ -1554,6 +1557,12 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||
bool ignore_route_processor_changes;
|
||||
|
||||
MidiClockTicker* midi_clock;
|
||||
|
||||
boost::shared_ptr<IO> _ltc_input;
|
||||
boost::shared_ptr<IO> _ltc_output;
|
||||
|
||||
void reconnect_ltc_input ();
|
||||
void reconnect_ltc_output ();
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
@ -78,8 +78,6 @@ AudioEngine::AudioEngine (string client_name, string session_uuid)
|
||||
, port_remove_in_progress (false)
|
||||
, m_meter_thread (0)
|
||||
, _main_thread (0)
|
||||
, _ltc_input ()
|
||||
, _ltc_output ()
|
||||
, ports (new Ports)
|
||||
{
|
||||
_instance = this; /* singleton */
|
||||
@ -91,34 +89,11 @@ AudioEngine::AudioEngine (string client_name, string session_uuid)
|
||||
}
|
||||
|
||||
Port::set_engine (this);
|
||||
|
||||
#ifdef HAVE_LTC
|
||||
_ltc_input = register_port (DataType::AUDIO, _("LTC in"), true);
|
||||
|
||||
/* register_port() would allocate buffers and pass a shadow copy
|
||||
* which is subject to ardour's route buffering behavioud and
|
||||
* not suitable for generating LTC independent of transport state.
|
||||
*/
|
||||
_ltc_output.reset(new AudioPort ("LTC out", Port::IsOutput));
|
||||
|
||||
/* As of October 2012, the LTC source port is the only thing that needs
|
||||
* to care about Config parameters, so don't bother to listen if we're
|
||||
* not doing LTC stuff. This might change if other parameters show up
|
||||
* in the future that we need to care about with or without LTC.
|
||||
*/
|
||||
|
||||
Config->ParameterChanged.connect_same_thread (config_connection, boost::bind (&AudioEngine::parameter_changed, this, _1));
|
||||
#endif
|
||||
}
|
||||
|
||||
AudioEngine::~AudioEngine ()
|
||||
{
|
||||
config_connection.disconnect ();
|
||||
#ifdef HAVE_LTC
|
||||
if (_ltc_output && _ltc_output->jack_port()) {
|
||||
jack_port_disconnect (_jack, _ltc_output->jack_port());
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock tm (_process_lock);
|
||||
@ -234,9 +209,6 @@ AudioEngine::start ()
|
||||
_running = true;
|
||||
_has_run = true;
|
||||
Running(); /* EMIT SIGNAL */
|
||||
|
||||
reconnect_ltc ();
|
||||
|
||||
} else {
|
||||
// error << _("cannot activate JACK client") << endmsg;
|
||||
}
|
||||
@ -1513,8 +1485,6 @@ AudioEngine::reconnect_to_jack ()
|
||||
|
||||
MIDI::Manager::instance()->reconnect ();
|
||||
|
||||
reconnect_ltc ();
|
||||
|
||||
Running (); /* EMIT SIGNAL*/
|
||||
|
||||
start_metering_thread ();
|
||||
@ -1659,29 +1629,3 @@ AudioEngine::destroy ()
|
||||
_instance = 0;
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::parameter_changed (const std::string& s)
|
||||
{
|
||||
if (s == "ltc-source-port") {
|
||||
reconnect_ltc ();
|
||||
}
|
||||
else if (s == "ltc-sink-port") {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::reconnect_ltc ()
|
||||
{
|
||||
if (_ltc_input) {
|
||||
|
||||
string src = Config->get_ltc_source_port();
|
||||
|
||||
_ltc_input->disconnect_all ();
|
||||
|
||||
if (src != _("None") && !src.empty()) {
|
||||
_ltc_input->connect (src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,6 @@ Session::Session (AudioEngine &eng,
|
||||
, _bundles (new BundleList)
|
||||
, _bundle_xml_node (0)
|
||||
, _current_trans (0)
|
||||
, _click_io ((IO*) 0)
|
||||
, click_data (0)
|
||||
, click_emphasis_data (0)
|
||||
, main_outs (0)
|
||||
@ -371,7 +370,30 @@ Session::when_engine_running ()
|
||||
|
||||
try {
|
||||
XMLNode* child = 0;
|
||||
|
||||
_ltc_input.reset (new IO (*this, _("LTC In"), IO::Input));
|
||||
_ltc_output.reset (new IO (*this, _("LTC Out"), IO::Output));
|
||||
|
||||
if (state_tree && (child = find_named_node (*state_tree->root(), "LTC-In")) != 0) {
|
||||
_ltc_input->set_state (*(child->children().front()), Stateful::loading_state_version);
|
||||
} else {
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||
_ltc_input->ensure_io (ChanCount (DataType::AUDIO, 1), true, this);
|
||||
}
|
||||
reconnect_ltc_input ();
|
||||
}
|
||||
|
||||
if (state_tree && (child = find_named_node (*state_tree->root(), "LTC-Out")) != 0) {
|
||||
_ltc_output->set_state (*(child->children().front()), Stateful::loading_state_version);
|
||||
} else {
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||
_ltc_output->ensure_io (ChanCount (DataType::AUDIO, 1), true, this);
|
||||
}
|
||||
reconnect_ltc_output ();
|
||||
}
|
||||
|
||||
_click_io.reset (new ClickIO (*this, "click"));
|
||||
_click_gain.reset (new Amp (*this));
|
||||
_click_gain->activate ();
|
||||
@ -4740,3 +4762,47 @@ Session::operation_in_progress (GQuark op) const
|
||||
{
|
||||
return (find (_current_trans_quarks.begin(), _current_trans_quarks.end(), op) != _current_trans_quarks.end());
|
||||
}
|
||||
|
||||
boost::shared_ptr<Port>
|
||||
Session::ltc_input_port () const
|
||||
{
|
||||
return _ltc_input->nth (0);
|
||||
}
|
||||
|
||||
boost::shared_ptr<Port>
|
||||
Session::ltc_output_port () const
|
||||
{
|
||||
return _ltc_output->nth (0);
|
||||
}
|
||||
|
||||
void
|
||||
Session::reconnect_ltc_input ()
|
||||
{
|
||||
if (_ltc_input) {
|
||||
|
||||
string src = Config->get_ltc_source_port();
|
||||
|
||||
_ltc_input->disconnect (this);
|
||||
|
||||
if (src != _("None") && !src.empty()) {
|
||||
_ltc_input->nth (0)->connect (src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Session::reconnect_ltc_output ()
|
||||
{
|
||||
if (_ltc_output) {
|
||||
|
||||
#if 0
|
||||
string src = Config->get_ltc_sink_port();
|
||||
|
||||
_ltc_output->disconnect (this);
|
||||
|
||||
if (src != _("None") && !src.empty()) {
|
||||
_ltc_output->nth (0)->connect (src);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1161,6 +1161,16 @@ Session::state (bool full_state)
|
||||
gain_child->add_child_nocopy (_click_gain->state (full_state));
|
||||
}
|
||||
|
||||
if (_ltc_input) {
|
||||
XMLNode* ltc_input_child = node->add_child ("LTC-In");
|
||||
ltc_input_child->add_child_nocopy (_ltc_input->state (full_state));
|
||||
}
|
||||
|
||||
if (_ltc_input) {
|
||||
XMLNode* ltc_output_child = node->add_child ("LTC-Out");
|
||||
ltc_output_child->add_child_nocopy (_ltc_output->state (full_state));
|
||||
}
|
||||
|
||||
node->add_child_nocopy (_speakers->get_state());
|
||||
node->add_child_nocopy (_tempo_map->get_state());
|
||||
node->add_child_nocopy (get_control_protocol_state());
|
||||
@ -3551,6 +3561,10 @@ Session::config_changed (std::string p, bool ours)
|
||||
AudioSource::allocate_working_buffers (frame_rate());
|
||||
} else if (p == "automation-thinning-factor") {
|
||||
Evoral::ControlList::set_thinning_factor (Config->get_automation_thinning_factor());
|
||||
} else if (p == "ltc-source-port") {
|
||||
reconnect_ltc_input ();
|
||||
} else if (p == "ltc-sink-port") {
|
||||
reconnect_ltc_output ();
|
||||
}
|
||||
|
||||
set_dirty ();
|
||||
|
Loading…
Reference in New Issue
Block a user