diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 26ced33885..17d7cd4010 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -282,17 +282,7 @@ class AudioBackend : public PortEngine { virtual std::string midi_option () const = 0; /* State Control */ - - /* non-virtual method to avoid possible overrides of default - * parameters. See Scott Meyers or other books on C++ to - * understand this pattern, or possibly just this: - * - * http://stackoverflow.com/questions/12139786/good-pratice-default-arguments-for-pure-virtual-method - */ - int start (bool for_latency_measurement=false) { - return _start (for_latency_measurement); - } - + /** Start using the device named in the most recent call * to set_device(), with the parameters set by various * the most recent calls to set_sample_rate() etc. etc. @@ -308,8 +298,24 @@ class AudioBackend : public PortEngine { * any existing systemic latency settings. * * Return zero if successful, negative values otherwise. - */ - virtual int _start (bool for_latency_measurement) = 0; + * + * + * + * + * Why is this non-virtual but ::_start() is virtual ? + * Virtual methods with default parameters create possible ambiguity + * because a derived class may implement the same method with a different + * type or value of default parameter. + * + * So we make this non-virtual method to avoid possible overrides of + * default parameters. See Scott Meyers or other books on C++ to understand + * this pattern, or possibly just this: + * + * http://stackoverflow.com/questions/12139786/good-pratice-default-arguments-for-pure-virtual-method + */ + int start (bool for_latency_measurement=false) { + return _start (for_latency_measurement); + } /** Stop using the device currently in use. * @@ -481,6 +487,8 @@ class AudioBackend : public PortEngine { protected: AudioEngine& engine; + + virtual int _start (bool for_latency_measurement) = 0; }; struct AudioBackendInfo { diff --git a/libs/backends/jack/jack_audiobackend.cc b/libs/backends/jack/jack_audiobackend.cc index 86e5b9d54c..332b6eec85 100644 --- a/libs/backends/jack/jack_audiobackend.cc +++ b/libs/backends/jack/jack_audiobackend.cc @@ -547,8 +547,11 @@ JACKAudioBackend::_start (bool for_latency_measurement) /* Now that we have buffer size and sample rate established, the engine can go ahead and do its stuff */ - - engine.reestablish_ports (); + + if (engine.reestablish_ports ()) { + error << _("Could not re-establish ports after connecting to JACK") << endmsg; + return -1; + } if (!jack_port_type_get_buffer_size) { warning << _("This version of JACK is old - you should upgrade to a newer version that supports jack_port_type_get_buffer_size()") << endmsg; diff --git a/libs/backends/jack/jack_audiobackend.h b/libs/backends/jack/jack_audiobackend.h index 2c77e6112b..299bb1cefd 100644 --- a/libs/backends/jack/jack_audiobackend.h +++ b/libs/backends/jack/jack_audiobackend.h @@ -89,7 +89,6 @@ class JACKAudioBackend : public AudioBackend { std::string control_app_name () const; void launch_control_app (); - int _start (bool for_latency_measurement); int stop (); int freewheel (bool); @@ -272,6 +271,9 @@ class JACKAudioBackend : public AudioBackend { */ JACKSession* _session; + + protected: + int _start (bool for_latency_measurement); }; } // namespace diff --git a/libs/backends/jack/jack_connection.cc b/libs/backends/jack/jack_connection.cc index b3d7fcecc4..09e6c9d6e7 100644 --- a/libs/backends/jack/jack_connection.cc +++ b/libs/backends/jack/jack_connection.cc @@ -143,7 +143,12 @@ JackConnection::close () if (_priv_jack) { int ret = jack_client_close (_priv_jack); _jack = 0; + + /* If we started JACK, it will be closing down */ + usleep (500000); + Disconnected (""); /* EMIT SIGNAL */ + return ret; } diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 4c0282f1f7..567df99335 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -44,9 +44,6 @@ typedef int socklen_t; inline void closesocket(int s) { ::close(s); } #endif -#include -#include - #include "pbd/xml++.h" #include "pbd/error.h" #include "pbd/failed_constructor.h" diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index 01f8bf3b8a..0f2a69d5d7 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -20,7 +20,6 @@ #ifndef __midipp_mmc_h_h__ #define __midipp_mmc_h_h__ -#include #include "timecode/time.h" #include "pbd/signals.h" diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index a915320fa3..daa2fa2db4 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -22,7 +22,9 @@ #include #include -#include +#include /* XXX ... desirable to get rid of this but needed for + * now due to use of JackPortIsXXXX + */ #include