{\r
// WASAPI can run either apartment or multi-threaded\r
HRESULT hr = CoInitialize( NULL );\r
-\r
if ( !FAILED( hr ) )\r
coInitialized_ = true;\r
\r
\r
RtApiWasapi::~RtApiWasapi()\r
{\r
- // if this object previously called CoInitialize()\r
- if ( coInitialized_ ) {\r
- CoUninitialize();\r
- }\r
-\r
- if ( stream_.state != STREAM_CLOSED ) {\r
+ if ( stream_.state != STREAM_CLOSED )\r
closeStream();\r
- }\r
\r
SAFE_RELEASE( deviceEnumerator_ );\r
+\r
+ // If this object previously called CoInitialize()\r
+ if ( coInitialized_ )\r
+ CoUninitialize();\r
}\r
\r
//=============================================================================\r
CoTaskMemFree( captureFormat );\r
CoTaskMemFree( renderFormat );\r
\r
- //delete convBuffer;\r
free ( convBuffer );\r
\r
CoUninitialize();\r
// Set our stream parameters for input only.
bufferFrames = 512;
RtAudio::StreamParameters iParams;
- iParams.deviceId = device;
+ if ( device == 0 )
+ iParams.deviceId = adc.getDefaultInputDevice();
+ else
+ iParams.deviceId = device;
iParams.nChannels = channels;
iParams.firstChannel = offset;