mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-24 14:20:19 +01:00
Temporary workaround to provide (only) WASAPI loopback input devices.
This commit is contained in:
@@ -263,6 +263,16 @@ int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, Pa
|
||||
int/*PaWasapiDeviceRole*/ PaWasapi_GetDeviceRole( PaDeviceIndex nDevice );
|
||||
|
||||
|
||||
/** Returns device loopback indicator.
|
||||
|
||||
@param nDevice device index.
|
||||
|
||||
@return 0 = Not loopback, 1 = loopback, < 0 = PaErrorCode
|
||||
if PortAudio is not initialized or an error is encountered.
|
||||
*/
|
||||
int PaWasapi_IsLoopback( PaDeviceIndex nDevice );
|
||||
|
||||
|
||||
/** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
|
||||
which makes calls to Pa_WriteStream/Pa_ReadStream.
|
||||
|
||||
|
||||
@@ -357,6 +357,9 @@ typedef struct PaWasapiDeviceInfo
|
||||
|
||||
// Formfactor
|
||||
EndpointFormFactor formFactor;
|
||||
|
||||
// Loopback indicator
|
||||
int loopBack;
|
||||
}
|
||||
PaWasapiDeviceInfo;
|
||||
|
||||
@@ -1403,6 +1406,8 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
|
||||
memcpy(&paWasapi->devInfo[i + 1], &paWasapi->devInfo[i], sizeof(*paWasapi->devInfo));
|
||||
|
||||
i++;
|
||||
paWasapi->devInfo[i].loopBack = 1;
|
||||
|
||||
deviceInfo = &deviceInfoArray[i];
|
||||
|
||||
deviceInfo->maxInputChannels = deviceInfo->maxOutputChannels;
|
||||
@@ -1579,6 +1584,29 @@ int PaWasapi_GetDeviceRole( PaDeviceIndex nDevice )
|
||||
return paWasapi->devInfo[ index ].formFactor;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
int PaWasapi_IsLoopback( PaDeviceIndex nDevice )
|
||||
{
|
||||
PaError ret;
|
||||
PaDeviceIndex index;
|
||||
|
||||
// Get API
|
||||
PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
|
||||
if (paWasapi == NULL)
|
||||
return paNotInitialized;
|
||||
|
||||
// Get device index
|
||||
ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
|
||||
if (ret != paNoError)
|
||||
return ret;
|
||||
|
||||
// Validate index
|
||||
if ((UINT32)index >= paWasapi->deviceCount)
|
||||
return paInvalidDevice;
|
||||
|
||||
return paWasapi->devInfo[ index ].loopBack;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user