| @@ -227,6 +227,8 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName) | |||||
| return newJuce(AUDIO_API_ASIO); | return newJuce(AUDIO_API_ASIO); | ||||
| if (std::strcmp(driverName, "DirectSound") == 0) | if (std::strcmp(driverName, "DirectSound") == 0) | ||||
| return newJuce(AUDIO_API_DIRECTSOUND); | return newJuce(AUDIO_API_DIRECTSOUND); | ||||
| if (std::strcmp(driverName, "WASAPI") == 0 || std::strcmp(driverName, "Windows Audio") == 0) | |||||
| return newJuce(AUDIO_API_WASAPI); | |||||
| # else | # else | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // common | // common | ||||
| @@ -88,6 +88,14 @@ struct JuceCleanup : public juce::DeletedAtShutdown { | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| // Cleanup | // 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 void initJuceDevicesIfNeeded() | ||||
| { | { | ||||
| static juce::AudioDeviceManager sDeviceManager; | static juce::AudioDeviceManager sDeviceManager; | ||||
| @@ -110,6 +118,9 @@ static void initJuceDevicesIfNeeded() | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| AudioIODeviceTypeComparator comp; | |||||
| gDeviceTypes.sort(comp); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -831,7 +842,6 @@ CarlaEngine* CarlaEngine::newJuce(const AudioApi api) | |||||
| case AUDIO_API_NULL: | case AUDIO_API_NULL: | ||||
| case AUDIO_API_OSS: | case AUDIO_API_OSS: | ||||
| case AUDIO_API_PULSEAUDIO: | case AUDIO_API_PULSEAUDIO: | ||||
| case AUDIO_API_WASAPI: | |||||
| break; | break; | ||||
| case AUDIO_API_JACK: | case AUDIO_API_JACK: | ||||
| juceApi = "JACK"; | juceApi = "JACK"; | ||||
| @@ -848,6 +858,9 @@ CarlaEngine* CarlaEngine::newJuce(const AudioApi api) | |||||
| case AUDIO_API_DIRECTSOUND: | case AUDIO_API_DIRECTSOUND: | ||||
| juceApi = "DirectSound"; | juceApi = "DirectSound"; | ||||
| break; | break; | ||||
| case AUDIO_API_WASAPI: | |||||
| juceApi = "Windows Audio"; | |||||
| break; | |||||
| } | } | ||||
| if (juceApi.isEmpty()) | if (juceApi.isEmpty()) | ||||
| @@ -115,7 +115,11 @@ | |||||
| /** Config: JUCE_WASAPI | /** Config: JUCE_WASAPI | ||||
| Enables WASAPI audio devices (Windows Vista and above). | 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 | /** Config: JUCE_DIRECTSOUND | ||||
| Enables DirectSound audio (MS Windows only). | Enables DirectSound audio (MS Windows only). | ||||
| @@ -994,8 +994,8 @@ public: | |||||
| isStarted (false), | isStarted (false), | ||||
| currentBufferSizeSamples (0), | currentBufferSizeSamples (0), | ||||
| currentSampleRate (0), | currentSampleRate (0), | ||||
| callback (nullptr), | |||||
| deviceBecameInactive (false) | |||||
| deviceBecameInactive (false), | |||||
| callback (nullptr) | |||||
| { | { | ||||
| } | } | ||||
| @@ -1716,9 +1716,7 @@ AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_WASAPI (bool exclu | |||||
| return nullptr; | return nullptr; | ||||
| #endif | #endif | ||||
| return SystemStats::getOperatingSystemType() >= SystemStats::WinVista | |||||
| ? new WasapiClasses::WASAPIAudioIODeviceType (exclusiveMode) | |||||
| : nullptr; | |||||
| return new WasapiClasses::WASAPIAudioIODeviceType (exclusiveMode); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||