Properly desensitize various engine-controls.
authorRobin Gareus <robin@gareus.org>
Sat, 1 Apr 2017 12:37:24 +0000 (14:37 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 1 Apr 2017 12:37:35 +0000 (14:37 +0200)
MIDI system and channel-count cannot be changed while the engine is
running.

gtk2_ardour/engine_dialog.cc

index 57a30abc9906df4a0c8f051419194118ccadc6d7..31738bed15cc892ca63e891026c77113020c8248 100644 (file)
@@ -779,6 +779,7 @@ EngineControl::update_sensitivity ()
 
        bool valid = true;
        size_t devices_available = 0;
+       bool engine_running = ARDOUR::AudioEngine::instance()->running();
 
        if (backend->use_separate_input_and_output_devices ()) {
                devices_available += get_popdown_string_count (input_device_combo);
@@ -796,12 +797,12 @@ EngineControl::update_sensitivity ()
        } else {
                input_latency.set_sensitive (true);
                output_latency.set_sensitive (true);
-               input_channels.set_sensitive (true);
-               output_channels.set_sensitive (true);
+               input_channels.set_sensitive (!engine_running);
+               output_channels.set_sensitive (!engine_running);
        }
 
        if (get_popdown_string_count (buffer_size_combo) > 0) {
-               if (!ARDOUR::AudioEngine::instance()->running()) {
+               if (!engine_running) {
                        buffer_size_combo.set_sensitive (valid);
                } else if (backend->can_change_sample_rate_when_running()) {
                        buffer_size_combo.set_sensitive (valid || !_have_control);
@@ -827,7 +828,7 @@ EngineControl::update_sensitivity ()
 
        if (get_popdown_string_count (sample_rate_combo) > 0) {
                bool allow_to_set_rate = false;
-               if (!ARDOUR::AudioEngine::instance()->running()) {
+               if (!engine_running) {
                        if (!ARDOUR_UI::instance()->session_loaded) {
                                // engine is not running, no session loaded -> anything goes.
                                allow_to_set_rate = true;
@@ -843,7 +844,7 @@ EngineControl::update_sensitivity ()
        }
 
        if (get_popdown_string_count (nperiods_combo) > 0) {
-               if (!ARDOUR::AudioEngine::instance()->running()) {
+               if (!engine_running) {
                        nperiods_combo.set_sensitive (true);
                } else {
                        nperiods_combo.set_sensitive (false);
@@ -855,7 +856,7 @@ EngineControl::update_sensitivity ()
        if (_have_control) {
                start_stop_button.set_sensitive(true);
                start_stop_button.show();
-               if (ARDOUR::AudioEngine::instance()->running()) {
+               if (engine_running) {
                        start_stop_button.set_text("Stop");
                        update_devices_button.set_sensitive(false);
                        use_buffered_io_button.set_sensitive(false);
@@ -883,7 +884,7 @@ EngineControl::update_sensitivity ()
                start_stop_button.hide();
        }
 
-       if (ARDOUR::AudioEngine::instance()->running() && _have_control) {
+       if (engine_running && _have_control) {
                input_device_combo.set_sensitive (false);
                output_device_combo.set_sensitive (false);
                device_combo.set_sensitive (false);
@@ -898,6 +899,8 @@ EngineControl::update_sensitivity ()
                        driver_combo.set_sensitive (false);
                }
        }
+
+       midi_option_combo.set_sensitive (!engine_running);
 }
 
 void