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?
Post
Replies
Boosts
Views
Activity
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.
Not a book but I would watch the SwiftUI tutorials at Stanford with Paul Hegarty on youtube.
This seemed to help some...
let m1 = event?.metaParameters["Sampler_Gain"] as? PHASENumberMetaParameter
m1?.fade(value: gain, duration: 0)
let m2 = event?.metaParameters["Mixer_Gain"] as? PHASENumberMetaParameter
m2?.fade(value: mixSettings.gain, duration: 0)
The problem is my gain for the sampler is 0.0005 with ambient. The mixer gain is 0.15 . Calibration is .absoluteSpl at level of 0. The other spatial audio I use .absoluteSpl at level 12 with more reasonable gain values. Maybe its the file but when I read in the file its set to .dynamic . If I use .relativeSpl in any case the speakers ****. Maybe its a captain obvious thing but I'm not seeing it.