#include <boost/scoped_ptr.hpp>
-#include <gtkmm/messagedialog.h>
-
#include "pbd/error.h"
#include "pbd/locale_guard.h"
#include "pbd/xml++.h"
#include "opts.h"
#include "debug.h"
+#include "ardour_message.h"
#include "ardour_ui.h"
#include "engine_dialog.h"
#include "gui_thread.h"
vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
if (backends.empty()) {
- MessageDialog msg (string_compose (_("No audio/MIDI backends detected. %1 cannot run\n\n(This is a build/packaging/system error. It should never happen.)"), PROGRAM_NAME));
+ ArdourMessageDialog msg (string_compose (_("No audio/MIDI backends detected. %1 cannot run\n\n(This is a build/packaging/system error. It should never happen.)"), PROGRAM_NAME));
msg.run ();
throw failed_constructor ();
}
}
}
-bool
-EngineControl::try_autostart ()
-{
- if (!start_stop_button.get_sensitive()) {
- return false;
- }
- if (ARDOUR::AudioEngine::instance()->running()) {
- return true;
- }
- return start_engine ();
-}
-
bool
EngineControl::start_engine ()
{
if (push_state_to_backend (true) != 0) {
- MessageDialog msg (*this, ARDOUR::AudioEngine::instance()->get_last_backend_error());
+ ArdourMessageDialog msg (*this, ARDOUR::AudioEngine::instance()->get_last_backend_error());
msg.run();
return false;
}
EngineControl::stop_engine (bool for_latency)
{
if (ARDOUR::AudioEngine::instance()->stop(for_latency)) {
- MessageDialog msg(*this,
- ARDOUR::AudioEngine::instance()->get_last_backend_error());
+ ArdourMessageDialog msg(*this, ARDOUR::AudioEngine::instance()->get_last_backend_error());
msg.run();
return false;
}
ARDOUR::AudioEngine::instance()->get_physical_inputs (type, inputs);
if (!ARDOUR::AudioEngine::instance()->running()) {
- MessageDialog msg (_("Failed to start or connect to audio-engine.\n\nLatency calibration requires a working audio interface."));
+ ArdourMessageDialog msg (_("Failed to start or connect to audio-engine.\n\nLatency calibration requires a working audio interface."));
notebook.set_current_page (0);
msg.run ();
return;
}
else if (inputs.empty() || outputs.empty()) {
- MessageDialog msg (_("Your selected audio configuration is playback- or capture-only.\n\nLatency calibration requires playback and capture"));
+ ArdourMessageDialog msg (_("Your selected audio configuration is playback- or capture-only.\n\nLatency calibration requires playback and capture"));
notebook.set_current_page (0);
msg.run ();
return;
m = manage (new ArdourButton ((*p)->name, ArdourButton::led_default_elements));
m->set_name ("midi device");
- m->set_can_focus (Gtk::CAN_FOCUS);
+ m->set_can_focus (true);
m->add_events (Gdk::BUTTON_RELEASE_MASK);
m->set_active (enabled);
m->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &EngineControl::midi_device_enabled_toggled), m, *p));
boost::shared_ptr<ARDOUR::AudioBackend> backend;
- if (!(backend = ARDOUR::AudioEngine::instance ()->set_backend (
- state->backend, downcase (std::string(PROGRAM_NAME)), ""))) {
+ if (!(backend = ARDOUR::AudioEngine::instance ()->set_backend (state->backend, downcase (std::string (PROGRAM_NAME)), ""))) {
DEBUG_ECONTROL (string_compose ("Unable to set backend to %1", state->backend));
// this shouldn't happen as the invalid backend names should have been
// removed from the list of states.
}
void
-EngineControl::on_response (int)
+EngineControl::on_response (int r)
{
- /* we do nothing when our response signal is emitted ... that's the
- * responsibility of whoever displayed us.
+ /* Do not run ArdourDialog::on_response() which will hide us. Leave
+ * that to whoever invoked us, if they wish to hide us after "start".
+ *
+ * StartupFSM does hide us after response(); Window > Audio/MIDI Setup
+ * does not.
*/
+ pop_splash ();
+ Gtk::Dialog::on_response (r);
}
void
EngineControl::set_desired_sample_rate (uint32_t sr)
{
_desired_sample_rate = sr;
- if (ARDOUR::AudioEngine::instance ()->running ()
- && ARDOUR::AudioEngine::instance ()->sample_rate () != sr) {
+
+ if (ARDOUR::AudioEngine::instance ()->running () && ARDOUR::AudioEngine::instance ()->sample_rate () != sr) {
stop_engine ();
}
+
device_changed ();
}