AVAudioPlayer vs SoundEngine.cpp
I have recently converted a iPhone game from SoundEngine.cpp to AVAudioPlayer, and seeing as the subject of one method over the other doesn't seem to be discussed much, here is my take on using either method.
First off, I have to say that aftee the conversion, I went back to SoundEngine.cpp... I've read some suggestions that long sounds (MP3, AAC) should be played with AVAudioPlayer, and short one should go to SoundEngine.cpp (or OpenAL),and this seems correct.
The real advantage of SoundEngine.cpp is that you can dynamically change the pitch/frequency/etc of the sound, allowing to "randomize the playback" and thus reducing sound repetitiveness for the player. This cannot be done in AVAudioPlayer, but on the other hand, you can query the sound to know if it is playing, which is oddly missing from SoundEngine.cpp, and you can even monitor sounds through delegate, which could be useful.
(See here for a solution for SoundEngine.cpp's playback tracking)
So why did I switch to AVAudioPlayer in the first place then? Because Apple doesn't support SoundEngine.cpp, as it's part of a demo and not part of the SDK itself. Unfortunately, even the "This Must Be Solid, It's An Official API" feeling of AVAudioPlayer, I find that SoundEngine gives better results, and it is more customizable.
First off, I have to say that aftee the conversion, I went back to SoundEngine.cpp... I've read some suggestions that long sounds (MP3, AAC) should be played with AVAudioPlayer, and short one should go to SoundEngine.cpp (or OpenAL),and this seems correct.
The real advantage of SoundEngine.cpp is that you can dynamically change the pitch/frequency/etc of the sound, allowing to "randomize the playback" and thus reducing sound repetitiveness for the player. This cannot be done in AVAudioPlayer, but on the other hand, you can query the sound to know if it is playing, which is oddly missing from SoundEngine.cpp, and you can even monitor sounds through delegate, which could be useful.
(See here for a solution for SoundEngine.cpp's playback tracking)
So why did I switch to AVAudioPlayer in the first place then? Because Apple doesn't support SoundEngine.cpp, as it's part of a demo and not part of the SDK itself. Unfortunately, even the "This Must Be Solid, It's An Official API" feeling of AVAudioPlayer, I find that SoundEngine gives better results, and it is more customizable.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home