Browse Source

Use driver name in engine code

tags/1.9.4
falkTX 11 years ago
parent
commit
9c154079e0
4 changed files with 33 additions and 9 deletions
  1. +1
    -1
      resources/ui/carla_settings_driver.ui
  2. +29
    -5
      source/backend/engine/CarlaEngineRtAudio.cpp
  3. +2
    -2
      source/backend/standalone/CarlaStandalone.cpp
  4. +1
    -1
      source/carla.py

+ 1
- 1
resources/ui/carla_settings_driver.ui View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>262</width>
<width>310</width>
<height>136</height>
</rect>
</property>


+ 29
- 5
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -149,13 +149,37 @@ public:

fBufferSize = fOptions.rtaudioBufferSize;

carla_stdout("Open RtAudio with device \"%s\"", (const char*)fOptions.rtaudioDevice);

// Audio
{
RtAudio::StreamParameters iParams, oParams;
iParams.deviceId = fAudio.getDefaultInputDevice();
oParams.deviceId = fAudio.getDefaultOutputDevice();
iParams.nChannels = 2;
oParams.nChannels = 2;
iParams.nChannels = 2; // todo
oParams.nChannels = 2; // todo

bool deviceSet = false;

if (fOptions.rtaudioDevice.isNotEmpty())
{
for (unsigned int i=0, count=fAudio.getDeviceCount(); i < count; ++i)
{
RtAudio::DeviceInfo devInfo(fAudio.getDeviceInfo(i));

if (devInfo.probed && devInfo.outputChannels > 0 && devInfo.name == (const char*)fOptions.rtaudioDevice)
{
deviceSet = true;
iParams.deviceId = i;
oParams.deviceId = i;
break;
}
}
}

if (! deviceSet)
{
iParams.deviceId = fAudio.getDefaultInputDevice();
oParams.deviceId = fAudio.getDefaultOutputDevice();
}

RtAudio::StreamOptions rtOptions;
rtOptions.flags = RTAUDIO_MINIMIZE_LATENCY | RTAUDIO_HOG_DEVICE | RTAUDIO_SCHEDULE_REALTIME;
@@ -168,7 +192,7 @@ public:
rtOptions.flags |= RTAUDIO_NONINTERLEAVED;
fAudioIsInterleaved = false;

if (fAudio.getCurrentApi() == RtAudio::LINUX_ALSA)
if (fAudio.getCurrentApi() == RtAudio::LINUX_ALSA && ! deviceSet)
rtOptions.flags |= RTAUDIO_ALSA_USE_DEFAULT;
}
else


+ 2
- 2
source/backend/standalone/CarlaStandalone.cpp View File

@@ -712,14 +712,14 @@ void carla_set_engine_option(CarlaOptionsType option, int value, const char* val
#ifdef WANT_RTAUDIO
case CarlaBackend::OPTION_RTAUDIO_BUFFER_SIZE:
if (value <= 0)
return carla_stderr2("carla_set_engine_option(OPTION_PREFERRED_BUFFER_SIZE, %i, \"%s\") - invalid value", value, valueStr);
return carla_stderr2("carla_set_engine_option(OPTION_RTAUDIO_BUFFER_SIZE, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.rtaudioBufferSize = static_cast<unsigned int>(value);
break;

case CarlaBackend::OPTION_RTAUDIO_SAMPLE_RATE:
if (value <= 0)
return carla_stderr2("carla_set_engine_option(OPTION_PREFERRED_SAMPLE_RATE, %i, \"%s\") - invalid value", value, valueStr);
return carla_stderr2("carla_set_engine_option(OPTION_RTAUDIO_SAMPLE_RATE, %i, \"%s\") - invalid value", value, valueStr);

standalone.options.rtaudioSampleRate = static_cast<unsigned int>(value);
break;


+ 1
- 1
source/carla.py View File

@@ -1093,7 +1093,7 @@ class CarlaMainW(QMainWindow):

Carla.host.set_engine_option(OPTION_RTAUDIO_BUFFER_SIZE, rtaudioBufferSize, "")
Carla.host.set_engine_option(OPTION_RTAUDIO_SAMPLE_RATE, rtaudioSampleRate, "")
Carla.host.set_engine_option(OPTION_RTAUDIO_SAMPLE_RATE, 0, rtaudioDevice)
Carla.host.set_engine_option(OPTION_RTAUDIO_DEVICE, 0, rtaudioDevice)

# ---------------------------------------------
# Start


Loading…
Cancel
Save