Browse Source

Expose dialog to start jack apps within carla, super experimental

tags/1.9.8
falkTX 7 years ago
parent
commit
4c29497581
8 changed files with 273 additions and 63 deletions
  1. +3
    -0
      Makefile
  2. +187
    -0
      resources/ui/carla_add_jack.ui
  3. +10
    -11
      resources/ui/carla_host.ui
  4. +7
    -0
      resources/ui/carla_settings.ui
  5. +25
    -0
      source/carla_database.py
  6. +32
    -52
      source/carla_host.py
  7. +7
    -0
      source/carla_settings.py
  8. +2
    -0
      source/carla_shared.py

+ 3
- 0
Makefile View File

@@ -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


+ 187
- 0
resources/ui/carla_add_jack.ui View File

@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>653</width>
<height>125</height>
</rect>
</property>
<property name="windowTitle">
<string>Add JACK Application</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_16">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources.qrc">:/16x16/dialog-warning.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>Very experimental feature! Do not use!</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources.qrc">:/16x16/dialog-warning.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Command:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_command"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Flags:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_flags"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

+ 10
- 11
resources/ui/carla_host.ui View File

@@ -285,23 +285,12 @@
<addaction name="act_help_about_juce"/>
<addaction name="act_help_about_qt"/>
</widget>
<widget class="QMenu" name="menu_Secrets">
<property name="title">
<string>Secrets</string>
</property>
<addaction name="act_secret_1"/>
<addaction name="act_secret_2"/>
<addaction name="act_secret_3"/>
<addaction name="act_secret_4"/>
<addaction name="act_secret_5"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Engine"/>
<addaction name="menu_Plugin"/>
<addaction name="menu_Canvas"/>
<addaction name="menu_Settings"/>
<addaction name="menu_Help"/>
<addaction name="menu_Secrets"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
@@ -330,6 +319,7 @@
<addaction name="act_file_refresh"/>
<addaction name="separator"/>
<addaction name="act_plugin_add2"/>
<addaction name="act_add_jack"/>
<addaction name="act_plugin_remove_all"/>
<addaction name="act_plugins_panic"/>
<addaction name="separator"/>
@@ -1137,6 +1127,15 @@
<string>Perform secret 5</string>
</property>
</action>
<action name="act_add_jack">
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/list-add.png</normaloff>:/16x16/list-add.png</iconset>
</property>
<property name="text">
<string>Add &amp;Jack Aplication</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>


+ 7
- 0
resources/ui/carla_settings.ui View File

@@ -1494,6 +1494,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_exp_jack_apps">
<property name="text">
<string>Enable jack applications</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_exp_load_lib_global">
<property name="text">


+ 25
- 0
source/carla_database.py View File

@@ -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



+ 32
- 52
source/carla_host.py View File

@@ -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)



+ 7
- 0
source/carla_settings.py View File

@@ -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)



+ 2
- 0
source/carla_shared.py View File

@@ -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



Loading…
Cancel
Save