Allow to configure sample-rate of new sessions
When creating a session from the Editor (after Session > Close, or directly via Session > New) the engine-dialog needs to be displayed to allow configuring the sample-rate. This also consolidates scripted session setup: meta_session_setup() is now called from build_session(), instead of all callers.
This commit is contained in:
parent
c2da64f7ad
commit
242774eada
@ -211,10 +211,8 @@ public:
|
||||
void finish();
|
||||
|
||||
int load_session (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
||||
int load_session_stage_two (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
||||
void audio_midi_setup_reconfigure_done (int response, std::string path, std::string snapshot, std::string mix_template);
|
||||
bool session_load_in_progress;
|
||||
int build_session (const std::string& path, const std::string& snapshot, ARDOUR::BusProfile const *);
|
||||
int build_session (std::string const& path, std::string const& snapshot, std::string const& session_template, ARDOUR::BusProfile const&, bool from_startup_fsm = false);
|
||||
bool session_is_new() const { return _session_is_new; }
|
||||
|
||||
ARDOUR::Session* the_session() { return _session; }
|
||||
@ -226,7 +224,7 @@ public:
|
||||
|
||||
void start_session_load (bool create_new);
|
||||
void session_dialog_response_handler (int response, SessionDialog* session_dialog);
|
||||
int build_session_from_dialog (SessionDialog&, const std::string& session_name, const std::string& session_path);
|
||||
void build_session_from_dialog (SessionDialog&, std::string const& session_name, std::string const& session_path, std::string const& session_template);
|
||||
bool ask_about_loading_existing_session (const std::string& session_path);
|
||||
int load_session_from_startup_fsm ();
|
||||
|
||||
@ -454,6 +452,12 @@ private:
|
||||
|
||||
int ask_about_saving_session (const std::vector<std::string>& actions);
|
||||
|
||||
void audio_midi_setup_reconfigure_done (int response, std::string path, std::string snapshot, std::string mix_template);
|
||||
int load_session_stage_two (const std::string& path, const std::string& snapshot, std::string mix_template = std::string());
|
||||
void audio_midi_setup_for_new_session_done (int response, std::string path, std::string snapshot, std::string session_template, ARDOUR::BusProfile const&);
|
||||
int build_session_stage_two (std::string const& path, std::string const& snapshot, std::string const& session_template, ARDOUR::BusProfile const&);
|
||||
sigc::connection _engine_dialog_connection;
|
||||
|
||||
void save_session_at_its_request (std::string);
|
||||
/* periodic safety backup, to be precise */
|
||||
gint autosave_session();
|
||||
|
@ -105,8 +105,8 @@ ARDOUR_UI::ask_about_loading_existing_session (const std::string& session_path)
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::build_session_from_dialog (SessionDialog& sd, const std::string& session_path, const std::string& session_name)
|
||||
void
|
||||
ARDOUR_UI::build_session_from_dialog (SessionDialog& sd, const std::string& session_path, const std::string& session_name, std::string const& session_template)
|
||||
{
|
||||
BusProfile bus_profile;
|
||||
|
||||
@ -119,12 +119,7 @@ ARDOUR_UI::build_session_from_dialog (SessionDialog& sd, const std::string& sess
|
||||
bus_profile.master_out_channels = (uint32_t) sd.master_channel_count();
|
||||
}
|
||||
|
||||
// NULL profile: no master, no monitor
|
||||
if (build_session (session_path, session_name, bus_profile.master_out_channels > 0 ? &bus_profile : NULL)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
build_session (session_path, session_name, session_template, bus_profile);
|
||||
}
|
||||
|
||||
/** This is only ever used once Ardour is already running with a session
|
||||
@ -286,14 +281,9 @@ ARDOUR_UI::session_dialog_response_handler (int response, SessionDialog* session
|
||||
session_dialog->hide ();
|
||||
delete_when_idle (session_dialog);
|
||||
|
||||
if (!template_name.empty() && template_name.substr (0, 11) == "urn:ardour:") {
|
||||
if (!template_name.empty() || likely_new) {
|
||||
|
||||
build_session_from_dialog (*session_dialog, session_path, session_name);
|
||||
meta_session_setup (template_name.substr (11));
|
||||
|
||||
} else if (likely_new) {
|
||||
|
||||
build_session_from_dialog (*session_dialog, session_path, session_name);
|
||||
build_session_from_dialog (*session_dialog, session_path, session_name, template_name);
|
||||
|
||||
} else {
|
||||
|
||||
@ -362,7 +352,8 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
|
||||
if (!AudioEngine::instance()->running()) {
|
||||
audio_midi_setup->set_position (WIN_POS_CENTER);
|
||||
audio_midi_setup->present ();
|
||||
audio_midi_setup->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::audio_midi_setup_reconfigure_done), path, snap_name, mix_template));
|
||||
_engine_dialog_connection.disconnect ();
|
||||
_engine_dialog_connection = audio_midi_setup->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::audio_midi_setup_reconfigure_done), path, snap_name, mix_template));
|
||||
/* not done yet, but we're avoiding modal dialogs */
|
||||
return 0;
|
||||
}
|
||||
@ -532,9 +523,8 @@ ARDOUR_UI::load_session_stage_two (const std::string& path, const std::string& s
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name, BusProfile const * bus_profile)
|
||||
ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name, const std::string& session_template, BusProfile const& bus_profile, bool from_startup_fsm)
|
||||
{
|
||||
Session *new_session;
|
||||
int x;
|
||||
|
||||
x = unload_session ();
|
||||
@ -547,10 +537,54 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
|
||||
|
||||
_session_is_new = true;
|
||||
|
||||
try {
|
||||
new_session = new Session (*AudioEngine::instance(), path, snap_name, bus_profile);
|
||||
/* when running from startup FSM all is fine,
|
||||
* engine should be running and the FSM will also have
|
||||
* asked for the SR (even if try-autostart-engine is set)
|
||||
*/
|
||||
if (from_startup_fsm && AudioEngine::instance()->running ()) {
|
||||
return build_session_stage_two (path, snap_name, session_template, bus_profile);
|
||||
}
|
||||
|
||||
/* Ask for the Sample-rate to use with the new session */
|
||||
audio_midi_setup->set_position (WIN_POS_CENTER);
|
||||
audio_midi_setup->set_modal ();
|
||||
audio_midi_setup->present ();
|
||||
_engine_dialog_connection.disconnect ();
|
||||
_engine_dialog_connection = audio_midi_setup->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::audio_midi_setup_for_new_session_done), path, snap_name, session_template, bus_profile));
|
||||
|
||||
/* not done yet, but we're avoiding modal dialogs */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ARDOUR_UI::audio_midi_setup_for_new_session_done (int response, std::string path, std::string snap_name, std::string template_name, BusProfile const& bus_profile)
|
||||
{
|
||||
switch (response) {
|
||||
case Gtk::RESPONSE_DELETE_EVENT:
|
||||
audio_midi_setup->set_modal (false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!AudioEngine::instance()->running()) {
|
||||
return; // keep dialog visible, maybe try again
|
||||
}
|
||||
audio_midi_setup->set_modal (false);
|
||||
audio_midi_setup->hide();
|
||||
|
||||
build_session_stage_two (path, snap_name, template_name, bus_profile);
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR_UI::build_session_stage_two (std::string const& path, std::string const& snap_name, std::string const& session_template, BusProfile const& bus_profile)
|
||||
{
|
||||
Session* new_session;
|
||||
|
||||
try {
|
||||
new_session = new Session (*AudioEngine::instance(), path, snap_name, bus_profile.master_out_channels > 0 ? &bus_profile : NULL);
|
||||
}
|
||||
catch (SessionException const& e) {
|
||||
cerr << "Here are the errors associated with this failed session:\n";
|
||||
dump_errors (cerr);
|
||||
@ -601,6 +635,10 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
|
||||
|
||||
new_session->save_state(new_session->name());
|
||||
|
||||
if (!session_template.empty() && session_template.substr (0, 11) == "urn:ardour:") {
|
||||
meta_session_setup (session_template.substr (11));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -534,14 +534,9 @@ ARDOUR_UI::load_session_from_startup_fsm ()
|
||||
|
||||
if (session_is_new) {
|
||||
|
||||
if (build_session (session_path, session_name, &bus_profile)) {
|
||||
if (build_session (session_path, session_name, session_template, bus_profile, true)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!session_template.empty() && session_template.substr (0, 11) == "urn:ardour:") {
|
||||
meta_session_setup (session_template.substr (11));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user