mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
ALSA|Dummy Backend: do as jack does:
when the backend is closed, unregister all ports.
This commit is contained in:
parent
330f5fdf2e
commit
dc318e6e74
4 changed files with 13 additions and 8 deletions
|
|
@ -646,7 +646,7 @@ AlsaAudioBackend::stop ()
|
||||||
delete m;
|
delete m;
|
||||||
}
|
}
|
||||||
|
|
||||||
unregister_system_ports();
|
unregister_ports();
|
||||||
delete _pcmi; _pcmi = 0;
|
delete _pcmi; _pcmi = 0;
|
||||||
release_device();
|
release_device();
|
||||||
|
|
||||||
|
|
@ -1057,7 +1057,7 @@ AlsaAudioBackend::register_system_midi_ports()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AlsaAudioBackend::unregister_system_ports()
|
AlsaAudioBackend::unregister_ports (bool system_only)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
_system_inputs.clear();
|
_system_inputs.clear();
|
||||||
|
|
@ -1066,8 +1066,9 @@ AlsaAudioBackend::unregister_system_ports()
|
||||||
_system_midi_out.clear();
|
_system_midi_out.clear();
|
||||||
while (i < _ports.size ()) {
|
while (i < _ports.size ()) {
|
||||||
AlsaPort* port = _ports[i];
|
AlsaPort* port = _ports[i];
|
||||||
if (port->is_physical () && port->is_terminal ()) {
|
if (! system_only || (port->is_physical () && port->is_terminal ())) {
|
||||||
port->disconnect_all ();
|
port->disconnect_all ();
|
||||||
|
delete port;
|
||||||
_ports.erase (_ports.begin() + i);
|
_ports.erase (_ports.begin() + i);
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,7 @@ class AlsaAudioBackend : public AudioBackend {
|
||||||
PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
|
PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
|
||||||
int register_system_audio_ports ();
|
int register_system_audio_ports ();
|
||||||
int register_system_midi_ports ();
|
int register_system_midi_ports ();
|
||||||
void unregister_system_ports ();
|
void unregister_ports (bool system_only = false);
|
||||||
|
|
||||||
std::vector<AlsaPort *> _ports;
|
std::vector<AlsaPort *> _ports;
|
||||||
std::vector<AlsaPort *> _system_inputs;
|
std::vector<AlsaPort *> _system_inputs;
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,9 @@ DummyAudioBackend::_start (bool /*for_latency_measurement*/)
|
||||||
|
|
||||||
if (_ports.size()) {
|
if (_ports.size()) {
|
||||||
PBD::warning << _("DummyAudioBackend: recovering from unclean shutdown, port registry is not empty.") << endmsg;
|
PBD::warning << _("DummyAudioBackend: recovering from unclean shutdown, port registry is not empty.") << endmsg;
|
||||||
|
for (std::vector<DummyPort*>::const_iterator it = _ports.begin (); it != _ports.end (); ++it) {
|
||||||
|
PBD::info << _("DummyAudioBackend: port '") << (*it)->name () << "' exists." << endmsg;
|
||||||
|
}
|
||||||
_system_inputs.clear();
|
_system_inputs.clear();
|
||||||
_ports.clear();
|
_ports.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -366,7 +369,7 @@ DummyAudioBackend::stop ()
|
||||||
PBD::error << _("DummyAudioBackend: failed to terminate.") << endmsg;
|
PBD::error << _("DummyAudioBackend: failed to terminate.") << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unregister_system_ports();
|
unregister_ports();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -709,14 +712,15 @@ DummyAudioBackend::register_system_ports()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DummyAudioBackend::unregister_system_ports()
|
DummyAudioBackend::unregister_ports (bool system_only)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
_system_inputs.clear();
|
_system_inputs.clear();
|
||||||
while (i < _ports.size ()) {
|
while (i < _ports.size ()) {
|
||||||
DummyPort* port = _ports[i];
|
DummyPort* port = _ports[i];
|
||||||
if (port->is_physical () && port->is_terminal ()) {
|
if (! system_only || (port->is_physical () && port->is_terminal ())) {
|
||||||
port->disconnect_all ();
|
port->disconnect_all ();
|
||||||
|
delete port;
|
||||||
_ports.erase (_ports.begin() + i);
|
_ports.erase (_ports.begin() + i);
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ class DummyAudioBackend : public AudioBackend {
|
||||||
/* port engine */
|
/* port engine */
|
||||||
PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
|
PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
|
||||||
int register_system_ports ();
|
int register_system_ports ();
|
||||||
void unregister_system_ports ();
|
void unregister_ports (bool system_only = false);
|
||||||
|
|
||||||
std::vector<DummyAudioPort *> _system_inputs;
|
std::vector<DummyAudioPort *> _system_inputs;
|
||||||
std::vector<DummyPort *> _ports;
|
std::vector<DummyPort *> _ports;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue