# WASAPI loopback

**URL:** <https://forum.juce.com/t/wasapi-loopback/56361>\
**Category:** Windows\
**Created:** [May 24, 2023, 2:20am UTC](https://forum.juce.com/t/wasapi-loopback/56361 "2023-05-24T02:20:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/matt/32/18340_2.png) [@matt](https://forum.juce.com/u/matt)\
**Post date:** [May 24, 2023, 2:20am UTC](https://forum.juce.com/t/wasapi-loopback/56361/1 "2023-05-24T02:20:43Z")

</div>

I added support for WASAPI loopback recording ([https://learn.microsoft.com/en-us/windows/win32/coreaudio/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](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:

![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/3a7d253ad9ec289e14778c85354d5abcfbaf2336.png)

Or do this:

```auto
        // 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
