I'm struggling with a simple error which I understand is caused by misuse of CocosDenshion.
I have a sound "gunshot.wav" that I play every time I fire my pistol weapon.
I have another sound "enemyStrike.wav" that enemies play when they strike a barricade I have.
My pistol sound stops working if a huge amount of enemies (20+) strike the barricade together ( enemyStrike.wav plays 20 times per second or so ).
I thought the problem was due to not having any channels on which to play the sound, however, I am using:
[SimpleAudioEngine playEffect: @"gunshot.wav"];
This means that it should find a reusable/empty buffer and play it, right?
Upon enabling CD_DEBUG, I noticed I was getting an error every time I tried firing my pistol during the issue:
2013-10-29 12:05:16.521 Barricade_Production-iOS[2248:907] Denshion::CDBufferManager reusing buffer id 2
2013-10-29 12:05:16.522 Barricade_Production-iOS[2248:907] Denshion::CDSoundEngine - Loading openAL buffer 2 gunshot.wav
2013-10-29 12:05:16.525 Barricade_Production-iOS[2248:907] Denshion::CDSoundEngine - non empty buffer, regenerating
2013-10-29 12:05:16.526 Barricade_Production-iOS[2248:907] Denshion::CDSoundEngine - error deleting buffer: a004
I have included a video to better explain the situation.
Notice how at the beginning of the video, the pistol has sound, and at the end, the pistol is mute:
Something tells me it has something to do with playing sounds rapidly like on this thread:
I am currently running as an iPhone app for iOS6 on an iPhone4s and iPad3, they both have the same effect.
The only thing I've considered doing was having some manager that limits playing the "enemyStrike.wav" to only a handful of times regardless of how many enemies are striking the barricade.
Does anybody have any thoughts on this? Any suggestions?
Thanks in advance!