13
0

more fixes and rationalizations for MIDI option handling in the audio MIDI setup

This commit is contained in:
Paul Davis 2013-10-10 16:18:27 -04:00
parent c96108c2e1
commit b194c1ad88
2 changed files with 33 additions and 4 deletions

View File

@ -58,6 +58,9 @@ using namespace Gtkmm2ext;
using namespace PBD; using namespace PBD;
using namespace Glib; using namespace Glib;
static const unsigned int midi_tab = -1; /* not currently in use */
static const unsigned int latency_tab = 1; /* zero-based, page zero is the main setup page */
EngineControl::EngineControl () EngineControl::EngineControl ()
: ArdourDialog (_("Audio/MIDI Setup")) : ArdourDialog (_("Audio/MIDI Setup"))
, basic_packer (9, 3) , basic_packer (9, 3)
@ -254,6 +257,7 @@ EngineControl::EngineControl ()
sample_rate_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::sample_rate_changed)); sample_rate_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::sample_rate_changed));
buffer_size_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::buffer_size_changed)); buffer_size_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::buffer_size_changed));
device_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::device_changed)); device_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::device_changed));
midi_option_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::midi_option_changed));
input_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed)); input_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
output_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed)); output_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
@ -887,6 +891,14 @@ EngineControl::show_buffer_duration ()
buffer_size_duration_label.set_text (buf); buffer_size_duration_label.set_text (buf);
} }
void
EngineControl::midi_option_changed ()
{
if (!ignore_changes) {
save_state ();
}
}
void void
EngineControl::parameter_changed () EngineControl::parameter_changed ()
{ {
@ -963,6 +975,7 @@ EngineControl::store_state (State& state)
state.output_latency = get_output_latency (); state.output_latency = get_output_latency ();
state.input_channels = get_input_channels (); state.input_channels = get_input_channels ();
state.output_channels = get_output_channels (); state.output_channels = get_output_channels ();
state.midi_option = get_midi_option ();
} }
void void
@ -1195,6 +1208,10 @@ EngineControl::push_state_to_backend (bool start)
if (get_buffer_size() != backend->buffer_size()) { if (get_buffer_size() != backend->buffer_size()) {
change_bufsize = true; change_bufsize = true;
} }
if (get_midi_option() != backend->midi_option()) {
change_midi = true;
}
/* zero-requested channels means "all available" */ /* zero-requested channels means "all available" */
@ -1228,6 +1245,7 @@ EngineControl::push_state_to_backend (bool start)
change_bufsize = true; change_bufsize = true;
change_channels = true; change_channels = true;
change_latency = true; change_latency = true;
change_midi = true;
} }
} else { } else {
@ -1278,6 +1296,7 @@ EngineControl::push_state_to_backend (bool start)
if (change_driver || change_device || change_channels || change_latency || if (change_driver || change_device || change_channels || change_latency ||
(change_rate && !backend->can_change_sample_rate_when_running()) || (change_rate && !backend->can_change_sample_rate_when_running()) ||
change_midi ||
(change_bufsize && !backend->can_change_buffer_size_when_running())) { (change_bufsize && !backend->can_change_buffer_size_when_running())) {
restart_required = true; restart_required = true;
} else { } else {
@ -1286,7 +1305,7 @@ EngineControl::push_state_to_backend (bool start)
if (was_running) { if (was_running) {
if (!change_driver && !change_device && !change_channels && !change_latency) { if (!change_driver && !change_device && !change_channels && !change_latency && !change_midi) {
/* no changes in any parameters that absolutely require a /* no changes in any parameters that absolutely require a
* restart, so check those that might be changeable without a * restart, so check those that might be changeable without a
* restart * restart
@ -1351,7 +1370,9 @@ EngineControl::push_state_to_backend (bool start)
} }
} }
backend->set_midi_option (midi_option_combo.get_active_text()); if (change_midi) {
backend->set_midi_option (get_midi_option());
}
if (start || (was_running && restart_required)) { if (start || (was_running && restart_required)) {
if (ARDOUR_UI::instance()->reconnect_to_engine()) { if (ARDOUR_UI::instance()->reconnect_to_engine()) {
@ -1427,6 +1448,12 @@ EngineControl::get_buffer_size () const
return samples; return samples;
} }
string
EngineControl::get_midi_option () const
{
return midi_option_combo.get_active_text();
}
uint32_t uint32_t
EngineControl::get_input_channels() const EngineControl::get_input_channels() const
{ {
@ -1519,12 +1546,12 @@ EngineControl::on_switch_page (GtkNotebookPage*, guint page_num)
apply_button->set_sensitive (false); apply_button->set_sensitive (false);
} }
if (page_num == 1) { if (page_num == midi_tab) {
/* MIDI tab */ /* MIDI tab */
refresh_midi_display (); refresh_midi_display ();
} }
if (page_num == 2) { if (page_num == latency_tab) {
/* latency tab */ /* latency tab */
if (!ARDOUR::AudioEngine::instance()->running()) { if (!ARDOUR::AudioEngine::instance()->running()) {

View File

@ -118,6 +118,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
void sample_rate_changed (); void sample_rate_changed ();
void buffer_size_changed (); void buffer_size_changed ();
void parameter_changed (); void parameter_changed ();
void midi_option_changed ();
void setup_midi_tab_for_backend (); void setup_midi_tab_for_backend ();
void setup_midi_tab_for_jack (); void setup_midi_tab_for_jack ();
@ -134,6 +135,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
std::string get_device_name() const; std::string get_device_name() const;
std::string get_driver() const; std::string get_driver() const;
std::string get_backend() const; std::string get_backend() const;
std::string get_midi_option () const;
void device_changed (); void device_changed ();
void list_devices (); void list_devices ();