| @@ -6,7 +6,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>1057</width> | |||
| <width>1045</width> | |||
| <height>716</height> | |||
| </rect> | |||
| </property> | |||
| @@ -335,8 +335,8 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>1057</width> | |||
| <height>20</height> | |||
| <width>1045</width> | |||
| <height>31</height> | |||
| </rect> | |||
| </property> | |||
| <widget class="QMenu" name="menu_File"> | |||
| @@ -358,6 +358,9 @@ | |||
| </property> | |||
| <addaction name="act_engine_start"/> | |||
| <addaction name="act_engine_stop"/> | |||
| <addaction name="act_engine_panic"/> | |||
| <addaction name="separator"/> | |||
| <addaction name="act_engine_config"/> | |||
| </widget> | |||
| <widget class="QMenu" name="menu_Plugin"> | |||
| <property name="title"> | |||
| @@ -462,10 +465,10 @@ | |||
| <addaction name="act_file_connect"/> | |||
| <addaction name="act_file_refresh"/> | |||
| <addaction name="separator"/> | |||
| <addaction name="act_plugin_add2"/> | |||
| <addaction name="act_add_jack"/> | |||
| <addaction name="act_plugin_add"/> | |||
| <addaction name="act_plugin_add_jack"/> | |||
| <addaction name="act_plugin_remove_all"/> | |||
| <addaction name="act_plugins_panic"/> | |||
| <addaction name="act_engine_panic"/> | |||
| <addaction name="separator"/> | |||
| <addaction name="act_settings_configure"/> | |||
| </widget> | |||
| @@ -1051,21 +1054,6 @@ | |||
| <string>Ctrl+A</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_plugin_add2"> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/16x16/list-add.svgz</normaloff>:/16x16/list-add.svgz</iconset> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Add Plugin...</string> | |||
| </property> | |||
| <property name="iconText"> | |||
| <string>Add Plugin...</string> | |||
| </property> | |||
| <property name="toolTip"> | |||
| <string>Add Plugin...</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_plugin_remove_all"> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| @@ -1110,15 +1098,6 @@ | |||
| <string>Center Balance</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_plugins_panic"> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/16x16/dialog-warning.svgz</normaloff>:/16x16/dialog-warning.svgz</iconset> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Panic</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_transport_play"> | |||
| <property name="checkable"> | |||
| <bool>true</bool> | |||
| @@ -1380,28 +1359,36 @@ | |||
| <string>Perform secret 5</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_add_jack"> | |||
| <action name="act_plugin_add_jack"> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/16x16/list-add.svgz</normaloff>:/16x16/list-add.svgz</iconset> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Add &JACK Application</string> | |||
| <string>Add &JACK Application...</string> | |||
| </property> | |||
| <property name="iconText"> | |||
| <string>Add JACK Application...</string> | |||
| </action> | |||
| <action name="act_engine_config"> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/16x16/configure.svgz</normaloff>:/16x16/configure.svgz</iconset> | |||
| </property> | |||
| <property name="toolTip"> | |||
| <string>Add JACK Application...</string> | |||
| <property name="text"> | |||
| <string>&Configure driver...</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_plugin_add_jack"> | |||
| <action name="act_engine_panic"> | |||
| <property name="icon"> | |||
| <iconset resource="../resources.qrc"> | |||
| <normaloff>:/16x16/list-add.svgz</normaloff>:/16x16/list-add.svgz</iconset> | |||
| <normaloff>:/16x16/dialog-warning.svgz</normaloff>:/16x16/dialog-warning.svgz</iconset> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Add &JACK Application...</string> | |||
| <string>Panic</string> | |||
| </property> | |||
| </action> | |||
| <action name="act_engine_panel"> | |||
| <property name="text"> | |||
| <string>Open custom driver panel...</string> | |||
| </property> | |||
| </action> | |||
| </widget> | |||
| @@ -6,15 +6,15 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>320</width> | |||
| <height>205</height> | |||
| <width>403</width> | |||
| <height>264</height> | |||
| </rect> | |||
| </property> | |||
| <property name="windowTitle"> | |||
| <string>Driver Settings</string> | |||
| </property> | |||
| <layout class="QGridLayout" name="gridLayout"> | |||
| <item row="0" column="0"> | |||
| <item row="0" column="0" colspan="2"> | |||
| <widget class="QLabel" name="label_device"> | |||
| <property name="text"> | |||
| <string>Device:</string> | |||
| @@ -24,11 +24,11 @@ | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item row="0" column="1"> | |||
| <widget class="QComboBox" name="cb_device"/> | |||
| <item row="2" column="2"> | |||
| <widget class="QComboBox" name="cb_samplerate"/> | |||
| </item> | |||
| <item row="0" column="2"> | |||
| <spacer name="horizontalSpacer"> | |||
| <item row="3" column="0"> | |||
| <spacer name="horizontalSpacer_2"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| @@ -37,72 +37,72 @@ | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>40</width> | |||
| <width>1</width> | |||
| <height>1</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item row="2" column="1"> | |||
| <widget class="QComboBox" name="cb_samplerate"/> | |||
| <item row="1" column="2"> | |||
| <widget class="QComboBox" name="cb_buffersize"/> | |||
| </item> | |||
| <item row="6" column="0" colspan="3"> | |||
| <widget class="QDialogButtonBox" name="buttonBox"> | |||
| <item row="0" column="2"> | |||
| <widget class="QComboBox" name="cb_device"/> | |||
| </item> | |||
| <item row="3" column="1" colspan="3"> | |||
| <widget class="QCheckBox" name="cb_triple_buffer"> | |||
| <property name="text"> | |||
| <string>Triple buffer</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item row="4" column="0"> | |||
| <spacer name="horizontalSpacer_3"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="standardButtons"> | |||
| <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>40</width> | |||
| <height>1</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </spacer> | |||
| </item> | |||
| <item row="1" column="0"> | |||
| <widget class="QLabel" name="label_buffersize"> | |||
| <item row="2" column="0" colspan="2"> | |||
| <widget class="QLabel" name="label_samplerate"> | |||
| <property name="text"> | |||
| <string>Buffer size:</string> | |||
| <string>Sample rate:</string> | |||
| </property> | |||
| <property name="alignment"> | |||
| <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item row="1" column="1"> | |||
| <widget class="QComboBox" name="cb_buffersize"/> | |||
| </item> | |||
| <item row="2" column="0"> | |||
| <widget class="QLabel" name="label_samplerate"> | |||
| <item row="1" column="0" colspan="2"> | |||
| <widget class="QLabel" name="label_buffersize"> | |||
| <property name="text"> | |||
| <string>Sample rate:</string> | |||
| <string>Buffer size:</string> | |||
| </property> | |||
| <property name="alignment"> | |||
| <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item row="3" column="0"> | |||
| <spacer name="horizontalSpacer_2"> | |||
| <item row="4" column="4"> | |||
| <spacer name="horizontalSpacer_6"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeType"> | |||
| <enum>QSizePolicy::Fixed</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>1</width> | |||
| <height>1</height> | |||
| <width>40</width> | |||
| <height>20</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item row="3" column="1" colspan="2"> | |||
| <widget class="QCheckBox" name="cb_triple_buffer"> | |||
| <property name="text"> | |||
| <string>Triple buffer</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item row="4" column="0" colspan="3"> | |||
| <item row="5" column="0" colspan="5"> | |||
| <layout class="QHBoxLayout" name="horizontalLayout_13"> | |||
| <item> | |||
| <spacer name="horizontalSpacer_20"> | |||
| @@ -118,7 +118,7 @@ | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="QLabel" name="label_22"> | |||
| <widget class="QLabel" name="ico_restart"> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>22</width> | |||
| @@ -140,7 +140,7 @@ | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="QLabel" name="label_23"> | |||
| <widget class="QLabel" name="label_restart"> | |||
| <property name="text"> | |||
| <string>Restart the engine to load the new settings</string> | |||
| </property> | |||
| @@ -161,6 +161,39 @@ | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| <item row="7" column="0" colspan="5"> | |||
| <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> | |||
| <item row="0" column="3" colspan="2"> | |||
| <spacer name="horizontalSpacer"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeType"> | |||
| <enum>QSizePolicy::Fixed</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>40</width> | |||
| <height>1</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item row="4" column="1" colspan="3"> | |||
| <widget class="QPushButton" name="b_panel"> | |||
| <property name="text"> | |||
| <string>Show Driver Control Panel</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <resources> | |||
| @@ -732,6 +732,12 @@ public: | |||
| */ | |||
| static const EngineDriverDeviceInfo* getDriverDeviceInfo(const uint index, const char* const driverName); | |||
| /*! | |||
| * Show a device custom control panel. | |||
| * @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL | |||
| */ | |||
| static bool showDriverDeviceControlPanel(const uint index, const char* const deviceName); | |||
| /*! | |||
| * Create a new engine, using driver @a driverName. | |||
| * Returned value must be deleted when no longer needed. | |||
| @@ -831,6 +837,11 @@ public: | |||
| */ | |||
| virtual void clearXruns() const noexcept; | |||
| /*! | |||
| * Show the custom control panel for the current engine device. | |||
| */ | |||
| virtual bool showDeviceControlPanel() const noexcept; | |||
| // ------------------------------------------------------------------- | |||
| // Plugin management | |||
| @@ -949,12 +960,6 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Information (base) | |||
| /*! | |||
| * Get the current engine driver hints. | |||
| * @see EngineDriverHints | |||
| */ | |||
| uint getHints() const noexcept; | |||
| /*! | |||
| * Get the current buffer size. | |||
| */ | |||
| @@ -1290,6 +1295,7 @@ public: | |||
| static const char* getJuceApiName(const uint index); | |||
| static const char* const* getJuceApiDeviceNames(const uint index); | |||
| static const EngineDriverDeviceInfo* getJuceDeviceInfo(const uint index, const char* const deviceName); | |||
| static bool showJuceDeviceControlPanel(const uint index, const char* const deviceName); | |||
| # else | |||
| // RtAudio | |||
| static CarlaEngine* newRtAudio(const AudioApi api); | |||
| @@ -290,6 +290,45 @@ typedef struct _CarlaRuntimeEngineInfo { | |||
| } CarlaRuntimeEngineInfo; | |||
| /*! | |||
| * Runtime engine driver device information. | |||
| */ | |||
| typedef struct { | |||
| /*! | |||
| * Name of the driver device. | |||
| */ | |||
| const char* name; | |||
| /*! | |||
| * This driver device hints. | |||
| * @see EngineDriverHints | |||
| */ | |||
| uint hints; | |||
| /*! | |||
| * Current buffer size. | |||
| */ | |||
| uint bufferSize; | |||
| /*! | |||
| * Available buffer sizes. | |||
| * Terminated with 0. | |||
| */ | |||
| const uint32_t* bufferSizes; | |||
| /*! | |||
| * Current sample rate. | |||
| */ | |||
| double sampleRate; | |||
| /*! | |||
| * Available sample rates. | |||
| * Terminated with 0.0. | |||
| */ | |||
| const double* sampleRates; | |||
| } CarlaRuntimeEngineDriverDeviceInfo; | |||
| /*! | |||
| * Image data for LV2 inline display API. | |||
| * raw image pixmap format is ARGB32, | |||
| @@ -328,6 +367,14 @@ CARLA_EXPORT const char* const* carla_get_engine_driver_device_names(uint index) | |||
| */ | |||
| CARLA_EXPORT const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(uint index, const char* name); | |||
| /*! | |||
| * Show a device custom control panel. | |||
| * @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL | |||
| * @param index Driver index | |||
| * @param name Device name | |||
| */ | |||
| CARLA_EXPORT bool carla_show_engine_driver_device_control_panel(uint index, const char* name); | |||
| #ifdef __cplusplus | |||
| /*! | |||
| * Get the currently used engine, may be NULL. | |||
| @@ -375,6 +422,16 @@ CARLA_EXPORT bool carla_is_engine_running(); | |||
| */ | |||
| CARLA_EXPORT const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info(); | |||
| /*! | |||
| * Get information about the currently running engine driver device. | |||
| */ | |||
| CARLA_EXPORT const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device_info(); | |||
| /*! | |||
| * Show the custom control panel for the current engine device. | |||
| */ | |||
| CARLA_EXPORT bool carla_show_engine_device_control_panel(); | |||
| /*! | |||
| * Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0. | |||
| */ | |||
| @@ -163,6 +163,11 @@ const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(uint index, co | |||
| return &retDevInfo; | |||
| } | |||
| bool carla_show_engine_driver_device_control_panel(uint index, const char* name) | |||
| { | |||
| return CarlaEngine::showDriverDeviceControlPanel(index, name); | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| CarlaEngine* carla_get_engine() | |||
| @@ -493,6 +498,57 @@ const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info() | |||
| return &retInfo; | |||
| } | |||
| const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device_info() | |||
| { | |||
| static CarlaRuntimeEngineDriverDeviceInfo retInfo; | |||
| // reset | |||
| retInfo.name = gNullCharPtr; | |||
| retInfo.hints = 0x0; | |||
| retInfo.bufferSize = 0; | |||
| retInfo.bufferSizes = nullptr; | |||
| retInfo.sampleRate = 0.0; | |||
| retInfo.sampleRates = nullptr; | |||
| CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &retInfo); | |||
| const char* const audioDriver = gStandalone.engine->getCurrentDriverName(); | |||
| uint index = 0; | |||
| uint count = CarlaEngine::getDriverCount(); | |||
| for (; index<count; ++index) | |||
| { | |||
| const char* const testDriverName = CarlaEngine::getDriverName(index); | |||
| CARLA_SAFE_ASSERT_CONTINUE(testDriverName != nullptr); | |||
| if (std::strcmp(testDriverName, audioDriver) == 0) | |||
| break; | |||
| } | |||
| CARLA_SAFE_ASSERT_RETURN(index != count, &retInfo); | |||
| const EngineOptions& options(gStandalone.engine->getOptions()); | |||
| const char* const audioDevice = options.audioDevice; | |||
| const EngineDriverDeviceInfo* const devInfo = CarlaEngine::getDriverDeviceInfo(index, audioDevice); | |||
| CARLA_SAFE_ASSERT_RETURN(devInfo != nullptr, &retInfo); | |||
| retInfo.name = audioDevice; | |||
| retInfo.hints = devInfo->hints; | |||
| retInfo.bufferSize = gStandalone.engine->getBufferSize(); | |||
| retInfo.bufferSizes = devInfo->bufferSizes; | |||
| retInfo.sampleRate = gStandalone.engine->getSampleRate(); | |||
| retInfo.sampleRates = devInfo->sampleRates; | |||
| return &retInfo; | |||
| } | |||
| bool carla_show_engine_device_control_panel() | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, false); | |||
| carla_debug("carla_show_engine_device_control_panel()"); | |||
| return gStandalone.engine->showDeviceControlPanel(); | |||
| } | |||
| void carla_clear_engine_xruns() | |||
| { | |||
| if (gStandalone.engine != nullptr) | |||
| @@ -193,6 +193,38 @@ const EngineDriverDeviceInfo* CarlaEngine::getDriverDeviceInfo(const uint index2 | |||
| return nullptr; | |||
| } | |||
| bool CarlaEngine::showDriverDeviceControlPanel(const uint index2, const char* const deviceName) | |||
| { | |||
| carla_debug("CarlaEngine::showDriverDeviceControlPanel(%i, \"%s\")", index2, deviceName); | |||
| uint index = index2; | |||
| if (jackbridge_is_ok() && index-- == 0) | |||
| { | |||
| return false; | |||
| } | |||
| #ifndef BUILD_BRIDGE | |||
| # ifdef USING_JUCE | |||
| if (const uint count = getJuceApiCount()) | |||
| { | |||
| if (index < count) | |||
| return showJuceDeviceControlPanel(index, deviceName); | |||
| index -= count; | |||
| } | |||
| # else | |||
| if (const uint count = getRtAudioApiCount()) | |||
| { | |||
| if (index < count) | |||
| return false; | |||
| } | |||
| # endif | |||
| #endif | |||
| carla_stderr("CarlaEngine::showDriverDeviceControlPanel(%i, \"%s\") - invalid index", index2, deviceName); | |||
| return false; | |||
| } | |||
| CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(driverName != nullptr && driverName[0] != '\0', nullptr); | |||
| @@ -373,6 +405,11 @@ void CarlaEngine::clearXruns() const noexcept | |||
| #endif | |||
| } | |||
| bool CarlaEngine::showDeviceControlPanel() const noexcept | |||
| { | |||
| return false; | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Plugin management | |||
| @@ -1203,11 +1240,6 @@ void CarlaEngine::clearCurrentProjectFilename() noexcept | |||
| // ----------------------------------------------------------------------- | |||
| // Information (base) | |||
| uint CarlaEngine::getHints() const noexcept | |||
| { | |||
| return pData->hints; | |||
| } | |||
| uint32_t CarlaEngine::getBufferSize() const noexcept | |||
| { | |||
| return pData->bufferSize; | |||
| @@ -379,7 +379,6 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept | |||
| loadingProject(false), | |||
| currentProjectFilename(), | |||
| #endif | |||
| hints(0x0), | |||
| bufferSize(0), | |||
| sampleRate(0.0), | |||
| aboutToClose(false), | |||
| @@ -231,7 +231,6 @@ struct CarlaEngine::ProtectedData { | |||
| CarlaString currentProjectFilename; | |||
| #endif | |||
| uint hints; | |||
| uint32_t bufferSize; | |||
| double sampleRate; | |||
| @@ -352,6 +352,13 @@ public: | |||
| pData->xruns = xruns > 0 ? static_cast<uint32_t>(xruns) : 0; | |||
| } | |||
| bool showDeviceControlPanel() const noexcept override | |||
| { | |||
| try { | |||
| return fDevice->showControlPanel(); | |||
| } CARLA_SAFE_EXCEPTION_RETURN("showDeviceControlPanel", false); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Patchbay | |||
| @@ -1010,6 +1017,23 @@ const EngineDriverDeviceInfo* CarlaEngine::getJuceDeviceInfo(const uint uindex, | |||
| return &devInfo; | |||
| } | |||
| bool CarlaEngine::showJuceDeviceControlPanel(const uint uindex, const char* const deviceName) | |||
| { | |||
| const int index(static_cast<int>(uindex)); | |||
| CARLA_SAFE_ASSERT_RETURN(index < gDeviceTypes.size(), false); | |||
| juce::AudioIODeviceType* const deviceType(gDeviceTypes[index]); | |||
| CARLA_SAFE_ASSERT_RETURN(deviceType != nullptr, false); | |||
| deviceType->scanForDevices(); | |||
| ScopedPointer<juce::AudioIODevice> device(deviceType->createDevice(deviceName, deviceName)); | |||
| CARLA_SAFE_ASSERT_RETURN(device != nullptr, false); | |||
| return device->showControlPanel(); | |||
| } | |||
| // ----------------------------------------- | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| @@ -1291,6 +1291,31 @@ class CarlaRuntimeEngineInfo(Structure): | |||
| ("xruns", c_uint32) | |||
| ] | |||
| # Runtime engine driver device information. | |||
| class CarlaRuntimeEngineDriverDeviceInfo(Structure): | |||
| _fields_ = [ | |||
| # Name of the driver device. | |||
| ("name", c_char_p), | |||
| # This driver device hints. | |||
| # @see EngineDriverHints | |||
| ("hints", c_uint), | |||
| # Current buffer size. | |||
| ("bufferSize", c_uint32), | |||
| # Available buffer sizes. | |||
| # Terminated with 0. | |||
| ("bufferSizes", POINTER(c_uint32)), | |||
| # Current sample rate. | |||
| ("sampleRate", c_double), | |||
| # Available sample rates. | |||
| # Terminated with 0.0. | |||
| ("sampleRates", POINTER(c_double)) | |||
| ] | |||
| # Image data for LV2 inline display API. | |||
| # raw image pixmap format is ARGB32, | |||
| class CarlaInlineDisplayImageSurface(Structure): | |||
| @@ -1342,18 +1367,28 @@ PyCarlaScalePointInfo = { | |||
| # @see CarlaTransportInfo | |||
| PyCarlaTransportInfo = { | |||
| "playing": False, | |||
| "frame": 0, | |||
| "bar": 0, | |||
| "beat": 0, | |||
| "tick": 0, | |||
| "bpm": 0.0 | |||
| 'playing': False, | |||
| 'frame': 0, | |||
| 'bar': 0, | |||
| 'beat': 0, | |||
| 'tick': 0, | |||
| 'bpm': 0.0 | |||
| } | |||
| # @see CarlaRuntimeEngineInfo | |||
| PyCarlaRuntimeEngineInfo = { | |||
| "load": 0.0, | |||
| "xruns": 0 | |||
| 'load': 0.0, | |||
| 'xruns': 0 | |||
| } | |||
| # @see CarlaRuntimeEngineDriverDeviceInfo | |||
| PyCarlaRuntimeEngineDriverDeviceInfo = { | |||
| 'name': "", | |||
| 'hints': 0x0, | |||
| 'bufferSize': 0, | |||
| 'bufferSizes': [], | |||
| 'sampleRate': 0.0, | |||
| 'sampleRates': [] | |||
| } | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| @@ -1429,6 +1464,14 @@ class CarlaHostMeta(object): | |||
| def get_engine_driver_device_info(self, index, name): | |||
| raise NotImplementedError | |||
| # Show a device custom control panel. | |||
| # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL | |||
| # @param index Driver index | |||
| # @param name Device name | |||
| @abstractmethod | |||
| def show_engine_driver_device_control_panel(self, index, name): | |||
| raise NotImplementedError | |||
| # Initialize the engine. | |||
| # Make sure to call carla_engine_idle() at regular intervals afterwards. | |||
| # @param driverName Driver to use | |||
| @@ -1460,6 +1503,15 @@ class CarlaHostMeta(object): | |||
| def get_runtime_engine_info(self): | |||
| raise NotImplementedError | |||
| # Get information about the currently running engine driver device. | |||
| @abstractmethod | |||
| def get_runtime_engine_driver_device_info(self): | |||
| raise NotImplementedError | |||
| # Show the custom control panel for the current engine device. | |||
| def show_engine_device_control_panel(self): | |||
| raise NotImplementedError | |||
| # Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0. | |||
| @abstractmethod | |||
| def clear_engine_xruns(self): | |||
| @@ -2083,6 +2135,9 @@ class CarlaHostNull(CarlaHostMeta): | |||
| def get_engine_driver_device_info(self, index, name): | |||
| return PyEngineDriverDeviceInfo | |||
| def show_engine_driver_device_control_panel(self, index, name): | |||
| return False | |||
| def engine_init(self, driverName, clientName): | |||
| self.fEngineRunning = True | |||
| if self.fEngineCallback is not None: | |||
| @@ -2110,6 +2165,12 @@ class CarlaHostNull(CarlaHostMeta): | |||
| def get_runtime_engine_info(self): | |||
| return PyCarlaRuntimeEngineInfo | |||
| def get_runtime_engine_driver_device_info(self): | |||
| return PyCarlaRuntimeEngineDriverDeviceInfo | |||
| def show_engine_device_control_panel(self): | |||
| return False | |||
| def clear_engine_xruns(self): | |||
| return | |||
| @@ -2395,6 +2456,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||
| self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p] | |||
| self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo) | |||
| self.lib.carla_show_engine_driver_device_control_panel.argtypes = [c_uint, c_char_p] | |||
| self.lib.carla_show_engine_driver_device_control_panel.restype = c_bool | |||
| self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p] | |||
| self.lib.carla_engine_init.restype = c_bool | |||
| @@ -2410,6 +2474,12 @@ class CarlaHostDLL(CarlaHostMeta): | |||
| self.lib.carla_get_runtime_engine_info.argtypes = None | |||
| self.lib.carla_get_runtime_engine_info.restype = POINTER(CarlaRuntimeEngineInfo) | |||
| self.lib.carla_get_runtime_engine_driver_device_info.argtypes = None | |||
| self.lib.carla_get_runtime_engine_driver_device_info.restype = POINTER(CarlaRuntimeEngineDriverDeviceInfo) | |||
| self.lib.carla_show_engine_device_control_panel.argtypes = None | |||
| self.lib.carla_show_engine_device_control_panel.restype = c_bool | |||
| self.lib.carla_clear_engine_xruns.argtypes = None | |||
| self.lib.carla_clear_engine_xruns.restype = None | |||
| @@ -2685,6 +2755,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||
| def get_engine_driver_device_info(self, index, name): | |||
| return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents) | |||
| def show_engine_driver_device_control_panel(self, index, name): | |||
| return bool(self.lib.carla_show_engine_driver_device_control_panel(index, name.encode("utf-8"))) | |||
| def engine_init(self, driverName, clientName): | |||
| return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8"))) | |||
| @@ -2700,11 +2773,17 @@ class CarlaHostDLL(CarlaHostMeta): | |||
| def get_runtime_engine_info(self): | |||
| return structToDict(self.lib.carla_get_runtime_engine_info().contents) | |||
| def get_runtime_engine_driver_device_info(self): | |||
| return structToDict(self.lib.carla_get_runtime_engine_driver_device_info().contents) | |||
| def show_engine_device_control_panel(self): | |||
| return bool(self.lib.carla_show_engine_device_control_panel()) | |||
| def clear_engine_xruns(self): | |||
| return self.lib.carla_clear_engine_xruns() | |||
| self.lib.carla_clear_engine_xruns() | |||
| def cancel_engine_action(self): | |||
| return self.lib.carla_cancel_engine_action() | |||
| self.lib.carla_cancel_engine_action() | |||
| def set_engine_about_to_close(self): | |||
| return bool(self.lib.carla_set_engine_about_to_close()) | |||
| @@ -3078,9 +3157,18 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
| def get_engine_driver_device_info(self, index, name): | |||
| return PyEngineDriverDeviceInfo | |||
| def show_engine_driver_device_control_panel(self, index, name): | |||
| return False | |||
| def get_runtime_engine_info(self): | |||
| return self.fRuntimeEngineInfo | |||
| def get_runtime_engine_driver_device_info(self): | |||
| return PyCarlaRuntimeEngineDriverDeviceInfo | |||
| def show_engine_device_control_panel(self): | |||
| return False | |||
| def clear_engine_xruns(self): | |||
| self.sendMsg(["clear_engine_xruns"]) | |||
| @@ -423,13 +423,12 @@ class HostWindow(QMainWindow): | |||
| self.ui.act_engine_start.triggered.connect(self.slot_engineStart) | |||
| self.ui.act_engine_stop.triggered.connect(self.slot_engineStop) | |||
| self.ui.act_engine_panic.triggered.connect(self.slot_pluginsDisable) | |||
| self.ui.act_engine_config.triggered.connect(self.slot_engineConfig) | |||
| self.ui.act_plugin_add.triggered.connect(self.slot_pluginAdd) | |||
| self.ui.act_plugin_add2.triggered.connect(self.slot_pluginAdd) | |||
| self.ui.act_plugin_remove_all.triggered.connect(self.slot_confirmRemoveAll) | |||
| self.ui.act_add_jack.triggered.connect(self.slot_jackAppAdd) | |||
| self.ui.act_plugin_add_jack.triggered.connect(self.slot_jackAppAdd) | |||
| self.ui.act_plugin_remove_all.triggered.connect(self.slot_confirmRemoveAll) | |||
| self.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable) | |||
| self.ui.act_plugins_disable.triggered.connect(self.slot_pluginsDisable) | |||
| @@ -440,7 +439,6 @@ class HostWindow(QMainWindow): | |||
| self.ui.act_plugins_center.triggered.connect(self.slot_pluginsCenter) | |||
| self.ui.act_plugins_compact.triggered.connect(self.slot_pluginsCompact) | |||
| self.ui.act_plugins_expand.triggered.connect(self.slot_pluginsExpand) | |||
| self.ui.act_plugins_panic.triggered.connect(self.slot_pluginsDisable) | |||
| self.ui.act_settings_show_toolbar.toggled.connect(self.slot_showToolbar) | |||
| self.ui.act_settings_show_meters.toggled.connect(self.slot_showCanvasMeters) | |||
| @@ -868,6 +866,17 @@ class HostWindow(QMainWindow): | |||
| return self.slot_engineStopTryAgain() | |||
| @pyqtSlot() | |||
| def slot_engineConfig(self): | |||
| dialog = RuntimeDriverSettingsW(self.fParentOrSelf, self.host) | |||
| if not dialog.exec_(): | |||
| return | |||
| if not self.host.is_engine_running(): | |||
| QMessageBox.warning(self, self.tr("Warning"), self.tr("Engine was stopped while configuring settings, all changes have been ignored")) | |||
| return | |||
| @pyqtSlot() | |||
| def slot_engineStopTryAgain(self): | |||
| if self.host.is_engine_running() and not self.host.set_engine_about_to_close(): | |||
| @@ -1746,10 +1755,8 @@ class HostWindow(QMainWindow): | |||
| if self.host.experimental: | |||
| visible = settings2.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS, CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, type=bool) | |||
| self.ui.act_add_jack.setVisible(visible) | |||
| self.ui.act_plugin_add_jack.setVisible(visible) | |||
| else: | |||
| self.ui.act_add_jack.setVisible(False) | |||
| self.ui.act_plugin_add_jack.setVisible(False) | |||
| self.fMiniCanvasUpdateTimeout = 1000 if self.fSavedSettings[CARLA_KEY_CANVAS_FANCY_EYE_CANDY] else 0 | |||
| @@ -82,6 +82,7 @@ class DriverSettingsW(QDialog): | |||
| # Set-up connections | |||
| self.accepted.connect(self.slot_saveSettings) | |||
| self.ui.b_panel.clicked.connect(self.slot_showDevicePanel) | |||
| self.ui.cb_device.currentIndexChanged.connect(self.slot_updateDeviceInfo) | |||
| # ---------------------------------------------------------------------------------------------------- | |||
| @@ -139,6 +140,10 @@ class DriverSettingsW(QDialog): | |||
| # -------------------------------------------------------------------------------------------------------- | |||
| @pyqtSlot() | |||
| def slot_showDevicePanel(self): | |||
| self.host.show_engine_driver_device_control_panel(self.fDriverIndex, self.ui.cb_device.currentText()) | |||
| @pyqtSlot() | |||
| def slot_updateDeviceInfo(self): | |||
| deviceName = self.ui.cb_device.currentText() | |||
| @@ -159,6 +164,11 @@ class DriverSettingsW(QDialog): | |||
| else: | |||
| self.ui.cb_triple_buffer.setEnabled(False) | |||
| if driverDeviceHints & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL: | |||
| self.ui.b_panel.setEnabled(True) | |||
| else: | |||
| self.ui.b_panel.setEnabled(False) | |||
| if len(self.fBufferSizes) > 0: | |||
| for bsize in self.fBufferSizes: | |||
| sbsize = str(bsize) | |||
| @@ -189,6 +199,107 @@ class DriverSettingsW(QDialog): | |||
| QDialog.done(self, r) | |||
| self.close() | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Runtime Driver Settings | |||
| class RuntimeDriverSettingsW(QDialog): | |||
| def __init__(self, parent, host): | |||
| QDialog.__init__(self, parent) | |||
| self.host = host | |||
| self.ui = ui_carla_settings_driver.Ui_DriverSettingsW() | |||
| self.ui.setupUi(self) | |||
| if False: | |||
| # kdevelop likes this :) | |||
| host = CarlaHostNull() | |||
| self.host = host | |||
| driverDeviceInfo = host.get_runtime_engine_driver_device_info() | |||
| # ---------------------------------------------------------------------------------------------------- | |||
| # Set-up GUI | |||
| self.ui.cb_device.setEnabled(False) | |||
| self.ui.cb_device.clear() | |||
| self.ui.cb_buffersize.clear() | |||
| self.ui.cb_samplerate.clear() | |||
| self.ui.cb_triple_buffer.hide() | |||
| self.ui.ico_restart.hide() | |||
| self.ui.label_restart.hide() | |||
| self.adjustSize() | |||
| self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) | |||
| #self.setFixedSize(self.size()) | |||
| # ---------------------------------------------------------------------------------------------------- | |||
| # Load runtime settings | |||
| self.ui.cb_device.addItem(driverDeviceInfo['name']) | |||
| self.ui.cb_device.setCurrentIndex(0) | |||
| if len(driverDeviceInfo['bufferSizes']) > 0: | |||
| for bsize in driverDeviceInfo['bufferSizes']: | |||
| sbsize = str(bsize) | |||
| self.ui.cb_buffersize.addItem(sbsize) | |||
| if driverDeviceInfo['bufferSize'] == bsize: | |||
| self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1) | |||
| else: | |||
| self.ui.cb_buffersize.addItem(DriverSettingsW.AUTOMATIC_OPTION) | |||
| self.ui.cb_buffersize.setCurrentIndex(0) | |||
| if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE) == 0x0: | |||
| self.ui.cb_buffersize.setEnabled(False) | |||
| if len(driverDeviceInfo['sampleRates']) > 0: | |||
| for srate in driverDeviceInfo['sampleRates']: | |||
| ssrate = str(int(srate)) | |||
| self.ui.cb_samplerate.addItem(ssrate) | |||
| if driverDeviceInfo['sampleRate'] == srate: | |||
| self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1) | |||
| else: | |||
| self.ui.cb_samplerate.addItem(DriverSettingsW.AUTOMATIC_OPTION) | |||
| self.ui.cb_samplerate.setCurrentIndex(0) | |||
| if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE) == 0x0: | |||
| self.ui.cb_samplerate.setEnabled(False) | |||
| if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL) == 0x0: | |||
| self.ui.b_panel.setEnabled(False) | |||
| # ---------------------------------------------------------------------------------------------------- | |||
| # Set-up connections | |||
| self.ui.b_panel.clicked.connect(self.slot_showDevicePanel) | |||
| # -------------------------------------------------------------------------------------------------------- | |||
| def getValues(self): | |||
| bufferSize = self.ui.cb_buffersize.currentText() | |||
| sampleRate = self.ui.cb_samplerate.currentText() | |||
| if bufferSize == self.AUTOMATIC_OPTION: | |||
| bufferSize = "0" | |||
| if sampleRate == self.AUTOMATIC_OPTION: | |||
| sampleRate = "0" | |||
| return (int(bufferSize), int(sampleRate)) | |||
| # -------------------------------------------------------------------------------------------------------- | |||
| @pyqtSlot() | |||
| def slot_showDevicePanel(self): | |||
| self.host.show_engine_device_control_panel() | |||
| # -------------------------------------------------------------------------------------------------------- | |||
| def done(self, r): | |||
| QDialog.done(self, r) | |||
| self.close() | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Settings Dialog | |||