summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RtAudio.cpp14
-rw-r--r--tests/record.cpp5
2 files changed, 9 insertions, 10 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index 039b5d0..a31a54b 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -3850,7 +3850,6 @@ RtApiWasapi::RtApiWasapi()
{
// WASAPI can run either apartment or multi-threaded
HRESULT hr = CoInitialize( NULL );
-
if ( !FAILED( hr ) )
coInitialized_ = true;
@@ -3869,16 +3868,14 @@ RtApiWasapi::RtApiWasapi()
RtApiWasapi::~RtApiWasapi()
{
- // if this object previously called CoInitialize()
- if ( coInitialized_ ) {
- CoUninitialize();
- }
-
- if ( stream_.state != STREAM_CLOSED ) {
+ if ( stream_.state != STREAM_CLOSED )
closeStream();
- }
SAFE_RELEASE( deviceEnumerator_ );
+
+ // If this object previously called CoInitialize()
+ if ( coInitialized_ )
+ CoUninitialize();
}
//=============================================================================
@@ -5095,7 +5092,6 @@ Exit:
CoTaskMemFree( captureFormat );
CoTaskMemFree( renderFormat );
- //delete convBuffer;
free ( convBuffer );
CoUninitialize();
diff --git a/tests/record.cpp b/tests/record.cpp
index d16ea49..0e48f77 100644
--- a/tests/record.cpp
+++ b/tests/record.cpp
@@ -117,7 +117,10 @@ int main( int argc, char *argv[] )
// 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;