summaryrefslogtreecommitdiff
path: root/RtAudio.cpp
diff options
context:
space:
mode:
authorMarcus Tomlinson <themarcustomlinson@gmail.com>2018-11-02 16:01:49 +0000
committerMarcus Tomlinson <themarcustomlinson@gmail.com>2018-11-02 16:01:49 +0000
commit4e5d52a99bdf324c30ea8818b74696c45dac502d (patch)
treec32551646002c1e88683355402ce3b4972547f0c /RtAudio.cpp
parent6ee55842a5b094e63a991c1f249922232a476086 (diff)
Allow loopback without having to define output parameters
Diffstat (limited to 'RtAudio.cpp')
-rw-r--r--RtAudio.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index 34472d8..91e4f2c 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,12 @@ 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 )
+ {
+ return SUCCESS;
+ }
hr = renderDevices->Item( device, &devicePtr );
if ( FAILED( hr ) ) {