Customization
This game uses CoreAudio and single AudioGraph to play sounds.
The graph is as follows:
input callbacks -> 3DMixer -> DefaultOutputDevice
3DMixer BusCount is configured for a maximum of 50 sounds.
All samples are converted to the default output device stream format before serving to input callbacks. Unused callbacks are not set (NULL). Most 3D sounds, therefore, azimuth, panorama, distance and gain are usually set for each mixer input, and not alone. They are checked to ensure that only valid values are set. The playback frequency of the mixer input signal is also sometimes slightly changed to simulate the pitch, but for most sounds it was saved at the default setting.
Problem
Let's say I started the game and started a level filled with many sounds, many actions.
I launch the HALLab → IO Cycle Telemetry window to find out how long it takes to process each sound cycle - in each cycle it does not take more than 4 ms from more than 10 available ms, and I can’t determine one peak that will make it move after allotted time.
At some point, when you play the game, when many sounds are played simultaneously (less than 50, but not less than 20), I hear puff, and since then only silence. No Mac sounds can be created from any Mac application. The IO Telemetry window shows that my audio ticks are still working, still taking time, still providing samples for the output of the device.
- This state is maintained even if the game has fewer sounds.
- Even if I finish the game completely, Mac sounds created by other applications will not return.
- Putting the Mac to sleep and waking him up won't help either.
- Only rebooting completely leads to the return of sounds. After that, the first few sounds are heard in them.
What can I do to avoid a problem? The game is big, complex, and I can’t change what it’s playing, but it doesn’t seem to overload the I / O stream, so I'm not sure if I should do this. The problem cannot be caused by any specific sound data, because all sound samples are reproduced many times before the problem occurs. I think that any sound going to the physical speakers will be shielded so as not to physically overload them, and the sound should not be loud at all to cause an error.
I have no ideas.