Reputation: 95
how to play sound in cocos2d in sequence does any body have any idea for example i have three sound like
[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderOneSound]];
[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.WithSound]];
[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderTwoSound]];
this is the code of sound effect play how can i play when one is stop and then another play after that
Upvotes: 1
Views: 2163
Reputation: 433
CCSequence* sequence = [CCSequence actions:
[CCCallBlock actionWithBlock:^(void)
{
[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderOneSound]];
}],
[CCDelayTime actionWithDuration:3],
[CCCallBlock actionWithBlock:^(void)
{
[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.WithSound]];
}],
[CCDelayTime actionWithDuration:3],
[CCCallBlock actionWithBlock:^(void)
{
[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderTwoSound]];
}],
nil];
[self runAction:sequence];
this way can solve your problem, but only drawback is you have to insert delay time by yourself. hope it work for your situation.
Upvotes: 9