summaryrefslogtreecommitdiff
path: root/RtAudio.cpp
diff options
context:
space:
mode:
authorgaryscavone <garyscavone@users.noreply.github.com>2018-11-12 08:19:58 -0500
committerGitHub <noreply@github.com>2018-11-12 08:19:58 -0500
commit0757c50e3dbac57e3acac82e36554a896dca7e5f (patch)
tree64c5d2cf3cb661ee183ea6961010863376ffafc5 /RtAudio.cpp
parent6ee55842a5b094e63a991c1f249922232a476086 (diff)
parent05f5f4ae9e6a80b4a58119b8e0a80780317a417f (diff)
Merge pull request #165 from MarcusTomlinson/master
WASAPI : Allow loopback without output parameters
Diffstat (limited to 'RtAudio.cpp')
-rw-r--r--RtAudio.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index 34472d8..6b1ca06 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -4764,6 +4764,13 @@ bool RtApiWasapi::probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
// if device index falls within render devices and is configured for loopback
if ( device < renderDeviceCount && mode == INPUT )
{
+ // if renderAudioClient is not initialised, initialise it now
+ IAudioClient*& renderAudioClient = ( ( WasapiHandle* ) stream_.apiHandle )->renderAudioClient;
+ if ( !renderAudioClient )
+ {
+ probeDeviceOpen( device, OUTPUT, channels, firstChannel, sampleRate, format, bufferSize, options );
+ }
+
// retrieve captureAudioClient from devicePtr
IAudioClient*& captureAudioClient = ( ( WasapiHandle* ) stream_.apiHandle )->captureAudioClient;
@@ -4793,8 +4800,13 @@ bool RtApiWasapi::probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
// if device index falls within render devices and is configured for output
if ( device < renderDeviceCount && mode == OUTPUT )
{
- // retrieve renderAudioClient from devicePtr
+ // if renderAudioClient is already initialised, don't initialise it again
IAudioClient*& renderAudioClient = ( ( WasapiHandle* ) stream_.apiHandle )->renderAudioClient;
+ if ( renderAudioClient )
+ {
+ methodResult = SUCCESS;
+ goto Exit;
+ }
hr = renderDevices->Item( device, &devicePtr );
if ( FAILED( hr ) ) {