ALSA|Dummy: ignore port unregistration when engine is stopped
authorRobin Gareus <robin@gareus.org>
Sun, 7 Sep 2014 23:25:56 +0000 (01:25 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 7 Sep 2014 23:25:56 +0000 (01:25 +0200)
When changing Engine parameters, ardour first stops
the engine and only later when re-etablishing ports
unregisters/re-registers them.

ALSA: silently ignore port unregs and silently accept registrations
Dummy: print a PBD::info message,

libs/backends/alsa/alsa_audiobackend.cc
libs/backends/dummy/dummy_audiobackend.cc

index 834ea41e49f531650fcbb344fc099b04895bde31..936fc990cef50a784254084a1024f4d044a54b1a 100644 (file)
@@ -914,8 +914,8 @@ AlsaAudioBackend::add_port (
 void
 AlsaAudioBackend::unregister_port (PortEngine::PortHandle port_handle)
 {
-       if (!valid_port (port_handle)) {
-               PBD::error << _("AlsaBackend::unregister_port: Invalid Port.") << endmsg;
+       if (!_run) {
+               return;
        }
        AlsaPort* port = static_cast<AlsaPort*>(port_handle);
        std::vector<AlsaPort*>::iterator i = std::find (_ports.begin (), _ports.end (), static_cast<AlsaPort*>(port_handle));
index e8a21df2922435a213274d3c60446e681de0a82b..10df74d676b45c08a11d42d35919057bc0e46449 100644 (file)
@@ -595,6 +595,9 @@ DummyAudioBackend::register_port (
 {
        if (name.size () == 0) { return 0; }
        if (flags & IsPhysical) { return 0; }
+       if (!_running) {
+               PBD::info << _("DummyBackend::register_port: Engine is not running.") << endmsg;
+       }
        return add_port (_instance_name + ":" + name, type, flags);
 }
 
@@ -631,8 +634,10 @@ DummyAudioBackend::add_port (
 void
 DummyAudioBackend::unregister_port (PortEngine::PortHandle port_handle)
 {
-       if (!valid_port (port_handle)) {
-               PBD::error << _("DummyBackend::unregister_port: Invalid Port.") << endmsg;
+       if (!_running) {
+               PBD::info << _("DummyBackend::unregister_port: Engine is not running.") << endmsg;
+               assert (!valid_port (port_handle));
+               return;
        }
        DummyPort* port = static_cast<DummyPort*>(port_handle);
        std::vector<DummyPort*>::iterator i = std::find (_ports.begin (), _ports.end (), static_cast<DummyPort*>(port_handle));