Add NSM ':switch:' capability
This allows to switch from one Ardour session to another without application restart. This also include some minor related NSM fixes.
This commit is contained in:
parent
6eb1559f79
commit
692aa7bbb8
@ -369,6 +369,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||||||
, prefs_visibility_button (S_("Window|Prefs"))
|
, prefs_visibility_button (S_("Window|Prefs"))
|
||||||
, recorder_visibility_button (S_("Window|Rec"))
|
, recorder_visibility_button (S_("Window|Rec"))
|
||||||
, trigger_page_visibility_button (S_("Window|Trig"))
|
, trigger_page_visibility_button (S_("Window|Trig"))
|
||||||
|
, nsm_first_session_opened (false)
|
||||||
{
|
{
|
||||||
Gtkmm2ext::init (localedir);
|
Gtkmm2ext::init (localedir);
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ public:
|
|||||||
int load_session_from_startup_fsm ();
|
int load_session_from_startup_fsm ();
|
||||||
|
|
||||||
/// @return true if session was successfully unloaded.
|
/// @return true if session was successfully unloaded.
|
||||||
int unload_session (bool hide_stuff = false);
|
int unload_session (bool hide_stuff = false, bool force_unload = false);
|
||||||
void close_session();
|
void close_session();
|
||||||
|
|
||||||
int save_state_canfail (std::string state_name = "", bool switch_to_it = false);
|
int save_state_canfail (std::string state_name = "", bool switch_to_it = false);
|
||||||
@ -927,6 +927,7 @@ private:
|
|||||||
void action_script_changed (int i, const std::string&);
|
void action_script_changed (int i, const std::string&);
|
||||||
|
|
||||||
void ask_about_scratch_deletion ();
|
void ask_about_scratch_deletion ();
|
||||||
|
bool nsm_first_session_opened;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_gui_h__ */
|
#endif /* __ardour_gui_h__ */
|
||||||
|
@ -287,7 +287,7 @@ ARDOUR_UI::set_session (Session *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ARDOUR_UI::unload_session (bool hide_stuff)
|
ARDOUR_UI::unload_session (bool hide_stuff, bool force_unload)
|
||||||
{
|
{
|
||||||
if (_session) {
|
if (_session) {
|
||||||
ARDOUR_UI::instance()->video_timeline->sync_session_state();
|
ARDOUR_UI::instance()->video_timeline->sync_session_state();
|
||||||
@ -303,7 +303,7 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
|||||||
save_ardour_state ();
|
save_ardour_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_session && _session->dirty()) {
|
if (!force_unload && _session && _session->dirty()) {
|
||||||
std::vector<std::string> actions;
|
std::vector<std::string> actions;
|
||||||
actions.push_back (_("Don't close"));
|
actions.push_back (_("Don't close"));
|
||||||
if (_session->unnamed()) {
|
if (_session->unnamed()) {
|
||||||
|
@ -428,7 +428,7 @@ ARDOUR_UI::nsm_init ()
|
|||||||
* The wrapper startup script should set the environment variable 'ARDOUR_SELF'
|
* The wrapper startup script should set the environment variable 'ARDOUR_SELF'
|
||||||
*/
|
*/
|
||||||
const char *process_name = g_getenv ("ARDOUR_SELF");
|
const char *process_name = g_getenv ("ARDOUR_SELF");
|
||||||
nsm->announce (PROGRAM_NAME, ":dirty:", process_name ? process_name : "ardour6");
|
nsm->announce (PROGRAM_NAME, ":dirty:switch:", process_name ? process_name : "ardour7");
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
// wait for announce reply from nsm server
|
// wait for announce reply from nsm server
|
||||||
@ -751,7 +751,9 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nsm) {
|
if (nsm) {
|
||||||
if (!AudioEngine::instance()->set_backend("JACK", "", "")) {
|
unload_session(false, true);
|
||||||
|
|
||||||
|
if (!AudioEngine::instance()->set_backend("JACK", ARDOUR_COMMAND_LINE::backend_client_name, "")) {
|
||||||
error << _("NSM: The JACK backend is mandatory and can not be loaded.") << endmsg;
|
error << _("NSM: The JACK backend is mandatory and can not be loaded.") << endmsg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -775,10 +777,13 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginScanDialog psd (true, false);
|
if (!nsm_first_session_opened) {
|
||||||
psd.start ();
|
PluginScanDialog psd (true, false);
|
||||||
|
psd.start ();
|
||||||
|
|
||||||
post_engine ();
|
post_engine ();
|
||||||
|
nsm_first_session_opened = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the mechanisms that can result is this being called are only
|
/* the mechanisms that can result is this being called are only
|
||||||
|
@ -50,6 +50,7 @@ NSM_Client::command_open(const char* name,
|
|||||||
int r = ERR_OK;
|
int r = ERR_OK;
|
||||||
|
|
||||||
ARDOUR_COMMAND_LINE::backend_client_name = client_id;
|
ARDOUR_COMMAND_LINE::backend_client_name = client_id;
|
||||||
|
ARDOUR_COMMAND_LINE::session_name = "";
|
||||||
|
|
||||||
/* this appears asynchronous, but almost certainly is
|
/* this appears asynchronous, but almost certainly is
|
||||||
* synchronous. However, there's no return value available.
|
* synchronous. However, there's no return value available.
|
||||||
|
Loading…
Reference in New Issue
Block a user