@@ -6,109 +6,210 @@ | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>403</width> | |||
<width>350</width> | |||
<height>264</height> | |||
</rect> | |||
</property> | |||
<property name="minimumSize"> | |||
<size> | |||
<width>350</width> | |||
<height>0</height> | |||
</size> | |||
</property> | |||
<property name="windowTitle"> | |||
<string>Driver Settings</string> | |||
</property> | |||
<layout class="QGridLayout" name="gridLayout"> | |||
<item row="0" column="0" colspan="2"> | |||
<widget class="QLabel" name="label_device"> | |||
<property name="text"> | |||
<string>Device:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item row="2" column="2"> | |||
<widget class="QComboBox" name="cb_samplerate"/> | |||
</item> | |||
<item row="3" column="0"> | |||
<spacer name="horizontalSpacer_2"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeType"> | |||
<enum>QSizePolicy::Fixed</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>1</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
<item row="1" column="2"> | |||
<widget class="QComboBox" name="cb_buffersize"/> | |||
</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="sizeType"> | |||
<enum>QSizePolicy::Fixed</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>1</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
<item row="2" column="0" colspan="2"> | |||
<widget class="QLabel" name="label_samplerate"> | |||
<property name="text"> | |||
<string>Sample rate:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
<layout class="QVBoxLayout" name="verticalLayout"> | |||
<item> | |||
<layout class="QGridLayout" name="gridLayout"> | |||
<item row="2" column="1"> | |||
<widget class="QComboBox" name="cb_samplerate"/> | |||
</item> | |||
<item row="0" column="2"> | |||
<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 row="1" column="2"> | |||
<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> | |||
<item row="0" column="1"> | |||
<widget class="QComboBox" name="cb_device"/> | |||
</item> | |||
<item row="2" column="2"> | |||
<spacer name="horizontalSpacer_4"> | |||
<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 row="0" column="0"> | |||
<widget class="QLabel" name="label_device"> | |||
<property name="sizePolicy"> | |||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | |||
<horstretch>0</horstretch> | |||
<verstretch>0</verstretch> | |||
</sizepolicy> | |||
</property> | |||
<property name="text"> | |||
<string>Device:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item row="1" column="0"> | |||
<widget class="QLabel" name="label_buffersize"> | |||
<property name="sizePolicy"> | |||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | |||
<horstretch>0</horstretch> | |||
<verstretch>0</verstretch> | |||
</sizepolicy> | |||
</property> | |||
<property name="text"> | |||
<string>Buffer size:</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"> | |||
<property name="sizePolicy"> | |||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | |||
<horstretch>0</horstretch> | |||
<verstretch>0</verstretch> | |||
</sizepolicy> | |||
</property> | |||
<property name="text"> | |||
<string>Sample rate:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</item> | |||
<item row="1" column="0" colspan="2"> | |||
<widget class="QLabel" name="label_buffersize"> | |||
<property name="text"> | |||
<string>Buffer size:</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
<item> | |||
<layout class="QHBoxLayout" name="layout_triple_buffer"> | |||
<item> | |||
<spacer name="horizontalSpacer_5"> | |||
<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="QCheckBox" name="cb_triple_buffer"> | |||
<property name="text"> | |||
<string>Triple buffer</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer_6"> | |||
<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 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>20</width> | |||
<height>1</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
<item> | |||
<layout class="QHBoxLayout" name="horizontalLayout_2"> | |||
<item> | |||
<spacer name="horizontalSpacer_3"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeType"> | |||
<enum>QSizePolicy::Preferred</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>40</width> | |||
<height>20</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_panel"> | |||
<property name="minimumSize"> | |||
<size> | |||
<width>32</width> | |||
<height>0</height> | |||
</size> | |||
</property> | |||
<property name="text"> | |||
<string>Show Driver Control Panel</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer_7"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeType"> | |||
<enum>QSizePolicy::Preferred</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>40</width> | |||
<height>20</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
</layout> | |||
</item> | |||
<item row="5" column="0" colspan="5"> | |||
<layout class="QHBoxLayout" name="horizontalLayout_13"> | |||
<item> | |||
<layout class="QHBoxLayout" name="layout_restart"> | |||
<item> | |||
<spacer name="horizontalSpacer_20"> | |||
<spacer name="spacer_1"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
@@ -150,7 +251,7 @@ | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer_21"> | |||
<spacer name="spacer_2"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
@@ -164,7 +265,7 @@ | |||
</item> | |||
</layout> | |||
</item> | |||
<item row="7" column="0" colspan="5"> | |||
<item> | |||
<widget class="QDialogButtonBox" name="buttonBox"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
@@ -174,32 +275,6 @@ | |||
</property> | |||
</widget> | |||
</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> | |||
<item row="0" column="2"> | |||
<widget class="QComboBox" name="cb_device"/> | |||
</item> | |||
<item row="1" column="3"> | |||
<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> | |||
</layout> | |||
</widget> | |||
<resources> | |||
@@ -1199,16 +1199,22 @@ typedef enum { | |||
*/ | |||
ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11, | |||
/*! | |||
* Audio driver. | |||
* Default depends on platform. | |||
*/ | |||
ENGINE_OPTION_AUDIO_DRIVER = 12, | |||
/*! | |||
* Audio device (within a driver). | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_AUDIO_DEVICE = 12, | |||
ENGINE_OPTION_AUDIO_DEVICE = 13, | |||
/*! | |||
* Wherever to enable OSC support in the engine. | |||
*/ | |||
ENGINE_OPTION_OSC_ENABLED = 13, | |||
ENGINE_OPTION_OSC_ENABLED = 14, | |||
/*! | |||
* The network TCP port to use for OSC. | |||
@@ -1216,7 +1222,7 @@ typedef enum { | |||
* A value of < 0 means to not enable the TCP port for OSC. | |||
* @note Valid ports begin at 1024 and end at 32767 (inclusive) | |||
*/ | |||
ENGINE_OPTION_OSC_PORT_TCP = 14, | |||
ENGINE_OPTION_OSC_PORT_TCP = 15, | |||
/*! | |||
* The network UDP port to use for OSC. | |||
@@ -1225,81 +1231,81 @@ typedef enum { | |||
* @note Disabling this option prevents DSSI UIs from working! | |||
* @note Valid ports begin at 1024 and end at 32767 (inclusive) | |||
*/ | |||
ENGINE_OPTION_OSC_PORT_UDP = 15, | |||
ENGINE_OPTION_OSC_PORT_UDP = 16, | |||
/*! | |||
* Set path used for a specific plugin type. | |||
* Uses value as the plugin format, valueStr as actual path. | |||
* @see PluginType | |||
*/ | |||
ENGINE_OPTION_PLUGIN_PATH = 16, | |||
ENGINE_OPTION_PLUGIN_PATH = 17, | |||
/*! | |||
* Set path to the binary files. | |||
* Default unset. | |||
* @note Must be set for plugin and UI bridges to work | |||
*/ | |||
ENGINE_OPTION_PATH_BINARIES = 17, | |||
ENGINE_OPTION_PATH_BINARIES = 18, | |||
/*! | |||
* Set path to the resource files. | |||
* Default unset. | |||
* @note Must be set for some internal plugins to work | |||
*/ | |||
ENGINE_OPTION_PATH_RESOURCES = 18, | |||
ENGINE_OPTION_PATH_RESOURCES = 19, | |||
/*! | |||
* Prevent bad plugin and UI behaviour. | |||
* @note: Linux only | |||
*/ | |||
ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 19, | |||
ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 20, | |||
/*! | |||
* Set UI scaling used in frontend, so backend can do the same for plugin UIs. | |||
*/ | |||
ENGINE_OPTION_FRONTEND_UI_SCALE = 20, | |||
ENGINE_OPTION_FRONTEND_UI_SCALE = 21, | |||
/*! | |||
* Set frontend winId, used to define as parent window for plugin UIs. | |||
*/ | |||
ENGINE_OPTION_FRONTEND_WIN_ID = 21, | |||
ENGINE_OPTION_FRONTEND_WIN_ID = 22, | |||
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN) | |||
/*! | |||
* Set path to wine executable. | |||
*/ | |||
ENGINE_OPTION_WINE_EXECUTABLE = 22, | |||
ENGINE_OPTION_WINE_EXECUTABLE = 23, | |||
/*! | |||
* Enable automatic wineprefix detection. | |||
*/ | |||
ENGINE_OPTION_WINE_AUTO_PREFIX = 23, | |||
ENGINE_OPTION_WINE_AUTO_PREFIX = 24, | |||
/*! | |||
* Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set. | |||
*/ | |||
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 24, | |||
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 25, | |||
/*! | |||
* Enable realtime priority for Wine application and server threads. | |||
*/ | |||
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 25, | |||
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 26, | |||
/*! | |||
* Base realtime priority for Wine threads. | |||
*/ | |||
ENGINE_OPTION_WINE_BASE_RT_PRIO = 26, | |||
ENGINE_OPTION_WINE_BASE_RT_PRIO = 27, | |||
/*! | |||
* Wine server realtime priority. | |||
*/ | |||
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 27, | |||
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 28, | |||
#endif | |||
/*! | |||
* Capture console output into debug callbacks. | |||
*/ | |||
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 28 | |||
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 29 | |||
} EngineOption; | |||
@@ -240,6 +240,7 @@ struct CARLA_API EngineOptions { | |||
uint audioBufferSize; | |||
uint audioSampleRate; | |||
bool audioTripleBuffer; | |||
const char* audioDriver; | |||
const char* audioDevice; | |||
#ifndef BUILD_BRIDGE | |||
@@ -422,6 +422,7 @@ CARLA_EXPORT bool carla_is_engine_running(); | |||
*/ | |||
CARLA_EXPORT const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info(); | |||
#ifndef BUILD_BRIDGE | |||
/*! | |||
* Get information about the currently running engine driver device. | |||
*/ | |||
@@ -439,6 +440,7 @@ CARLA_EXPORT bool carla_set_engine_buffer_size_and_sample_rate(uint bufferSize, | |||
* @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL | |||
*/ | |||
CARLA_EXPORT bool carla_show_engine_device_control_panel(); | |||
#endif | |||
/*! | |||
* Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0. | |||
@@ -255,6 +255,9 @@ static void carla_engine_init_common(CarlaEngine* const engine) | |||
engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(gStandalone.engineOptions.audioSampleRate), nullptr); | |||
engine->setOption(CB::ENGINE_OPTION_AUDIO_TRIPLE_BUFFER, gStandalone.engineOptions.audioTripleBuffer ? 1 : 0, nullptr); | |||
if (gStandalone.engineOptions.audioDriver != nullptr) | |||
engine->setOption(CB::ENGINE_OPTION_AUDIO_DRIVER, 0, gStandalone.engineOptions.audioDriver); | |||
if (gStandalone.engineOptions.audioDevice != nullptr) | |||
engine->setOption(CB::ENGINE_OPTION_AUDIO_DEVICE, 0, gStandalone.engineOptions.audioDevice); | |||
@@ -498,6 +501,7 @@ const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info() | |||
return &retInfo; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device_info() | |||
{ | |||
static CarlaRuntimeEngineDriverDeviceInfo retInfo; | |||
@@ -510,8 +514,27 @@ const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device | |||
retInfo.sampleRate = 0.0; | |||
retInfo.sampleRates = nullptr; | |||
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &retInfo); | |||
const char* const audioDriver = gStandalone.engine->getCurrentDriverName(); | |||
const char* audioDriver; | |||
const char* audioDevice; | |||
if (CarlaEngine* const engine = gStandalone.engine) | |||
{ | |||
audioDriver = engine->getCurrentDriverName(); | |||
audioDevice = engine->getOptions().audioDevice; | |||
retInfo.bufferSize = engine->getBufferSize(); | |||
retInfo.sampleRate = engine->getSampleRate(); | |||
} | |||
else | |||
{ | |||
audioDriver = gStandalone.engineOptions.audioDriver; | |||
audioDevice = gStandalone.engineOptions.audioDevice; | |||
retInfo.bufferSize = gStandalone.engineOptions.audioBufferSize; | |||
retInfo.sampleRate = gStandalone.engineOptions.audioSampleRate; | |||
} | |||
CARLA_SAFE_ASSERT_RETURN(audioDriver != nullptr, &retInfo); | |||
CARLA_SAFE_ASSERT_RETURN(audioDevice != nullptr, &retInfo); | |||
uint index = 0; | |||
uint count = CarlaEngine::getDriverCount(); | |||
@@ -525,17 +548,12 @@ const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device | |||
} | |||
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; | |||
@@ -556,6 +574,7 @@ bool carla_show_engine_device_control_panel() | |||
return gStandalone.engine->showDeviceControlPanel(); | |||
} | |||
#endif | |||
void carla_clear_engine_xruns() | |||
{ | |||
@@ -676,6 +695,15 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt | |||
gStandalone.engineOptions.audioTripleBuffer = (value != 0); | |||
break; | |||
case CB::ENGINE_OPTION_AUDIO_DRIVER: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,); | |||
if (gStandalone.engineOptions.audioDriver != nullptr) | |||
delete[] gStandalone.engineOptions.audioDriver; | |||
gStandalone.engineOptions.audioDriver = carla_strdup_safe(valueStr); | |||
break; | |||
case CB::ENGINE_OPTION_AUDIO_DEVICE: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,); | |||
@@ -1604,6 +1604,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch | |||
{ | |||
case ENGINE_OPTION_PROCESS_MODE: | |||
case ENGINE_OPTION_AUDIO_TRIPLE_BUFFER: | |||
case ENGINE_OPTION_AUDIO_DRIVER: | |||
case ENGINE_OPTION_AUDIO_DEVICE: | |||
return carla_stderr("CarlaEngine::setOption(%i:%s, %i, \"%s\") - Cannot set this option while engine is running!", | |||
option, EngineOption2Str(option), value, valueStr); | |||
@@ -1696,6 +1697,15 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch | |||
pData->options.audioTripleBuffer = (value != 0); | |||
break; | |||
case ENGINE_OPTION_AUDIO_DRIVER: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,); | |||
if (pData->options.audioDriver != nullptr) | |||
delete[] pData->options.audioDriver; | |||
pData->options.audioDriver = carla_strdup_safe(valueStr); | |||
break; | |||
case ENGINE_OPTION_AUDIO_DEVICE: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,); | |||
@@ -197,6 +197,7 @@ EngineOptions::EngineOptions() noexcept | |||
audioBufferSize(512), | |||
audioSampleRate(44100), | |||
audioTripleBuffer(false), | |||
audioDriver(nullptr), | |||
audioDevice(nullptr), | |||
#ifndef BUILD_BRIDGE | |||
# ifdef CARLA_OS_WIN | |||
@@ -226,6 +227,12 @@ EngineOptions::EngineOptions() noexcept | |||
EngineOptions::~EngineOptions() noexcept | |||
{ | |||
if (audioDriver != nullptr) | |||
{ | |||
delete[] audioDriver; | |||
audioDriver = nullptr; | |||
} | |||
if (audioDevice != nullptr) | |||
{ | |||
delete[] audioDevice; | |||
@@ -3000,6 +3000,7 @@ int jack_initialize(jack_client_t* const client, const char* const load_init) | |||
CarlaEngineJack* const engine = new CarlaEngineJack(); | |||
engine->setOption(ENGINE_OPTION_FORCE_STEREO, 1, nullptr); | |||
engine->setOption(ENGINE_OPTION_AUDIO_DRIVER, 0, "JACK"); | |||
engine->setOption(ENGINE_OPTION_AUDIO_DEVICE, 0, "Auto-Connect ON"); | |||
engine->setOption(ENGINE_OPTION_OSC_ENABLED, 1, nullptr); | |||
engine->setOption(ENGINE_OPTION_OSC_PORT_TCP, 22752, nullptr); | |||
@@ -861,71 +861,75 @@ ENGINE_OPTION_AUDIO_SAMPLE_RATE = 10 | |||
# Default is false. | |||
ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11 | |||
# Audio driver. | |||
# Default dppends on platform. | |||
ENGINE_OPTION_AUDIO_DRIVER = 12 | |||
# Audio device (within a driver). | |||
# Default unset. | |||
ENGINE_OPTION_AUDIO_DEVICE = 12 | |||
ENGINE_OPTION_AUDIO_DEVICE = 13 | |||
# Wherever to enable OSC support in the engine. | |||
ENGINE_OPTION_OSC_ENABLED = 13 | |||
ENGINE_OPTION_OSC_ENABLED = 14 | |||
# The network TCP port to use for OSC. | |||
# A value of 0 means use a random port. | |||
# A value of < 0 means to not enable the TCP port for OSC. | |||
# @note Valid ports begin at 1024 and end at 32767 (inclusive) | |||
ENGINE_OPTION_OSC_PORT_TCP = 14 | |||
ENGINE_OPTION_OSC_PORT_TCP = 15 | |||
# The network UDP port to use for OSC. | |||
# A value of 0 means use a random port. | |||
# A value of < 0 means to not enable the UDP port for OSC. | |||
# @note Disabling this option prevents DSSI UIs from working! | |||
# @note Valid ports begin at 1024 and end at 32767 (inclusive) | |||
ENGINE_OPTION_OSC_PORT_UDP = 15 | |||
ENGINE_OPTION_OSC_PORT_UDP = 16 | |||
# Set path used for a specific plugin type. | |||
# Uses value as the plugin format, valueStr as actual path. | |||
# @see PluginType | |||
ENGINE_OPTION_PLUGIN_PATH = 16 | |||
ENGINE_OPTION_PLUGIN_PATH = 17 | |||
# Set path to the binary files. | |||
# Default unset. | |||
# @note Must be set for plugin and UI bridges to work | |||
ENGINE_OPTION_PATH_BINARIES = 17 | |||
ENGINE_OPTION_PATH_BINARIES = 18 | |||
# Set path to the resource files. | |||
# Default unset. | |||
# @note Must be set for some internal plugins to work | |||
ENGINE_OPTION_PATH_RESOURCES = 18 | |||
ENGINE_OPTION_PATH_RESOURCES = 19 | |||
# Prevent bad plugin and UI behaviour. | |||
# @note: Linux only | |||
ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 19 | |||
ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 20 | |||
# Set UI scaling used in frontend, so backend can do the same for plugin UIs. | |||
ENGINE_OPTION_FRONTEND_UI_SCALE = 20 | |||
ENGINE_OPTION_FRONTEND_UI_SCALE = 21 | |||
# Set frontend winId, used to define as parent window for plugin UIs. | |||
ENGINE_OPTION_FRONTEND_WIN_ID = 21 | |||
ENGINE_OPTION_FRONTEND_WIN_ID = 22 | |||
# Set path to wine executable. | |||
ENGINE_OPTION_WINE_EXECUTABLE = 22 | |||
ENGINE_OPTION_WINE_EXECUTABLE = 23 | |||
# Enable automatic wineprefix detection. | |||
ENGINE_OPTION_WINE_AUTO_PREFIX = 23 | |||
ENGINE_OPTION_WINE_AUTO_PREFIX = 24 | |||
# Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set. | |||
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 24 | |||
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 25 | |||
# Enable realtime priority for Wine application and server threads. | |||
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 25 | |||
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 26 | |||
# Base realtime priority for Wine threads. | |||
ENGINE_OPTION_WINE_BASE_RT_PRIO = 26 | |||
ENGINE_OPTION_WINE_BASE_RT_PRIO = 27 | |||
# Wine server realtime priority. | |||
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 27 | |||
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 28 | |||
# Capture console output into debug callbacks | |||
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 28 | |||
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 29 | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Engine Process Mode | |||
@@ -876,12 +876,14 @@ class HostWindow(QMainWindow): | |||
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 | |||
audioDevice, bufferSize, sampleRate = dialog.getValues() | |||
bufferSize, sampleRate = dialog.getValues() | |||
self.host.set_engine_buffer_size_and_sample_rate(bufferSize, sampleRate) | |||
if self.host.is_engine_running(): | |||
self.host.set_engine_buffer_size_and_sample_rate(bufferSize, sampleRate) | |||
else: | |||
self.host.set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice) | |||
self.host.set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, bufferSize, "") | |||
self.host.set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, sampleRate, "") | |||
@pyqtSlot() | |||
def slot_engineStopTryAgain(self): | |||
@@ -3198,6 +3200,7 @@ def setEngineSettings(host): | |||
# Only setup audio things if engine is not running | |||
if not host.is_engine_running(): | |||
host.set_engine_option(ENGINE_OPTION_AUDIO_DRIVER, 0, audioDriver) | |||
host.set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice) | |||
if not audioDriver.startswith("JACK"): | |||
@@ -219,7 +219,6 @@ class RuntimeDriverSettingsW(QDialog): | |||
# ---------------------------------------------------------------------------------------------------- | |||
# Set-up GUI | |||
self.ui.cb_device.setEnabled(False) | |||
self.ui.cb_device.clear() | |||
self.ui.cb_buffersize.clear() | |||
self.ui.cb_samplerate.clear() | |||
@@ -227,15 +226,30 @@ class RuntimeDriverSettingsW(QDialog): | |||
self.ui.ico_restart.hide() | |||
self.ui.label_restart.hide() | |||
self.ui.layout_triple_buffer.takeAt(2) | |||
self.ui.layout_triple_buffer.takeAt(1) | |||
self.ui.layout_triple_buffer.takeAt(0) | |||
self.ui.verticalLayout.removeItem(self.ui.layout_triple_buffer) | |||
self.ui.layout_restart.takeAt(3) | |||
self.ui.layout_restart.takeAt(2) | |||
self.ui.layout_restart.takeAt(1) | |||
self.ui.layout_restart.takeAt(0) | |||
self.ui.verticalLayout.removeItem(self.ui.layout_restart) | |||
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 host.is_engine_running(): | |||
self.ui.cb_device.addItem(driverDeviceInfo['name']) | |||
self.ui.cb_device.setCurrentIndex(0) | |||
self.ui.cb_device.setEnabled(False) | |||
else: | |||
self.ui.cb_device.addItem(driverDeviceInfo['name']) | |||
self.ui.cb_device.setCurrentIndex(0) | |||
if len(driverDeviceInfo['bufferSizes']) > 0: | |||
for bsize in driverDeviceInfo['bufferSizes']: | |||
@@ -278,15 +292,16 @@ class RuntimeDriverSettingsW(QDialog): | |||
# -------------------------------------------------------------------------------------------------------- | |||
def getValues(self): | |||
bufferSize = self.ui.cb_buffersize.currentText() | |||
sampleRate = self.ui.cb_samplerate.currentText() | |||
audioDevice = self.ui.cb_buffersize.currentText() | |||
bufferSize = self.ui.cb_buffersize.currentText() | |||
sampleRate = self.ui.cb_samplerate.currentText() | |||
if bufferSize == DriverSettingsW.AUTOMATIC_OPTION: | |||
bufferSize = "0" | |||
if sampleRate == DriverSettingsW.AUTOMATIC_OPTION: | |||
sampleRate = "0" | |||
return (int(bufferSize), int(sampleRate)) | |||
return (audioDevice, int(bufferSize), int(sampleRate)) | |||
# -------------------------------------------------------------------------------------------------------- | |||
@@ -327,6 +327,8 @@ const char* EngineOption2Str(const EngineOption option) noexcept | |||
return "ENGINE_OPTION_AUDIO_SAMPLE_RATE"; | |||
case ENGINE_OPTION_AUDIO_TRIPLE_BUFFER: | |||
return "ENGINE_OPTION_AUDIO_TRIPLE_BUFFER"; | |||
case ENGINE_OPTION_AUDIO_DRIVER: | |||
return "ENGINE_OPTION_AUDIO_DRIVER"; | |||
case ENGINE_OPTION_AUDIO_DEVICE: | |||
return "ENGINE_OPTION_AUDIO_DEVICE"; | |||
case ENGINE_OPTION_OSC_ENABLED: | |||