Browse Source

Enable WASAPI for windows builds

tags/v2.1-rc1
falkTX 6 years ago
parent
commit
3daaad68a1
4 changed files with 24 additions and 7 deletions
  1. +2
    -0
      source/backend/engine/CarlaEngine.cpp
  2. +14
    -1
      source/backend/engine/CarlaEngineJuce.cpp
  3. +5
    -1
      source/modules/AppConfig.h
  4. +3
    -5
      source/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp

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

@@ -227,6 +227,8 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName)
return newJuce(AUDIO_API_ASIO);
if (std::strcmp(driverName, "DirectSound") == 0)
return newJuce(AUDIO_API_DIRECTSOUND);
if (std::strcmp(driverName, "WASAPI") == 0 || std::strcmp(driverName, "Windows Audio") == 0)
return newJuce(AUDIO_API_WASAPI);
# else
// -------------------------------------------------------------------
// common


+ 14
- 1
source/backend/engine/CarlaEngineJuce.cpp View File

@@ -88,6 +88,14 @@ struct JuceCleanup : public juce::DeletedAtShutdown {
// -------------------------------------------------------------------------------------------------------------------
// Cleanup

struct AudioIODeviceTypeComparator
{
static int compareElements (const juce::AudioIODeviceType* d1, const juce::AudioIODeviceType* d2) noexcept
{
return d1->getTypeName().compareNatural (d2->getTypeName());
}
};

static void initJuceDevicesIfNeeded()
{
static juce::AudioDeviceManager sDeviceManager;
@@ -110,6 +118,9 @@ static void initJuceDevicesIfNeeded()
break;
}
}

AudioIODeviceTypeComparator comp;
gDeviceTypes.sort(comp);
}

// -------------------------------------------------------------------------------------------------------------------
@@ -831,7 +842,6 @@ CarlaEngine* CarlaEngine::newJuce(const AudioApi api)
case AUDIO_API_NULL:
case AUDIO_API_OSS:
case AUDIO_API_PULSEAUDIO:
case AUDIO_API_WASAPI:
break;
case AUDIO_API_JACK:
juceApi = "JACK";
@@ -848,6 +858,9 @@ CarlaEngine* CarlaEngine::newJuce(const AudioApi api)
case AUDIO_API_DIRECTSOUND:
juceApi = "DirectSound";
break;
case AUDIO_API_WASAPI:
juceApi = "Windows Audio";
break;
}

if (juceApi.isEmpty())


+ 5
- 1
source/modules/AppConfig.h View File

@@ -115,7 +115,11 @@
/** Config: JUCE_WASAPI
Enables WASAPI audio devices (Windows Vista and above).
*/
#define JUCE_WASAPI 0
#if defined(APPCONFIG_OS_WIN) && !defined(BUILDING_CARLA_NOOPT)
#define JUCE_WASAPI 1
#else
#define JUCE_WASAPI 0
#endif
/** Config: JUCE_DIRECTSOUND
Enables DirectSound audio (MS Windows only).


+ 3
- 5
source/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp View File

@@ -994,8 +994,8 @@ public:
isStarted (false),
currentBufferSizeSamples (0),
currentSampleRate (0),
callback (nullptr),
deviceBecameInactive (false)
deviceBecameInactive (false),
callback (nullptr)
{
}
@@ -1716,9 +1716,7 @@ AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_WASAPI (bool exclu
return nullptr;
#endif
return SystemStats::getOperatingSystemType() >= SystemStats::WinVista
? new WasapiClasses::WASAPIAudioIODeviceType (exclusiveMode)
: nullptr;
return new WasapiClasses::WASAPIAudioIODeviceType (exclusiveMode);
}
//==============================================================================


Loading…
Cancel
Save