PHASE framework project examples

I was wondering if there are any example download projects of the PHASE audio framework? I was watching the WWDC 2021 video but there was no example code to download. The examples within the video were pretty verbose -- do not want to freeze a frame and type all that by hand.

I am attempting to replace some old OpenAL code from a few years ago with an alternate solution. All the OpenAL code shows deprecation messages when I build in Xcode.

The generated header PHASE documentation is kind of sparse and somewhat boiler plate with no examples.

Thanks in advance.

Answered by macnib in 690329022

I've got phase working and I removed the old OpenAL code. No more deprecation warnings and it appears to work.

My observation is its thread safe and no **** ups.

I just pause for a tiny amount of time while I adjust the tree with a new source, prepare and play a sound event that was already added to assets before -- happens infrequently. Works well.

Unless there are objections ... end of thread.

OK, there was just enough to infer from the WWDC video and the documentation in Xcode to get something basic going.

More follow up questions, though. For example, say the player bumps into a wall. There is a thump sound and initially I don't know its location. My simulator is going to call the audio interface with a location and id of the sound to play at that unpredictable moment and place. So, while the PHASE engine is running, I create a PHASEMixerParameters, PHASESource and a PHASESoundEvent just like WWDC example all referencing sound assets and nodes I added to the asset registry while the game initially loaded. I prepare the event but it does not call is completion cloture with .prepared. It looks to be queuing up all the events and not processing them. I call update on the PHASE engine but the event is not processed. The funny part is if I stop or pause the engine while preparing, then when I start the PHASE engine again then it starts the event and the cloture gets called with .prepared and the code plays which works. Its like when the engine is running you cannot add events or modify the tree. It looks like the entire tree needs to be built up front before the engine is started? Is that conceptually how its suppose to work?

Also, is this API thread safe? Should I make an actor on main thread around my calls to PHASE? Is adding events on a different thread going to cause issues?

Accepted Answer

I've got phase working and I removed the old OpenAL code. No more deprecation warnings and it appears to work.

My observation is its thread safe and no **** ups.

I just pause for a tiny amount of time while I adjust the tree with a new source, prepare and play a sound event that was already added to assets before -- happens infrequently. Works well.

Unless there are objections ... end of thread.

PHASE framework project examples
 
 
Q