Reputation: 21
I have a sound effect 3sec long which need to be played repeatedly for some time of 10 to 15 secs. Implemented like below:
SimpleAudioEngine::sharedEngine()->playEffect(powerUpSound, true);
But when I play an another sound effect, previous sound (powerUpSound
) effect stops.
SimpleAudioEngine::sharedEngine()->playEffect(starsSounds, false);
How can I play them both at the same time?
I'm using Cocos2d-x v2.2.3
Upvotes: 1
Views: 2082
Reputation: 12747
I don't think it's a very good solution, but what I'm doing is going around the SimpleAudioEngine and using whatever it's hooking into to play sound:
#include "AudioEngine.h"
std::string music_path = "gethit.mp3";
experimental::AudioEngine::play2d(music_path.c_str())
I think that this leaks memory or something, so you need to be careful when you use it. All I know is that it lets you play multiple sound effects at once on Android.
Upvotes: 1