我有一个按钮,可以播放在我的初始化场景中设置的 2 个声音数组:
NSString * soundName = [NSString stringWithFormat:@"%d-%d%@.mp3", levelNumber, i+1, language];
NSString * soundName2 = [NSString stringWithFormat:@"%d-%db%@.mp3", levelNumber, i+1, language];
CDBufferLoadRequest * request = [[CDBufferLoadRequest alloc] init:(1001+i) filePath:soundName];
[loadRequests addObject:request];
[request release];
CDBufferLoadRequest * request2 = [[CDBufferLoadRequest alloc] init:(1009+i) filePath:soundName2];
[loadRequests addObject:request2];
[request2 release];
当我点击我的按钮时,它们会被调用。单击按钮时的方法是这样的:
-(void) soundTruck
{
[soundEngine stopAllSounds];
[soundEngine playSound:(1000+tag) sourceGroupId:1 pitch:1 pan:1 gain:1.0f loop:NO];
NSLog(@"sound activated");
[soundEngine playSound:(1008+tag) sourceGroupId:1 pitch:1 pan:1 gain:1.0f loop:NO];
NSLog(@"sound activated");
}
问题是我想在这两个声音之间设置一个间隔来设置第一个,然后是第二个。现在,使用此代码,它只播放第二个。有人可以教我如何设置声音间隔吗?