| @@ -27,7 +27,7 @@ from PyQt4.QtXml import QDomDocument | |||
| # Imports (Custom Stuff) | |||
| import ui_carla, ui_carla_about, ui_carla_database, ui_carla_edit, ui_carla_parameter, ui_carla_plugin, ui_carla_refresh | |||
| from carla_backend import * | |||
| from shared import * | |||
| from shared_settings import * | |||
| ICON_STATE_NULL = 0 | |||
| ICON_STATE_WAIT = 1 | |||
| @@ -81,6 +81,10 @@ save_state_custom_data = { | |||
| 'value': "" | |||
| } | |||
| # set default project folder | |||
| DEFAULT_PROJECT_FOLDER = HOME | |||
| setDefaultProjectFolder(DEFAULT_PROJECT_FOLDER) | |||
| def getStateDictFromXML(xml_node): | |||
| x_save_state_dict = deepcopy(save_state_dict) | |||
| @@ -1913,11 +1917,9 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||
| self.peak_in.setColor(self.peak_in.GREEN) | |||
| self.peak_in.setOrientation(self.peak_in.HORIZONTAL) | |||
| #self.peak_in.setRefreshRate(30) | |||
| self.peak_out.setColor(self.peak_in.BLUE) | |||
| self.peak_out.setOrientation(self.peak_out.HORIZONTAL) | |||
| #self.peak_in.setRefreshRate(30) | |||
| audio_count = CarlaHost.get_audio_port_count_info(self.plugin_id) | |||
| if (not audio_count['valid']): | |||
| @@ -2127,7 +2129,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||
| r = 35 | |||
| g = 35 | |||
| b = 35 | |||
| texture = 4 | |||
| texture = 9 | |||
| self.setStyleSheet(""" | |||
| QFrame#PluginWidget { | |||
| @@ -2140,7 +2142,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||
| } | |||
| QFrame#frame_name { | |||
| background-image: url(:/bitmaps/glass.png); | |||
| background-color: rgba(%i, %i, %i); | |||
| background-color: rgb(%i, %i, %i); | |||
| border: 2px outset; | |||
| border-color: rgb(%i, %i, %i); | |||
| } | |||
| @@ -2153,7 +2155,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||
| QFrame#frame_peaks { | |||
| background-color: rgba(30, 30, 30, 200); | |||
| border: 2px outset; | |||
| border-color: rgba(30, 30, 30, 255); | |||
| border-color: rgba(30, 30, 30, 225); | |||
| } | |||
| """ % (texture, r, g, b, r, g, b)) | |||
| @@ -2456,7 +2458,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||
| else: | |||
| peak = CarlaHost.get_input_peak_value(self.plugin_id, 1) | |||
| led_ain_state = bool(peak1 != 0.0) | |||
| led_ain_state = bool(peak != 0.0) | |||
| self.peak_in.displayMeter(1, peak) | |||
| @@ -2477,7 +2479,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||
| else: | |||
| peak = CarlaHost.get_output_peak_value(self.plugin_id, 1) | |||
| led_aout_state = bool(peak1 != 0.0) | |||
| led_aout_state = bool(peak != 0.0) | |||
| self.peak_out.displayMeter(1, peak) | |||
| @@ -2652,7 +2654,7 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| self.settings = QSettings("Cadence", "Carla") | |||
| self.settings_db = QSettings("Cadence", "Carla-Database") | |||
| self.loadSettings() | |||
| self.loadSettings(True) | |||
| self.loadRDFs() | |||
| @@ -2695,6 +2697,7 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| self.connect(self.act_plugin_add, SIGNAL("triggered()"), SLOT("slot_plugin_add()")) | |||
| self.connect(self.act_plugin_remove_all, SIGNAL("triggered()"), SLOT("slot_remove_all()")) | |||
| self.connect(self.act_settings_configure, SIGNAL("triggered()"), SLOT("slot_configureCarla()")) | |||
| self.connect(self.act_help_about, SIGNAL("triggered()"), SLOT("slot_aboutCarla()")) | |||
| self.connect(self.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()")) | |||
| @@ -2714,8 +2717,8 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| self.connect(self, SIGNAL("ReloadAllCallback(int)"), SLOT("slot_handleReloadAllCallback(int)")) | |||
| self.connect(self, SIGNAL("QuitCallback()"), SLOT("slot_handleQuitCallback()")) | |||
| self.TIMER_GUI_STUFF = self.startTimer(50) # Peaks | |||
| self.TIMER_GUI_STUFF2 = self.startTimer(50*2) # LEDs and edit dialog | |||
| self.TIMER_GUI_STUFF = self.startTimer(self.m_savedSettings["Main/RefreshInterval"]) # Peaks | |||
| self.TIMER_GUI_STUFF2 = self.startTimer(self.m_savedSettings["Main/RefreshInterval"]*2) # LEDs and edit dialog | |||
| def callback_function(self, action, plugin_id, value1, value2, value3): | |||
| if (plugin_id < 0 or plugin_id >= MAX_PLUGINS): | |||
| @@ -2871,6 +2874,9 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| self.m_plugin_list[new_plugin_id] = pwidget | |||
| self.act_plugin_remove_all.setEnabled(True) | |||
| pwidget.peak_in.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"]) | |||
| pwidget.peak_out.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"]) | |||
| if (activate): | |||
| pwidget.set_active(True, True, True) | |||
| @@ -3193,7 +3199,7 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| @pyqtSlot() | |||
| def slot_file_open(self): | |||
| file_filter = self.tr("Carla Project File (*.carxp)") | |||
| filename = QFileDialog.getOpenFileName(self, self.tr("Open Carla Project File"), filter=file_filter) | |||
| filename = QFileDialog.getOpenFileName(self, self.tr("Open Carla Project File"), self.m_savedSettings["Main/DefaultProjectFolder"], filter=file_filter) | |||
| if (filename): | |||
| self.m_project_filename = filename | |||
| @@ -3205,7 +3211,7 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| def slot_file_save(self, saveAs=False): | |||
| if (self.m_project_filename == None or saveAs): | |||
| file_filter = self.tr("Carla Project File (*.carxp)") | |||
| filename = QFileDialog.getSaveFileName(self, self.tr("Save Carla Project File"), filter=file_filter) | |||
| filename = QFileDialog.getSaveFileName(self, self.tr("Save Carla Project File"), self.m_savedSettings["Main/DefaultProjectFolder"], filter=file_filter) | |||
| if (filename): | |||
| self.m_project_filename = filename | |||
| @@ -3233,18 +3239,40 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
| @pyqtSlot() | |||
| def slot_remove_all(self): | |||
| for i in range(MAX_PLUGINS): | |||
| if (self.m_plugin_list[i] != None): | |||
| if (self.m_plugin_list[i]): | |||
| self.remove_plugin(i, False) | |||
| @pyqtSlot() | |||
| def slot_configureCarla(self): | |||
| dialog = SettingsW(self, "carla") | |||
| if (dialog.exec_()): | |||
| self.loadSettings(False) | |||
| for pwidget in self.m_plugin_list: | |||
| if (pwidget): | |||
| pwidget.peak_in.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"]) | |||
| pwidget.peak_out.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"]) | |||
| @pyqtSlot() | |||
| def slot_aboutCarla(self): | |||
| AboutW(self).exec_() | |||
| def saveSettings(self): | |||
| self.settings.setValue("Geometry", self.saveGeometry()) | |||
| self.settings.setValue("ShowToolbar", self.toolBar.isVisible()) | |||
| def loadSettings(self): | |||
| self.restoreGeometry(self.settings.value("Geometry", "")) | |||
| def loadSettings(self, geometry): | |||
| if (geometry): | |||
| self.restoreGeometry(self.settings.value("Geometry", "")) | |||
| show_toolbar = self.settings.value("ShowToolbar", True, type=bool) | |||
| self.act_settings_show_toolbar.setChecked(show_toolbar) | |||
| self.toolBar.setVisible(show_toolbar) | |||
| self.m_savedSettings = { | |||
| "Main/DefaultProjectFolder": self.settings.value("Main/DefaultProjectFolder", DEFAULT_PROJECT_FOLDER, type=str), | |||
| "Main/RefreshInterval": self.settings.value("Main/RefreshInterval", 120, type=int) | |||
| } | |||
| def timerEvent(self, event): | |||
| if (event.timerId() == self.TIMER_GUI_STUFF): | |||
| @@ -3274,20 +3302,24 @@ if __name__ == '__main__': | |||
| #force_parameters_style = (style in ("Bespin::Style",)) | |||
| CarlaHost = Host() | |||
| CarlaHost.set_option(OPTION_GLOBAL_JACK_CLIENT, 1, "") | |||
| # Create GUI and read settings | |||
| gui = CarlaMainW() | |||
| # Init backend | |||
| CarlaHost.set_option(OPTION_GLOBAL_JACK_CLIENT, 0, "") | |||
| if (not CarlaHost.carla_init("Carla")): | |||
| CustomMessageBox(None, QMessageBox.Critical, "Error", "Could not connect to JACK", | |||
| toString(CarlaHost.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) | |||
| sys.exit(1) | |||
| # Show GUI | |||
| gui = CarlaMainW() | |||
| gui.show() | |||
| # Set-up custom signal handling | |||
| set_up_signals(gui) | |||
| # Show GUI | |||
| gui.show() | |||
| for i in range(len(app.arguments())): | |||
| if (i == 0): continue | |||
| try_path = app.arguments()[i] | |||
| @@ -28,12 +28,15 @@ | |||
| #include <QtCore/QMutex> | |||
| #define CARLA_PROCESS_CONTINUE_CHECK if (m_id != plugin_id) { return callback_action(CALLBACK_DEBUG, plugin_id, m_id, 0, 0.0f); } | |||
| #define CARLA_PROCESS_CONTINUE_CHECK if (m_id != plugin_id) { return callback_action(CALLBACK_DEBUG, plugin_id, m_id, 0, 0.0); } | |||
| const unsigned short MAX_POSTEVENTS = 128; | |||
| // Global JACK client | |||
| extern jack_client_t* carla_jack_client; | |||
| const unsigned short MAX_POSTEVENTS = 128; | |||
| // jack.cpp | |||
| int carla_jack_process_callback(jack_nframes_t nframes, void* arg); | |||
| enum PluginPostEventType { | |||
| PostEventDebug, | |||
| @@ -618,6 +621,26 @@ public: | |||
| qDebug("CarlaPlugin::delete_buffers() - end"); | |||
| } | |||
| bool register_jack_plugin() | |||
| { | |||
| if (carla_options.global_jack_client) | |||
| { | |||
| jack_client = carla_jack_client; | |||
| return true; | |||
| } | |||
| else | |||
| { | |||
| jack_client = jack_client_open(m_name, JackNullOption, nullptr); | |||
| if (jack_client) | |||
| { | |||
| jack_set_process_callback(jack_client, carla_jack_process_callback, this); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| bool lib_open(const char* filename) | |||
| { | |||
| #ifdef Q_OS_WIN | |||
| @@ -82,11 +82,3 @@ void carla_jack_shutdown_callback(void*) | |||
| carla_jack_client = nullptr; | |||
| callback_action(CALLBACK_QUIT, 0, 0, 0, 0.0f); | |||
| } | |||
| //void carla_jack_register_plugin(CarlaPlugin* plugin) | |||
| //{ | |||
| //plugin->jack_client = jack_client_open(plugin->name, JackNullOption, 0); | |||
| //if (plugin->jack_client) | |||
| // jack_set_process_callback(plugin->jack_client, carla_jack_process_callback, plugin); | |||
| //} | |||
| @@ -900,15 +900,8 @@ public: | |||
| else | |||
| m_name = get_unique_name(descriptor->Name); | |||
| //if (carla_options.global_jack_client) | |||
| jack_client = carla_jack_client; | |||
| //else | |||
| // carla_jack_register_plugin(plugin); | |||
| if (jack_client) | |||
| { | |||
| if (register_jack_plugin()) | |||
| return true; | |||
| } | |||
| else | |||
| set_last_error("Failed to register plugin in JACK"); | |||
| } | |||
| @@ -81,5 +81,6 @@ | |||
| <file>bitmaps/textures/metal_6-512px.jpg</file> | |||
| <file>bitmaps/textures/metal_7-512px.jpg</file> | |||
| <file>bitmaps/textures/metal_8-512px.jpg</file> | |||
| <file>bitmaps/textures/metal_9-512px.jpg</file> | |||
| </qresource> | |||
| </RCC> | |||
| @@ -52,14 +52,15 @@ def setDefaultProjectFolder(folder): | |||
| # Settings Dialog | |||
| class SettingsW(QDialog, ui_settings_app.Ui_SettingsW): | |||
| def __init__(self, parent, appName, hasOpenGL): | |||
| def __init__(self, parent, appName, hasOpenGL=False): | |||
| QDialog.__init__(self, parent) | |||
| self.setupUi(self) | |||
| # Load app-specific settings | |||
| self.ms_AutoHideGroups = True | |||
| self.ms_UseSystemTray = True | |||
| self.ms_CloseToTray = False | |||
| self.ms_RefreshInterval = 120 | |||
| self.ms_AutoHideGroups = True | |||
| self.ms_UseSystemTray = True | |||
| self.ms_CloseToTray = False | |||
| if (appName == "catarina"): | |||
| self.ms_AutoHideGroups = False | |||
| @@ -70,17 +71,33 @@ class SettingsW(QDialog, ui_settings_app.Ui_SettingsW): | |||
| elif (appName == "catia"): | |||
| self.ms_UseSystemTray = False | |||
| self.group_main_paths.setEnabled(False) | |||
| self.group_main_paths.setVisible(False) | |||
| self.lw_page.hideRow(2) | |||
| self.lw_page.hideRow(3) | |||
| self.lw_page.setCurrentCell(0, 0) | |||
| elif (appName == "claudia"): | |||
| self.cb_jack_port_alias.setEnabled(False) | |||
| self.cb_jack_port_alias.setVisible(False) | |||
| self.label_jack_port_alias.setEnabled(False) | |||
| self.label_jack_port_alias.setVisible(False) | |||
| self.lw_page.hideRow(3) # TODO | |||
| self.lw_page.setCurrentCell(0, 0) | |||
| elif (appName == "carla"): | |||
| self.ms_RefreshInterval = 60 | |||
| self.cb_jack_port_alias.setEnabled(False) | |||
| self.cb_jack_port_alias.setVisible(False) | |||
| self.label_jack_port_alias.setEnabled(False) | |||
| self.label_jack_port_alias.setVisible(False) | |||
| self.group_tray.setEnabled(False) | |||
| self.group_tray.setVisible(False) | |||
| self.lw_page.hideRow(1) | |||
| self.lw_page.hideRow(2) | |||
| self.lw_page.hideRow(3) | |||
| self.lw_page.setCurrentCell(0, 0) | |||
| self.settings = self.parent().settings | |||
| self.loadSettings() | |||
| @@ -103,7 +120,7 @@ class SettingsW(QDialog, ui_settings_app.Ui_SettingsW): | |||
| self.le_main_def_folder.setText(self.settings.value("Main/DefaultProjectFolder", SETTINGS_DEFAULT_PROJECT_FOLDER, type=str)) | |||
| self.cb_tray_enable.setChecked(self.settings.value("Main/UseSystemTray", self.ms_UseSystemTray, type=bool)) | |||
| self.cb_tray_close_to.setChecked(self.settings.value("Main/CloseToTray", self.ms_CloseToTray, type=bool)) | |||
| self.sb_gui_refresh.setValue(self.settings.value("Main/RefreshInterval", 120, type=int)) | |||
| self.sb_gui_refresh.setValue(self.settings.value("Main/RefreshInterval", self.ms_RefreshInterval, type=int)) | |||
| self.cb_jack_port_alias.setCurrentIndex(self.settings.value("Main/JackPortAlias", 2, type=int)) | |||
| # ------------------------ | |||
| @@ -153,14 +170,16 @@ class SettingsW(QDialog, ui_settings_app.Ui_SettingsW): | |||
| # ------------------------ | |||
| # Page 0 | |||
| self.settings.setValue("Main/UseSystemTray", self.cb_tray_enable.isChecked()) | |||
| self.settings.setValue("Main/CloseToTray", self.cb_tray_close_to.isChecked()) | |||
| self.settings.setValue("Main/RefreshInterval", self.sb_gui_refresh.value()) | |||
| if (self.group_main_paths.isVisible()): | |||
| if (self.group_tray.isEnabled()): | |||
| self.settings.setValue("Main/UseSystemTray", self.cb_tray_enable.isChecked()) | |||
| self.settings.setValue("Main/CloseToTray", self.cb_tray_close_to.isChecked()) | |||
| if (self.group_main_paths.isEnabled()): | |||
| self.settings.setValue("Main/DefaultProjectFolder", self.le_main_def_folder.text()) | |||
| if (self.cb_jack_port_alias.isVisible()): | |||
| if (self.cb_jack_port_alias.isEnabled()): | |||
| self.settings.setValue("Main/JackPortAlias", self.cb_jack_port_alias.currentIndex()) | |||
| # ------------------------ | |||
| @@ -196,7 +215,7 @@ class SettingsW(QDialog, ui_settings_app.Ui_SettingsW): | |||
| self.le_main_def_folder.setText(SETTINGS_DEFAULT_PROJECT_FOLDER) | |||
| self.cb_tray_enable.setChecked(self.ms_UseSystemTray) | |||
| self.cb_tray_close_to.setChecked(self.ms_CloseToTray) | |||
| self.sb_gui_refresh.setValue(120) | |||
| self.sb_gui_refresh.setValue(self.ms_RefreshInterval) | |||
| self.cb_jack_port_alias.setCurrentIndex(2) | |||
| self.cb_ladish_notify.setChecked(LADISH_CONF_KEY_DAEMON_NOTIFY_DEFAULT) | |||
| self.cb_ladish_studio_autostart.setChecked(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART_DEFAULT) | |||
| @@ -80,8 +80,17 @@ | |||
| <addaction name="act_help_about"/> | |||
| <addaction name="act_help_about_qt"/> | |||
| </widget> | |||
| <widget class="QMenu" name="menu_Settings"> | |||
| <property name="title"> | |||
| <string>&Settings</string> | |||
| </property> | |||
| <addaction name="act_settings_show_toolbar"/> | |||
| <addaction name="separator"/> | |||
| <addaction name="act_settings_configure"/> | |||
| </widget> | |||
| <addaction name="menu_File"/> | |||
| <addaction name="menu_Plugin"/> | |||
| <addaction name="menu_Settings"/> | |||
| <addaction name="menu_Help"/> | |||
| </widget> | |||
| <widget class="QStatusBar" name="statusbar"/> | |||
| @@ -185,6 +194,23 @@ | |||
| <string>&Add New...</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_settings_show_toolbar"> | |||
| <property name="checkable"> | |||
| <bool>true</bool> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Show &Toolbar</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_settings_configure"> | |||
| <property name="icon"> | |||
| <iconset resource="../icons/icons.qrc"> | |||
| <normaloff>:/16x16/configure.png</normaloff>:/16x16/configure.png</iconset> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Configure Carla</string> | |||
| </property> | |||
| </action> | |||
| </widget> | |||
| <resources> | |||
| <include location="../icons/icons.qrc"/> | |||
| @@ -206,5 +232,21 @@ | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| <connection> | |||
| <sender>act_settings_show_toolbar</sender> | |||
| <signal>triggered(bool)</signal> | |||
| <receiver>toolBar</receiver> | |||
| <slot>setVisible(bool)</slot> | |||
| <hints> | |||
| <hint type="sourcelabel"> | |||
| <x>-1</x> | |||
| <y>-1</y> | |||
| </hint> | |||
| <hint type="destinationlabel"> | |||
| <x>354</x> | |||
| <y>35</y> | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| </connections> | |||
| </ui> | |||