diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/JackDriver.hpp | 2 | ||||
-rw-r--r-- | src/Patchage.cpp | 133 | ||||
-rw-r--r-- | src/Patchage.hpp | 12 | ||||
-rw-r--r-- | src/patchage.ui | 29 | ||||
-rw-r--r-- | wscript | 13 |
6 files changed, 6 insertions, 186 deletions
@@ -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 <d@drobilla.net> Sat, 28 Nov 2020 16:01:42 +0000 + -- David Robillard <d@drobilla.net> 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 <jack/statistics.h> #endif -#ifdef PATCHAGE_JACK_SESSION -# include <jack/session.h> -#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<PatchagePort*>((edgemm)->get_tail()); - PatchagePort* dst = dynamic_cast<PatchagePort*>((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<Gtk::Builder> 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<PatchageCanvas> _canvas; JackDriver* _jack_driver; @@ -194,9 +185,6 @@ protected: Widget<Gtk::MenuItem> _menu_help_about; Widget<Gtk::MenuItem> _menu_jack_connect; Widget<Gtk::MenuItem> _menu_jack_disconnect; - Widget<Gtk::MenuItem> _menu_open_session; - Widget<Gtk::MenuItem> _menu_save_session; - Widget<Gtk::MenuItem> _menu_save_close_session; Widget<Gtk::MenuItem> _menu_view_arrange; Widget<Gtk::CheckMenuItem> _menu_view_sprung_layout; Widget<Gtk::CheckMenuItem> _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 @@ -24,35 +24,6 @@ <object class="GtkMenu" id="file_menu_menu"> <property name="can_focus">False</property> <child> - <object class="GtkImageMenuItem" id="menu_open_session"> - <property name="label">gtk-open</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - <accelerator key="O" signal="activate" modifiers="GDK_CONTROL_MASK"/> - <signal name="activate" handler="on_open_session_menuitem_activate" swapped="no"/> - </object> - </child> - <child> - <object class="GtkImageMenuItem" id="menu_save_session"> - <property name="label">gtk-save</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> - <property name="use_stock">True</property> - <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menu_save_close_session"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Save and _Close</property> - <property name="use_underline">True</property> - </object> - </child> - <child> <object class="GtkMenuItem" id="menu_export_image"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -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)}) |