Browse Source

Show driver options for jack, "(auto)" as rate/size choices

tags/v1.9.11
falkTX FilipeCSnuk 6 years ago
parent
commit
fe8276f03d
3 changed files with 45 additions and 31 deletions
  1. +2
    -3
      source/backend/engine/CarlaEngine.cpp
  2. +5
    -3
      source/carla_host.py
  3. +38
    -25
      source/carla_settings.py

+ 2
- 3
source/backend/engine/CarlaEngine.cpp View File

@@ -118,7 +118,7 @@ const char* const* CarlaEngine::getDriverDeviceNames(const uint index2)

if (jackbridge_is_ok() && index-- == 0)
{
static const char* ret[3] = { "Auto-Connect OFF", "Auto-Connect ON", nullptr };
static const char* ret[3] = { "Auto-Connect ON", "Auto-Connect OFF", nullptr };
return ret;
}

@@ -142,10 +142,9 @@ const EngineDriverDeviceInfo* CarlaEngine::getDriverDeviceInfo(const uint index2

if (jackbridge_is_ok() && index-- == 0)
{
static uint32_t bufSizes[11] = { 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 0 };
static EngineDriverDeviceInfo devInfo;
devInfo.hints = ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE;
devInfo.bufferSizes = bufSizes;
devInfo.bufferSizes = nullptr;
devInfo.sampleRates = nullptr;
return &devInfo;
}


+ 5
- 3
source/carla_host.py View File

@@ -2868,9 +2868,11 @@ 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_DEVICE, 0, audioDevice)
host.set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "")
host.set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "")
host.set_engine_option(ENGINE_OPTION_AUDIO_TRIPLE_BUFFER, audioTripleBuffer, "")

if not audioDriver.startswith("JACK"):
host.set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "")
host.set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "")
host.set_engine_option(ENGINE_OPTION_AUDIO_TRIPLE_BUFFER, audioTripleBuffer, "")

# --------------------------------------------------------------------------------------------------------
# fix things if needed


+ 38
- 25
source/carla_settings.py View File

@@ -52,6 +52,8 @@ SAMPLE_RATE_LIST = (22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
# Driver Settings

class DriverSettingsW(QDialog):
AUTOMATIC_OPTION = "(Auto)"

def __init__(self, parent, host, driverIndex, driverName):
QDialog.__init__(self, parent)
self.host = host
@@ -130,9 +132,17 @@ class DriverSettingsW(QDialog):
def slot_saveSettings(self):
settings = QSettings("falkTX", "Carla2")

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"

settings.setValue("%s%s/Device" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), self.ui.cb_device.currentText())
settings.setValue("%s%s/BufferSize" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), self.ui.cb_buffersize.currentText())
settings.setValue("%s%s/SampleRate" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), self.ui.cb_samplerate.currentText())
settings.setValue("%s%s/BufferSize" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), bufferSize)
settings.setValue("%s%s/SampleRate" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), sampleRate)
settings.setValue("%s%s/TripleBuffer" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), self.ui.cb_triple_buffer.isChecked())

# --------------------------------------------------------------------------------------------------------
@@ -147,34 +157,39 @@ class DriverSettingsW(QDialog):
self.ui.cb_buffersize.clear()
self.ui.cb_samplerate.clear()

if deviceName:
driverDeviceInfo = self.host.get_engine_driver_device_info(self.fDriverIndex, deviceName)
driverDeviceHints = driverDeviceInfo['hints']
self.fBufferSizes = driverDeviceInfo['bufferSizes']
self.fSampleRates = driverDeviceInfo['sampleRates']
else:
driverDeviceHints = 0x0
self.fBufferSizes = BUFFER_SIZE_LIST
self.fSampleRates = SAMPLE_RATE_LIST
driverDeviceInfo = self.host.get_engine_driver_device_info(self.fDriverIndex, deviceName)
driverDeviceHints = driverDeviceInfo['hints']
self.fBufferSizes = driverDeviceInfo['bufferSizes']
self.fSampleRates = driverDeviceInfo['sampleRates']

if driverDeviceHints & ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER:
self.ui.cb_triple_buffer.setEnabled(True)
else:
self.ui.cb_triple_buffer.setEnabled(False)

for bsize in self.fBufferSizes:
sbsize = str(bsize)
self.ui.cb_buffersize.addItem(sbsize)
if len(self.fBufferSizes) > 0:
for bsize in self.fBufferSizes:
sbsize = str(bsize)
self.ui.cb_buffersize.addItem(sbsize)

if oldBufferSize == sbsize:
self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)

if oldBufferSize == sbsize:
self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
else:
self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION)
self.ui.cb_buffersize.setCurrentIndex(0)

for srate in self.fSampleRates:
ssrate = str(int(srate))
self.ui.cb_samplerate.addItem(ssrate)
if len(self.fSampleRates) > 0:
for srate in self.fSampleRates:
ssrate = str(int(srate))
self.ui.cb_samplerate.addItem(ssrate)

if oldSampleRate == ssrate:
self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
if oldSampleRate == ssrate:
self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)

else:
self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION)
self.ui.cb_samplerate.setCurrentIndex(0)

# --------------------------------------------------------------------------------------------------------

@@ -402,10 +417,10 @@ class CarlaSettingsW(QDialog):

if audioDriver == "JACK":
self.ui.sw_engine_process_mode.setCurrentIndex(0)
self.ui.tb_engine_driver_config.setEnabled(False)
else:
self.ui.sw_engine_process_mode.setCurrentIndex(1)
self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)

self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)

self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)

@@ -853,10 +868,8 @@ class CarlaSettingsW(QDialog):
def slot_engineAudioDriverChanged(self):
if self.ui.cb_engine_audio_driver.currentText() == "JACK":
self.ui.sw_engine_process_mode.setCurrentIndex(0)
self.ui.tb_engine_driver_config.setEnabled(False)
else:
self.ui.sw_engine_process_mode.setCurrentIndex(1)
self.ui.tb_engine_driver_config.setEnabled(True)

@pyqtSlot()
def slot_showAudioDriverSettings(self):


Loading…
Cancel
Save