From 6d8e99fc67bd0e3dd255a115c0ff1887a4329540 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2020 22:32:57 +0100 Subject: Remove Jack session support --- NEWS | 3 +- src/JackDriver.hpp | 2 - src/Patchage.cpp | 133 ----------------------------------------------------- src/Patchage.hpp | 12 ----- src/patchage.ui | 29 ------------ wscript | 13 ++---- 6 files changed, 6 insertions(+), 186 deletions(-) diff --git a/NEWS b/NEWS index ae84932..b663d5f 100644 --- a/NEWS +++ b/NEWS @@ -2,8 +2,9 @@ patchage (1.0.3) unstable; * Fix making and breaking connections with Jack DBus * Fix sample rate with Jack DBus + * Remove Jack session support - -- David Robillard Sat, 28 Nov 2020 16:01:42 +0000 + -- David Robillard Sat, 28 Nov 2020 21:29:22 +0000 patchage (1.0.2) stable; diff --git a/src/JackDriver.hpp b/src/JackDriver.hpp index 85fcc0f..5a6f89f 100644 --- a/src/JackDriver.hpp +++ b/src/JackDriver.hpp @@ -58,8 +58,6 @@ public: float get_max_dsp_load(); void reset_max_dsp_load(); - jack_client_t* client() { return _client; } - jack_nframes_t sample_rate() { return jack_get_sample_rate(_client); } jack_nframes_t buffer_size(); bool set_buffer_size(jack_nframes_t size); diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 5147c44..f342c34 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -34,10 +34,6 @@ # include #endif -#ifdef PATCHAGE_JACK_SESSION -# include -#endif - #ifdef HAVE_ALSA # include "AlsaDriver.hpp" #endif @@ -146,9 +142,6 @@ Patchage::Patchage(int argc, char** argv) , INIT_WIDGET(_menu_help_about) , INIT_WIDGET(_menu_jack_connect) , INIT_WIDGET(_menu_jack_disconnect) - , INIT_WIDGET(_menu_open_session) - , INIT_WIDGET(_menu_save_session) - , INIT_WIDGET(_menu_save_close_session) , INIT_WIDGET(_menu_view_arrange) , INIT_WIDGET(_menu_view_sprung_layout) , INIT_WIDGET(_menu_view_messages) @@ -245,19 +238,6 @@ Patchage::Patchage(int argc, char** argv) _status_text->signal_size_allocate().connect( sigc::mem_fun(this, &Patchage::on_messages_resized)); -#ifdef PATCHAGE_JACK_SESSION - _menu_open_session->signal_activate().connect( - sigc::mem_fun(this, &Patchage::show_open_session_dialog)); - _menu_save_session->signal_activate().connect( - sigc::mem_fun(this, &Patchage::show_save_session_dialog)); - _menu_save_close_session->signal_activate().connect( - sigc::mem_fun(this, &Patchage::show_save_close_session_dialog)); -#else - _menu_open_session->hide(); - _menu_save_session->hide(); - _menu_save_close_session->hide(); -#endif - #ifdef HAVE_ALSA _menu_alsa_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_alsa_connect)); @@ -669,119 +649,6 @@ Patchage::connect_widgets() #endif } -#ifdef PATCHAGE_JACK_SESSION -void -Patchage::show_open_session_dialog() -{ - Gtk::FileChooserDialog dialog( - *_main_win, "Open Session", Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); - - dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - Gtk::Button* open_but = - dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); - open_but->property_has_default() = true; - - if (dialog.run() != Gtk::RESPONSE_OK) { - return; - } - - const std::string dir = dialog.get_filename(); - if (g_chdir(dir.c_str())) { - _log.error( - fmt::format("Failed to switch to session directory \"{}\"", dir)); - return; - } - - if (system("./jack-session") < 0) { - _log.error( - fmt::format("Error executing \"./jack-session\" in {}", dir)); - } else { - _log.info(fmt::format("Loaded session {}", dir)); - } -} - -static void -print_edge(GanvEdge* edge, void* data) -{ - std::ofstream* script = (std::ofstream*)data; - Ganv::Edge* edgemm = Glib::wrap(edge); - - PatchagePort* src = dynamic_cast((edgemm)->get_tail()); - PatchagePort* dst = dynamic_cast((edgemm)->get_head()); - - if (!src || !dst || src->type() == ALSA_MIDI || dst->type() == ALSA_MIDI) { - return; - } - - (*script) << "jack_connect '" << src->full_name() << "' '" - << dst->full_name() << "' &\n"; -} - -void -Patchage::save_session(bool close) -{ - Gtk::FileChooserDialog dialog( - *_main_win, "Save Session", Gtk::FILE_CHOOSER_ACTION_SAVE); - - dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - Gtk::Button* save_but = - dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); - save_but->property_has_default() = true; - - if (dialog.run() != Gtk::RESPONSE_OK) { - return; - } - - std::string path = dialog.get_filename(); - if (g_mkdir_with_parents(path.c_str(), 0740)) { - _log.error(fmt::format("Failed to create session directory {}", path)); - return; - } - - path += '/'; - jack_session_command_t* cmd = - jack_session_notify(_jack_driver->client(), - nullptr, - close ? JackSessionSaveAndQuit : JackSessionSave, - path.c_str()); - - const std::string script_path = path + "jack-session"; - std::ofstream script(script_path.c_str()); - script << "#!/bin/sh\n\n"; - - const std::string var("${SESSION_DIR}"); - for (int c = 0; cmd[c].uuid; ++c) { - std::string command = cmd[c].command; - const size_t index = command.find(var); - if (index != std::string::npos) { - command.replace(index, var.length(), cmd[c].client_name); - } - - script << command << " &\n"; - } - - script << "\nsleep 3\n\n"; - - _canvas->for_each_edge(print_edge, &script); - - script.close(); - g_chmod(script_path.c_str(), 0740); -} - -void -Patchage::show_save_session_dialog() -{ - save_session(false); -} - -void -Patchage::show_save_close_session_dialog() -{ - save_session(true); -} - -#endif - #ifdef HAVE_ALSA void Patchage::menu_alsa_connect() diff --git a/src/Patchage.hpp b/src/Patchage.hpp index b358f34..eadcb58 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -85,11 +85,6 @@ public: #ifdef HAVE_ALSA AlsaDriver* alsa_driver() const { return _alsa_driver; } #endif -#ifdef PATCHAGE_JACK_SESSION - void show_open_session_dialog(); - void show_save_session_dialog(); - void show_save_close_session_dialog(); -#endif Glib::RefPtr xml() { return _xml; } @@ -169,10 +164,6 @@ protected: void menu_alsa_disconnect(); #endif -#ifdef PATCHAGE_JACK_SESSION - void save_session(bool close); -#endif - std::shared_ptr _canvas; JackDriver* _jack_driver; @@ -194,9 +185,6 @@ protected: Widget _menu_help_about; Widget _menu_jack_connect; Widget _menu_jack_disconnect; - Widget _menu_open_session; - Widget _menu_save_session; - Widget _menu_save_close_session; Widget _menu_view_arrange; Widget _menu_view_sprung_layout; Widget _menu_view_messages; diff --git a/src/patchage.ui b/src/patchage.ui index b03999e..cf48a6c 100644 --- a/src/patchage.ui +++ b/src/patchage.ui @@ -23,35 +23,6 @@ False - - - gtk-open - True - False - True - True - - - - - - - gtk-save - True - False - True - True - - - - - - True - False - Save and _Close - True - - True diff --git a/wscript b/wscript index 3aa7c2f..e2b6eb0 100644 --- a/wscript +++ b/wscript @@ -38,11 +38,10 @@ def options(ctx): ctx.add_flags( opt, - {'jack-dbus': 'use Jack via D-Bus', - 'jack-session-manage': 'include JACK session management support', - 'no-alsa': 'do not build Alsa Sequencer support', - 'no-binloc': 'do not find files from executable location', - 'light-theme': 'use light coloured theme'}) + {'jack-dbus': 'use Jack via D-Bus', + 'no-alsa': 'do not build Alsa Sequencer support', + 'no-binloc': 'do not find files from executable location', + 'light-theme': 'use light coloured theme'}) def configure(conf): @@ -170,9 +169,6 @@ def configure(conf): char**''', mandatory = False) - if Options.options.jack_session_manage: - conf.define('PATCHAGE_JACK_SESSION', 1) - # Use Alsa if present unless --no-alsa if not Options.options.no_alsa: conf.check_pkg('alsa', @@ -220,7 +216,6 @@ def configure(conf): 'App human name': conf.env.APP_HUMAN_NAME, 'Jack (D-Bus)': conf.is_defined('HAVE_JACK_DBUS'), 'Jack (libjack)': conf.is_defined('PATCHAGE_LIBJACK'), - 'Jack Session Management': conf.is_defined('PATCHAGE_JACK_SESSION'), 'Jack Metadata': conf.is_defined('HAVE_JACK_METADATA'), 'Alsa Sequencer': bool(conf.env.HAVE_ALSA)}) -- cgit v1.2.1