ALSA|Dummy Backend: do as jack does:

when the backend is closed, unregister all ports.
This commit is contained in:
Robin Gareus 2014-09-07 22:50:57 +02:00
parent 330f5fdf2e
commit dc318e6e74
4 changed files with 13 additions and 8 deletions

View file

@ -646,7 +646,7 @@ AlsaAudioBackend::stop ()
delete m;
}
unregister_system_ports();
unregister_ports();
delete _pcmi; _pcmi = 0;
release_device();
@ -1057,7 +1057,7 @@ AlsaAudioBackend::register_system_midi_ports()
}
void
AlsaAudioBackend::unregister_system_ports()
AlsaAudioBackend::unregister_ports (bool system_only)
{
size_t i = 0;
_system_inputs.clear();
@ -1066,8 +1066,9 @@ AlsaAudioBackend::unregister_system_ports()
_system_midi_out.clear();
while (i < _ports.size ()) {
AlsaPort* port = _ports[i];
if (port->is_physical () && port->is_terminal ()) {
if (! system_only || (port->is_physical () && port->is_terminal ())) {
port->disconnect_all ();
delete port;
_ports.erase (_ports.begin() + i);
} else {
++i;

View file

@ -366,7 +366,7 @@ class AlsaAudioBackend : public AudioBackend {
PortHandle add_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags);
int register_system_audio_ports ();
int register_system_midi_ports ();
void unregister_system_ports ();
void unregister_ports (bool system_only = false);
std::vector<AlsaPort *> _ports;
std::vector<AlsaPort *> _system_inputs;