diff options
| author | JP Cimalando <jpcima@users.noreply.github.com> | 2018-05-13 14:14:04 +0200 |
|---|---|---|
| committer | JP Cimalando <jpcima@users.noreply.github.com> | 2018-05-13 14:14:04 +0200 |
| commit | 2f4e77da2a6e8eda6a174e067ffbb981e1acd142 (patch) | |
| tree | 3f7c412350b11caceeb4672fee99fc5cf03b09d4 /RtAudio.cpp | |
| parent | 4a7ca4f1d42fff04eb085d85a3b298df2c937a34 (diff) | |
make WASAPI instantiation errors non-fatal for older Windows
Diffstat (limited to 'RtAudio.cpp')
| -rw-r--r-- | RtAudio.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp index b091e15..34e3961 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -3899,10 +3899,9 @@ RtApiWasapi::RtApiWasapi() CLSCTX_ALL, __uuidof( IMMDeviceEnumerator ), ( void** ) &deviceEnumerator_ ); - if ( FAILED( hr ) ) { - errorText_ = "RtApiWasapi::RtApiWasapi: Unable to instantiate device enumerator"; - error( RtAudioError::DRIVER_ERROR ); - } + // If this runs on an old Windows, it will fail. Ignore and proceed. + if ( FAILED( hr ) ) + deviceEnumerator_ = NULL; } //----------------------------------------------------------------------------- @@ -3929,6 +3928,9 @@ unsigned int RtApiWasapi::getDeviceCount( void ) IMMDeviceCollection* captureDevices = NULL; IMMDeviceCollection* renderDevices = NULL; + if ( !deviceEnumerator_ ) + return 0; + // Count capture devices errorText_.clear(); HRESULT hr = deviceEnumerator_->EnumAudioEndpoints( eCapture, DEVICE_STATE_ACTIVE, &captureDevices ); |
