diff --git a/Makefile b/Makefile index 79a1b3e4b..c9363ba3d 100644 --- a/Makefile +++ b/Makefile @@ -291,6 +291,7 @@ RES = \ bin/resources/resources_rc.py \ bin/resources/ui_carla_about.py \ bin/resources/ui_carla_about_juce.py \ + bin/resources/ui_carla_add_jack.py \ bin/resources/ui_carla_database.py \ bin/resources/ui_carla_edit.py \ bin/resources/ui_carla_host.py \ @@ -335,6 +336,7 @@ ifeq ($(HAVE_PYQT),true) UIs = \ source/ui_carla_about.py \ source/ui_carla_about_juce.py \ + source/ui_carla_add_jack.py \ source/ui_carla_database.py \ source/ui_carla_edit.py \ source/ui_carla_host.py \ @@ -657,6 +659,7 @@ endif $(LINK) $(DATADIR)/carla/resources_rc.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) $(DATADIR)/carla/ui_carla_about.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) $(DATADIR)/carla/ui_carla_about_juce.py $(DESTDIR)$(DATADIR)/carla/resources + $(LINK) $(DATADIR)/carla/ui_carla_add_jack.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) $(DATADIR)/carla/ui_carla_database.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) $(DATADIR)/carla/ui_carla_edit.py $(DESTDIR)$(DATADIR)/carla/resources $(LINK) $(DATADIR)/carla/ui_carla_host.py $(DESTDIR)$(DATADIR)/carla/resources diff --git a/resources/ui/carla_add_jack.ui b/resources/ui/carla_add_jack.ui new file mode 100644 index 000000000..268e513f9 --- /dev/null +++ b/resources/ui/carla_add_jack.ui @@ -0,0 +1,187 @@ + + + Dialog + + + + 0 + 0 + 653 + 125 + + + + Add JACK Application + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 22 + 22 + + + + + + + :/16x16/dialog-warning.png + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Very experimental feature! Do not use! + + + + + + + + 22 + 22 + + + + + + + :/16x16/dialog-warning.png + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 100 + 0 + + + + Command: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + 100 + 0 + + + + Flags: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/resources/ui/carla_host.ui b/resources/ui/carla_host.ui index 88a030ff2..01cb8a9a9 100644 --- a/resources/ui/carla_host.ui +++ b/resources/ui/carla_host.ui @@ -285,23 +285,12 @@ - - - Secrets - - - - - - - - @@ -330,6 +319,7 @@ + @@ -1137,6 +1127,15 @@ Perform secret 5 + + + + :/16x16/list-add.png:/16x16/list-add.png + + + Add &Jack Aplication + + diff --git a/resources/ui/carla_settings.ui b/resources/ui/carla_settings.ui index 7ab05427e..7e949739e 100644 --- a/resources/ui/carla_settings.ui +++ b/resources/ui/carla_settings.ui @@ -1494,6 +1494,13 @@ + + + + Enable jack applications + + + diff --git a/source/carla_database.py b/source/carla_database.py index a8dea777e..f443687c7 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -37,6 +37,7 @@ else: # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom) +import ui_carla_add_jack import ui_carla_database import ui_carla_refresh @@ -1879,6 +1880,30 @@ class PluginDatabaseW(QDialog): QDialog.done(self, r) self.close() +# ---------------------------------------------------------------------------------------------------------------------- +# Jack Application Dialog + +class JackApplicationW(QDialog): + def __init__(self, parent, host): + QDialog.__init__(self, parent) + self.host = host + self.ui = ui_carla_add_jack.Ui_Dialog() + self.ui.setupUi(self) + + if False: + # kdevelop likes this :) + host = CarlaHostNull() + self.host = host + + def getCommandAndFlags(self): + return (self.ui.le_command.text(), self.ui.le_flags.text()) + + # -------------------------------------------------------------------------------------------------------- + + def done(self, r): + QDialog.done(self, r) + self.close() + # ------------------------------------------------------------------------------------------------------------ # Main diff --git a/source/carla_host.py b/source/carla_host.py index 410d960ec..e008b8288 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -364,13 +364,6 @@ class HostWindow(QMainWindow): self.ui.menu_Settings.setTitle("Panels") self.ui.menu_Help.menuAction().setVisible(False) - # ---------------------------------------------------------------------------------------------------- - # Set up GUI (secrets when running local) - - if CWD not in ("/Shared/Personal/FOSS/GIT/falkTX/Carla/source", - "/home/falktx/Personal/GIT-mine/falkTX/Carla/source"): - self.ui.menu_Secrets.menuAction().setVisible(False) - # ---------------------------------------------------------------------------------------------------- # Load Settings @@ -405,6 +398,8 @@ class HostWindow(QMainWindow): self.ui.act_plugin_add2.triggered.connect(self.slot_pluginAdd) self.ui.act_plugin_remove_all.triggered.connect(self.slot_pluginRemoveAll) + self.ui.act_add_jack.triggered.connect(self.slot_jackAppAdd) + self.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable) self.ui.act_plugins_disable.triggered.connect(self.slot_pluginsDisable) self.ui.act_plugins_volume100.triggered.connect(self.slot_pluginsVolume100) @@ -437,12 +432,6 @@ class HostWindow(QMainWindow): self.ui.act_help_about_juce.triggered.connect(self.slot_aboutJuce) self.ui.act_help_about_qt.triggered.connect(self.slot_aboutQt) - self.ui.act_secret_1.triggered.connect(self.slot_runSecret1) - self.ui.act_secret_2.triggered.connect(self.slot_runSecret2) - self.ui.act_secret_3.triggered.connect(self.slot_runSecret3) - self.ui.act_secret_4.triggered.connect(self.slot_runSecret4) - self.ui.act_secret_5.triggered.connect(self.slot_runSecret5) - self.ui.cb_disk.currentIndexChanged.connect(self.slot_diskFolderChanged) self.ui.b_disk_add.clicked.connect(self.slot_diskFolderAdd) self.ui.b_disk_remove.clicked.connect(self.slot_diskFolderRemove) @@ -858,6 +847,18 @@ class HostWindow(QMainWindow): return (btype, ptype, filename, label, uniqueId, extraPtr) + def showAddJackAppDialog(self): + dialog = JackApplicationW(self.fParentOrSelf, self.host) + + if not dialog.exec_(): + return + + if not self.host.is_engine_running(): + QMessageBox.warning(self, self.tr("Warning"), self.tr("Cannot add new plugins while engine is stopped")) + return + + return dialog.getCommandAndFlags() + @pyqtSlot() def showPluginActionsMenu(self): menu = QMenu(self) @@ -954,6 +955,19 @@ class HostWindow(QMainWindow): self.fCurrentlyRemovingAllPlugins = False + @pyqtSlot() + def slot_jackAppAdd(self): + data = self.showAddJackAppDialog() + + if data is None: + return + + filename, label = data + + if not self.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, filename, None, label, 0, None, 0x0): + CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), + self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + # -------------------------------------------------------------------------------------------------------- # Plugins (macros) @@ -1452,11 +1466,14 @@ class HostWindow(QMainWindow): CARLA_KEY_CANVAS_FANCY_EYE_CANDY: settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, type=bool), CARLA_KEY_CANVAS_USE_OPENGL: settings.value(CARLA_KEY_CANVAS_USE_OPENGL, CARLA_DEFAULT_CANVAS_USE_OPENGL, type=bool), CARLA_KEY_CANVAS_ANTIALIASING: settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, type=int), - CARLA_KEY_CANVAS_HQ_ANTIALIASING : settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING, CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, type=bool), + CARLA_KEY_CANVAS_HQ_ANTIALIASING: settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING, CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, type=bool), CARLA_KEY_CUSTOM_PAINTING: (settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, True, type=bool) and - settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, "Black", type=str).lower() == "black") + settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, "Black", type=str).lower() == "black"), } + self.ui.act_add_jack.setVisible(settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS, + CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, type=bool)) + self.fMiniCanvasUpdateTimeout = 1000 if self.fSavedSettings[CARLA_KEY_CANVAS_FANCY_EYE_CANDY] else 0 setEngineSettings(self.host) @@ -1534,43 +1551,6 @@ class HostWindow(QMainWindow): def slot_aboutQt(self): QApplication.instance().aboutQt() - # -------------------------------------------------------------------------------------------------------- - # Secret (menu actions) - - @pyqtSlot() - def slot_runSecret1(self): - print("secret 1") - fname = "/usr/bin/audacious -p" - self.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, fname, "", "", 0, None, 0) - - @pyqtSlot() - def slot_runSecret2(self): - print("secret 2") - fname = "/usr/bin/pulseaudio" - fname += " --high-priority --realtime --exit-idle-time=-1 --file=/usr/share/cadence/pulse2jack/play+rec.pa -n" - self.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, fname, "", "", 0, None, 0) - - @pyqtSlot() - def slot_runSecret3(self): - print("secret 3") - fname = "/usr/bin/lmms" - self.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, fname, "", "", 0, None, 0) - - @pyqtSlot() - def slot_runSecret4(self): - print("secret 4") - ret = QInputDialog.getText(self, "Command", "command to run") - if ret[1] and len(ret[0]) > 1: - fname = ret[0] - if not self.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, fname, "", "", 0, None, 0): - CustomMessageBox(self, QMessageBox.Critical, - self.tr("Error"), self.tr("Failed to load plugin"), - self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) - - @pyqtSlot() - def slot_runSecret5(self): - print("secret 5") - # -------------------------------------------------------------------------------------------------------- # Disk (menu actions) diff --git a/source/carla_settings.py b/source/carla_settings.py index 6722f7874..0421fbbf6 100755 --- a/source/carla_settings.py +++ b/source/carla_settings.py @@ -475,6 +475,11 @@ class CarlaSettingsW(QDialog): CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES, type=bool)) + self.ui.ch_exp_jack_apps.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS, + CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, + type=bool)) + + self.ui.ch_exp_load_lib_global.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL, type=bool)) @@ -629,6 +634,7 @@ class CarlaSettingsW(QDialog): # Experimental settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.ui.cb_exp_plugin_bridges.isChecked()) + settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked()) settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked()) settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, self.ui.ch_exp_prevent_bad_behaviour.isChecked()) @@ -767,6 +773,7 @@ class CarlaSettingsW(QDialog): def resetExperimentalSettings(self): # Forever experimental self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES) + self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS) self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL) self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR) diff --git a/source/carla_shared.py b/source/carla_shared.py index c46baa4d2..0c3547145 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -228,6 +228,7 @@ CARLA_KEY_PATHS_SF2 = "Paths/SF2" CARLA_KEY_PATHS_SFZ = "Paths/SFZ" CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES = "Experimental/PluginBridges" # bool +CARLA_KEY_EXPERIMENTAL_JACK_APPS = "Experimental/JackApplications" # bool CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR = "Experimental/PreventBadBehaviour" # bool CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL = "Experimental/LoadLibGlobal" # bool @@ -288,6 +289,7 @@ else: CARLA_DEFAULT_TRANSPORT_MODE = ENGINE_TRANSPORT_MODE_INTERNAL CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES = False +CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS = False CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR = False CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL = False