setAudioDeviceSetup

Hi Jules!

I’ve been trying to get my app working nicely through the Juce Audio Manager on Mac, and seeing some unexpected behaviour. Maybe you can help!

Basically, it seems that wrt the juce_AudioManager class instance I first need to call initialise(), and then subsequently call setAudioDeviceSetup() to get my device running at the rate I want with the block size and channels I want; I can’t seem to avoid that second call.

Anyways, this results in the underlying core audio device stopping/starting automatically under the hood twice (this happens every time that initialise or setAudioDeviceSetup is called), leading to delays at the start and some odd clicks and pops. It’d be nice to be able to avoid that call to setAudioDeviceSetup …

Additionally, I’d like to be able to totally delay the device from starting at all until some later point when I call a “start” method on the manager. I really don’t want to see those callbacks until I’m ready… I can’t quite figure-out how to do that with the API as it currently stands…

I guess that to have the app do what I want, I could drop down myself to Core Audio, but I dare say this is just down to my missing-out on some information somewhere in the Juce audio manager API. :slight_smile:

With best wishes,

Pete

I guess I designed it to work well for the way I normally use it - where you pass some XML state to the initialise(), and it uses that to set everything up.

But I guess it would be inefficient if you’re setting up the state programmatically. Looking at it again, I suppose what it should do the initialise() should take an (optional) AudioDeviceSetup instead of a default device name, so that if no XML is specified, it’d open your preferred config straight away…

Hi Jules,

Perhaps the easiest thing would be to add a method to AudioDeviceSetup, that would return an XML element which could be passed straight to the existing initialise() method?

FWIW, I tried constructing the state with XML, and not then calling setAudioDeviceSetup, but that didn’t fully set-up the device (I still had to call setAudioDeviceSetup…). I wonder if this is because my XML specifed the block size and sample rate, but didn’t specify the device to use. I’ll try again later today, keeping an eye on the debugger; this time specifying the device to use in the XML.

Many thanks as always, and full kudos for creating the amazing Juce. :slight_smile:

Pete

Ta. Well, I’d rather keep the XML as just a blob that you don’t have to look inside of, so best not to try doing it from that. It shouldn’t be hard to tweak the initialise method like I suggested - I’ll do it if I get a moment.

Nice one, Jules. :slight_smile: