How to manage 4 channel audio (IQ data) with the AudioDeviceManager

Hi I need to manage and modify a 4 channel audio stream. I can do this with portaudio and a console app, but cannot see how to do it with the Juce GUI device manager. It seem limited to input 2 channels despite the MAX being 256. (probably a windows thing). The input and output is via Virtual cables. Looks like WDM_KS is my best option but not available with the Juce Device manager. I have seen questions requesting how to add portaudio to Juce, but these seem to get kicked back with "why use Portaudio, when the Juce device manager is so good. (it is but does not seem to be able to do what I need. I may be missing something obvious. The solution I needs be a windows solution, as the software it will drive is only available on windows. BTW I have not been able to get ASIO to work without screwing up the PC and VB cables installations. Any guidance would be very welcome.

The AudioDeviceManager and the AudioDeviceSelectorComponent have options when initing them that determine how many channels you are going to have available. If you have put for example just 2 input and output channels into those calls, that’s what you are going to get, even if your audio device supports more channels.

1 Like

Hi Thanks for the reply. I am sure I have tried that and had no success. I have another look. Even Portaudio will not give more than 2 channels with MME and WASAPI. Only with WDM_KS could I get more. I am on a windows system and this may be the limiting issue. Worth another look though.

You may need to use ASIO, then. Juce does not support the WDM_KS sound system. To get ASIO working with Juce, you will need to get the needed Steinberg ASIO header files, due to licensing reasons Juce can not have those in its own code.

If you really want something like an app where the GUI is Juce based and the audio is handled by PortAudio, I don’t see any particular problem that would prevent doing that. Juce doesn’t reserve the audio devices by default.

1 Like

Hi . I have been down that route. Trying to avoid it as when I tried before ASIO screwed up the virtual cable software and I had to go back to a previous backup to recover.
I tried ASIO4all and also FlexASIO. I seem to remember when I had ASIO installed I was not able to select different VB cables with it. I will try it again. (after a full PC BU). I really need a low latency solution as I am comparing and changing the phase between the four channels. Its frustrating as the console portaudio app does some of what I want, but is not very easy to use and does not give me the audio graphics I want (eg lissajous display) regards Gary

BTW I have portaudio working in a fashion with Juce, but have got an issue that if I enable the PA callback, when PA returns to the GUI, the GUI crashes. If I enable the callback function, but dont actually do any thing in it, the GUI is OK. There is a BUG with my code and I haven’t been able to find it yet. I was hoping someone would say Here I have PA working with Juce. Just use this code. There a few apps out there using Juce and PA, but they are use old versions of Juce, and updating them would take longer than starting from scratch ( I think)

It’s very hard to say what is going on without more details.

But are you doing something like accessing the Juce GUI functions directly from the PortAudio callback? That is not allowed, not even when using Juce for both the GUI and audio. The GUI system has been designed to only be used from the main thread. If the audio callback/thread has to cause things to happen in the GUI, that needs to be done indirectly.

Its more the other way round. Selecting/changing an audio device in the juce menu, needs to enable the pa stream. I see others have used a button in Juce to start and stop the stream. Maybe I cannot do it from menu.onchange
the line of code I an using is styleMenu.onChange = [this] { styleMenuChanged(); };
and the function to stop the current stream and start a new one with the newly selected device is in styleMenuChanged(). I will look at how others have done this properly. I appreciate your time.

Cracked it. I had a while loop is the streaming callback that worked out if the input was interleaved and if so how many channels. Do not need to do that in the callback, so removed it and no more crashes. Thanks for help.