Hi!
I'm writing a simple game for iPhone and I have some weird problems with sound effects volume.
I have a shared class called "Sounds", which is responsible for playing all sound effects. There are two particular methods in it:
-(void)playButton
{
[[SimpleAudioEngine sharedEngine] playEffect:SND_BUTTON pitch:1.0f pan:0.0f gain:1.0f];
}
which is called when button is pressed,
and:
-(void)playKlank:(float)volume
{
[[SimpleAudioEngine sharedEngine] playEffect:SND_KLANK pitch:1.0f pan:0 gain:volume];
}
which is called when two objects collide. I determine strength of the collision and adjust volume.
I also do preloading in 'init' method:
SimpleAudioEngine* audioEngine = [SimpleAudioEngine sharedEngine];
[audioEngine preloadEffect:SND_KLANK];
[audioEngine preloadEffect:SND_BUTTON];
[audioEngine setEffectsVolume:1.0f];
and call [Sounds sharedSounds] at the beginning of my app delegate to preload sound effects.
Now, the weird part:
1) First button sound effect is always quiet, something about 50% of the original volume. After that, next button sound effects are normal 100% volume.
2) When I press button after two objects collided and 'klank' sound effect is still playing (it is something about 0.5 sec long) then the 'button' sound effect is at the same volume level as 'klank'. When I press button when 'klank' isn't playing, then the 'button' sound effect is normal 100% volume.
I use cocos2d in version 0.99.3, OpenFeint and iAds.
I searched this forum, but didn't find an answer for my problem.
Please help.
Cheers,
Igrek