improve the user experience when starting up 3.0-SG with SG as the driver

git-svn-id: svn://localhost/ardour2/branches/3.0-SG@13385 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-11-05 21:57:06 +00:00
parent 7b995e773e
commit 2659be95c5
4 changed files with 108 additions and 22 deletions

View file

@ -670,11 +670,28 @@ EngineControl::engine_running ()
return false;
}
int
EngineControl::prepare ()
{
string driver = driver_combo.get_active_text();
if (driver == "SoundGrid") {
return soundgrid_init (inputs_adjustment.get_value(), outputs_adjustment.get_value(),
16, /* max tracks */
16, /* max busses */
8 /* max plugins per track */
);
}
return 0;
}
int
EngineControl::setup_engine ()
{
vector<string> args;
std::string cwd = "/tmp";
string driver = driver_combo.get_active_text();
build_command_line (args);
@ -699,7 +716,6 @@ EngineControl::setup_engine ()
jackdrc << endl;
jackdrc.close ();
string driver = driver_combo.get_active_text();
if (driver == "SoundGrid") {
soundgrid_configure ();
}
@ -721,13 +737,7 @@ EngineControl::enumerate_devices (const string& driver)
} else if (driver == "CoreAudio") {
devices[driver] = enumerate_coreaudio_devices ();
} else if (driver == "SoundGrid") {
soundgrid_init (inputs_adjustment.get_value(), outputs_adjustment.get_value(),
16, /* max tracks */
16, /* max busses */
8 /* max plugins per track */
);
devices[driver] = SoundGrid::lan_port_names();
devices[driver].clear ();
#else

View file

@ -43,6 +43,7 @@ class EngineControl : public Gtk::VBox {
static bool engine_running ();
int setup_engine ();
int prepare ();
bool was_used() const { return _used; }
XMLNode& get_state ();

View file

@ -44,6 +44,10 @@
#include <glibmm/thread.h>
#include <gtkmm/label.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/progressbar.h>
#include "gtkmm2ext/gtk_ui.h"
#include "pbd/compose.h"
@ -54,10 +58,14 @@
#include "gui_thread.h"
#include "soundgrid.h"
#include "i18n.h"
using namespace PBD;
using std::cerr;
static NSWindow* sg_window = 0;
static Gtk::MessageDialog* wait_dialog = 0;
static Gtk::ProgressBar* pbar = 0;
static PBD::ScopedConnection sg_connection;
static void
@ -76,14 +84,24 @@ soundgrid_shutdown ()
static bool
soundgrid_driver_init (uint32_t max_phys_inputs, uint32_t max_phys_outputs, uint32_t max_tracks)
{
wait_dialog->set_secondary_text (_("Nearly ready..."), true);
pbar->hide ();
Gtkmm2ext::UI::instance()->flush_pending ();
ARDOUR::SoundGrid::instance().configure_driver (max_phys_inputs, max_phys_outputs, max_tracks);
/* end the wait dialog */
wait_dialog->response (0);
return false; /* do not call again */
}
int
soundgrid_init (uint32_t max_phys_inputs, uint32_t max_phys_outputs,
uint32_t max_tracks, uint32_t max_busses,
uint32_t max_plugins)
static bool
soundgrid_initialize (uint32_t max_tracks, uint32_t max_busses,
uint32_t max_phys_inputs, uint32_t max_phys_outputs,
uint32_t max_plugins)
{
/* create a new window that we don't display (at least not as
of August 2012, but we can give it to the SoundGrid library
@ -99,27 +117,73 @@ soundgrid_init (uint32_t max_phys_inputs, uint32_t max_phys_outputs,
[sg_window retain];
ARDOUR::SoundGrid::Shutdown.connect (sg_connection, MISSING_INVALIDATOR, soundgrid_shutdown, gui_context());
if (ARDOUR::SoundGrid::instance().initialize ([sg_window contentView],
max_tracks, max_busses,
max_phys_inputs,
max_phys_inputs,
max_phys_outputs,
max_plugins)) {
[sg_window release];
sg_window = 0;
return -1;
} else {
/* as of early August 2012, we need to wait 5 seconds before configuring the CoreAudio driver */
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (soundgrid_driver_init),
max_phys_inputs, max_phys_outputs, max_tracks), 5000);
/* tell everyone/everything that we're using soundgrid */
ARDOUR::Profile->set_soundgrid ();
}
/* as of early August 2012, we need to wait 5 seconds before configuring the CoreAudio driver */
return false; /* do not call again */
}
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (soundgrid_driver_init),
max_phys_inputs, max_phys_outputs, max_tracks), 5000);
static bool
pulse_pbar ()
{
pbar->pulse();
return true;
}
/* tell everyone/everything that we're using soundgrid */
int
soundgrid_init (uint32_t max_phys_inputs, uint32_t max_phys_outputs,
uint32_t max_tracks, uint32_t max_busses,
uint32_t max_plugins)
{
Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (soundgrid_initialize),
max_tracks, max_busses,
max_phys_inputs,
max_phys_outputs,
max_plugins));
ARDOUR::Profile->set_soundgrid ();
wait_dialog = new Gtk::MessageDialog (_("<b>Please wait while SoundGrid is initialized (approx 6 seconds)</b>"),
true, /* use markup */
Gtk::MESSAGE_WARNING,
Gtk::BUTTONS_NONE,
true); /* modal */
wait_dialog->set_position (Gtk::WIN_POS_CENTER);
wait_dialog->set_title (_("SoundGrid Initializing ..."));
pbar = manage (new Gtk::ProgressBar);
sigc::connection pulse_connection;
pbar->set_size_request (100, -1);
wait_dialog->get_vbox()->pack_start (*pbar, false, false);
pbar->show ();
pulse_connection = Glib::signal_timeout().connect (sigc::ptr_fun (pulse_pbar), 250);
wait_dialog->run ();
pulse_connection.disconnect ();
delete wait_dialog;
return 0;
}

View file

@ -655,7 +655,18 @@ ArdourStartup::on_apply ()
void
ArdourStartup::on_prepare (Gtk::Widget* page)
{
if (page == &session_vbox) {
if (page == &ic_vbox) {
/* need to check with engine dialog and see if something needs to be done
before we move on (SoundGrid)
*/
if (engine_dialog) {
if (engine_dialog->prepare ()) {
/* failure - do not proceed to new page */
}
}
} else if (page == &session_vbox) {
if (ic_new_session_button.get_active()) {
/* new session requested */
@ -684,7 +695,7 @@ ArdourStartup::on_prepare (Gtk::Widget* page)
}
}
}
}
}
}
void