move ownership of LTC I/O ports to Session, and manage as IO objects
[ardour.git] / libs / ardour / audioengine.cc
index 338bc2fd0e00b687cba600b8bbc064fc7f9af081..2c57949074e2e4551cb45bccb531fb82fbe6042b 100644 (file)
@@ -89,18 +89,6 @@ AudioEngine::AudioEngine (string client_name, string session_uuid)
        }
 
        Port::set_engine (this);
-
-#ifdef HAVE_LTC
-       _ltc_input = register_port (DataType::AUDIO, _("LTC in"), true);
-
-       /* 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 ()
@@ -221,9 +209,6 @@ AudioEngine::start ()
                        _running = true;
                        _has_run = true;
                        Running(); /* EMIT SIGNAL */
-
-                       reconnect_ltc ();
-
                } else {
                        // error << _("cannot activate JACK client") << endmsg;
                }
@@ -536,6 +521,15 @@ AudioEngine::process_callback (pframes_t nframes)
        }
 
        if (_session == 0) {
+#ifdef HAVE_LTC
+               // silence LTC
+               jack_default_audio_sample_t *out;
+               boost::shared_ptr<Port> ltcport = ltc_output_port();
+               if (ltcport && ltcport->jack_port()) {
+                       out = (jack_default_audio_sample_t*) jack_port_get_buffer (ltcport->jack_port(), nframes);
+                       if (out) memset(out, 0, nframes * sizeof(jack_default_audio_sample_t));
+               }
+#endif
 
                if (!_freewheeling) {
                        MIDI::Manager::instance()->cycle_start(nframes);
@@ -1491,8 +1485,6 @@ AudioEngine::reconnect_to_jack ()
 
        MIDI::Manager::instance()->reconnect ();
 
-       reconnect_ltc ();
-
        Running (); /* EMIT SIGNAL*/
 
        start_metering_thread ();
@@ -1637,26 +1629,3 @@ AudioEngine::destroy ()
        _instance = 0;
 }
 
-void
-AudioEngine::parameter_changed (const std::string& s)
-{
-       if (s == "ltc-source-port") {
-               reconnect_ltc ();
-       }
-
-}
-
-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);
-               }
-       }
-}