Getting my ASIO kicked


#1

After calling AudioDeviceManager::initialise with some non zero values for input and output channels, later on if I try to open a device but with no bits set in the input and output BigInteger, the device fails to open. For the case of ASIO specifically, it seems that bufferSwitch doesn’t get called if there are no channels, and Juce detects that there was no callback and considers it an error.

Even if Juce were to let it through (which works, when I skip that code in the debugger), my whole architecture assumes that when a device is opened that the I/O callback will get called and unfortunately this can’t change (too many benefits).

However, now I am implementing the “audio setup” dialog of my app, where you choose the output device and up to 6 device channels to map from my app output. When the user switches to a new device, the 6 channel ComboBoxes show “(none)” meaning unassigned, and Juce don’t like it when I open a device without any bits set for active input and output channels.

What should I do?


#2

[quote] Juce don’t like it when I open a device without any bits set for active input and output channels.

What should I do?[/quote]

Maybe you should just set some bits? I don’t think it’s unreasonable to expect you to actually have some input or output channels - if there are none, then what’s the point in bothering to open the device at all?


#3

[quote=“jules”][quote] Juce don’t like it when I open a device without any bits set for active input and output channels.

What should I do?[/quote]

Maybe you should just set some bits? I don’t think it’s unreasonable to expect you to actually have some input or output channels - if there are none, then what’s the point in bothering to open the device at all?[/quote]

Having no channels mapped for input and output is just a temporary state that exists because my UI for configuring the device first requires you to select the device, and then choose the channels. After the device is chosen, but before the channels are mapped, there is the condition where no bits are set.

As a hack, I set an output channel bit, but this has a side effect. If another program is playing audio, depending on which device is chosen, it will “steal” the channel from the running application.

The best solution for me is to have a guarantee that any device can be opened even with no input or output channels, and the callback will always get called. But that is non trivial. I’m considering “wrapping” each of the Juce audio device types with my own shell that enforces this behavior but even that would require some changes to Juce code, for example ASIO will have to handle the case where “calledback” is not set to true because no bits are set.

I get the feeling I am deep in uncharted waters…lots of people using Juce for writing plugins, but I wonder if anyone has really hammered the multi-channel audio device code, especially since you cant output more than one stereo stream under WASAPI or DirectSound…


#4

No, lots of people are using the audio i/o stuff, but I’d imagine that you’re the first person who’s tried opening a device without any input or output channels!