I added support for WASAPI loopback recording (https://learn.microsoft.com/en-us/windows/win32/coreaudio/loopback-recording.
To use it yourself, clone the direct2d branch of my JUCE fork: https://github.com/mattgonzalez/JUCE/tree/direct2d
If you’re using the AudioDeviceManager, set the output device to “<< none >>” and set the input to your desired output device:
Or do this:
// Loopback only works in shared mode
if (auto wasapiDeviceType = juce::AudioIODeviceType::createAudioIODeviceType_WASAPI(juce::WASAPIDeviceMode::shared))
{
wasapiDeviceType->scanForDevices();
if (auto outputDeviceNames = wasapiDeviceType->getDeviceNames(false /* wantInputNames */); outputDeviceNames.size() > 0)
{
juce::String inputName = outputDeviceNames[0];
std::unique_ptr<juce::AudioIODevice> device
{
wasapiDeviceType->createDevice({}, inputName)
};
if (device)
{
DBG("Opened " << device->getName() << " for WASAPI loopback recording");
}
}
}
Enjoy-
Matt