ofxPD and Audiobus

Im too out of touch with it at the moment unfortunately to be able to give much help here.
Here’s an example that might be useful, theres some different settings that get initialized depending on whether or not audio’s is being used
audiobus 2 of solution.zip (11.0 KB)

I was wrong. The Audiobus apps seem to change other audio app’s blocksize in general.

I could get the updated buffersize in (void)soundStreamRequested and (void)soundStreamReceived in ofxiOSSoundStreamDelegate.mm.

And I could check it updates to a new buffersize depending on other audiobus compatible app’s buffersize.(if other app is running).

By fixing the buffersize in the two functions, I could prevent my app from crashing at least but it seems that buffersize is still getting affected by other audiobus apps although I don’t even use audiobus API at all.

I think I’m going to try changing ofxPD’s blocksize dynamically depending on the updated buffersize. I would appreciate if anyone can give me any advice though.

That’s pretty much how you have to do it, unfortunately. I think you’ll probably have to reinit and reload your patches whenever this happens.

1 Like

@danomatika has one of your newest commits allowed reiniting/buffersize changes

Yes. It handles buffer size changes automatically now.

great so does that means audiobus integration is easier now?

Does anyone have a working example of Audiobus working with the newest oF?
I’m looking to get an app working with audiobus in and out with PD

Thanks

hey,

after trying on and off for a few months to get audiobus and iia to work with my of app I finally found a solution, thanks to the ABiOSSoundStream class and custom appDelegate from this thread. I made a few changes and created a basic template project file on github:

You should be able to compile this, but you might need to change the audiobus api key, and rename the AudioComponents in the info.plist.

My app works now well with iaa, tested with garageband, but has some issues still with the audiobus app. Like audio freezing when launching it from within the AB app and adding it to some FX app. I have the same issue with Nodebeat too, I think something is changing the audiounits, or it has something todo with going to background or so. But once connected it works ok.

I think this should run with any audio addon. I used a custom class with ofThread to get access to the ofApp while in background mode (ofApp-update and events seem to pause in background on ios). If you use a control chain with PureData something that already runs in its own thread you might go without it.

update: hm I forgot that in this template ofApp->setup gets called 2x. In my app I used a bool inside setup to not create multiple soundstream instances. Somehow this seems to fix the audiobus issues :thinking:

3 Likes

Hi, @Gwio Thanks for your work. I’ve always wanted something like this :slight_smile:

Do you know that running audiobus apps in the background can dynamically change your app’s sample rate or buffer size? This case, ofxPd needs to be re-inited to match the global audio settings. Otherwise, there can be a problem with audio or can even cause your app to crash. I’m not sure if this is the problem in your case though.

I will try your template soon. I might have some questions later.
Again, thanks for your work.

I updated the project with a simply app life-cycle I used for my app. The app suspends playing sounds when going into background and not connected to anything Audiobus or IAA. Also it seems most of my issues are gone after setting up an output channel in the ofSoundStream, even without using it. Now I can also start the app from within Audiobus and it works as far as I tested. There is only a small issue at the moment: When the OF app is already running before Audiobus gets started, and I add it to AB and connect a FX app, then I get a sound freeze. When starting the FX app first, or starting all apps fresh from inside Audiobus it works.

So yes, I think it must have something todo with the other app changing the soundStream or having different settings, depending who starts it. Maybe someone will find a solution :wink: But the whole AB IAA ecosystems with all possible combinations seems a bit tricky, even some more “professional” apps have issues sometimes when testing.

I you are using Audiobus you might also be interested in integrating Ableton Link in your project.

These are some dirty additions to the core soundOutputStream files taken from the Link example project.

In my case I added some ints that are counting the beats (also quarter-notes , half-notes … etc), I read them from within a ofThread to get the changes. But I did not mess with quantums, since it was not important for my app.

But this might give you a start for your projects. :wink:

1 Like