#include <gtkmm/messagedialog.h>
#include "pbd/error.h"
+#include "pbd/locale_guard.h"
#include "pbd/xml++.h"
#include "pbd/unwind.h"
#include "pbd/failed_constructor.h"
// set driver & devices
State state = get_matching_state (backend_combo.get_active_text());
if (state) {
+ DEBUG_ECONTROL ("backend-changed(): found prior state for backend");
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
set_current_state (state);
+ } else {
+ DEBUG_ECONTROL ("backend-changed(): no prior state for backend");
}
+ } else {
+ DEBUG_ECONTROL (string_compose ("backend-changed(): _have_control=%1 ignore_changes=%2", _have_control, ignore_changes));
}
if (!ignore_changes) {
state->lru = lru_val;
}
-#if 1
- /* remove accumulated duplicates (due to bug in ealier version)
- * this can be removed again before release
- */
- for (StateList::iterator i = states.begin(); i != states.end();) {
- if ((*i)->backend == state->backend &&
- (*i)->driver == state->driver &&
- (*i)->device == state->device) {
- i = states.erase(i);
- } else {
- ++i;
- }
- }
-#endif
-
states.push_back (state);
}
}
/* now see if there was an active state and switch the setup to it */
- // purge states of backend that are not available in this built
+ /* purge states of backend that are not available in this built */
vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
vector<std::string> backend_names;
states.sort (state_sort_cmp);
+ /* purge old states referring to the same backend */
+ const time_t now = time (NULL);
+ for (vector<std::string>::const_iterator bi = backend_names.begin(); bi != backend_names.end(); ++bi) {
+ bool first = true;
+ for (StateList::iterator i = states.begin(); i != states.end();) {
+ if ((*i)->backend != *bi) {
+ ++i; continue;
+ }
+ // keep at latest one for every audio-system
+ if (first) {
+ first = false;
+ ++i; continue;
+ }
+ // also keep states used in the last 90 days.
+ if ((now - (*i)->lru) < 86400 * 90) {
+ ++i; continue;
+ }
+ assert (!(*i)->active);
+ i = states.erase(i);
+ }
+ }
+
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
if ((*i)->active) {
ARDOUR::AudioEngine::instance()->stop ();
} else {
if (!ARDOUR_UI::instance()->session_loaded) {
+ pop_splash ();
hide ();
+ ARDOUR::GUIIdle ();
}
start_engine ();
if (!ARDOUR_UI::instance()->session_loaded) {
void
EngineControl::latency_back_button_clicked ()
{
- ARDOUR::AudioEngine::instance()->stop(true);
+ ARDOUR::AudioEngine::instance()->stop_latency_detection ();
notebook.set_current_page(0);
}
void
EngineControl::use_latency_button_clicked ()
{
+ boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
if (_measure_midi) {
ARDOUR::MIDIDM* mididm = ARDOUR::AudioEngine::instance()->mididm ();
if (!mididm) {
uint32_t one_way = max ((ARDOUR::framecnt_t) 0, extra / 2);
_measure_midi->input_latency = one_way;
_measure_midi->output_latency = one_way;
+ if (backend->can_change_systemic_latency_when_running ()) {
+ backend->set_systemic_midi_input_latency (_measure_midi->name, one_way);
+ backend->set_systemic_midi_output_latency (_measure_midi->name, one_way);
+ }
notebook.set_current_page (midi_tab);
} else {
MTDM* mtdm = ARDOUR::AudioEngine::instance()->mtdm ();
input_latency_adjustment.set_value (one_way);
output_latency_adjustment.set_value (one_way);
+ if (backend->can_change_systemic_latency_when_running ()) {
+ backend->set_systemic_input_latency (one_way);
+ backend->set_systemic_output_latency (one_way);
+ }
/* back to settings page */
notebook.set_current_page (0);
stop_engine ();
} else {
if (!ARDOUR_UI::instance()->session_loaded) {
+ pop_splash ();
hide ();
+ ARDOUR::GUIIdle ();
}
start_engine ();
if (!ARDOUR_UI::instance()->session_loaded) {