4
두 가지 다른 버튼 누름 동작이 있습니다. 하나의 버튼을 누르면 하나의 사운드가 재생되고, 다른 버튼을 누르면 첫 번째 사운드는 멈추고 다른 하나는 재생해야합니다. 어떻게해야합니까?AudioToolbox 사운드를 어떻게 멈출 수 있습니까?
당신은 "AudioServicesPlaySystemSound
"를 통해 재생중인 사운드를 중지 할 수 없습니다
-(void) onButtonPressAlbina {
[soundID2 stop];
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"albina" ofType:@"m4a"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);
}
-(void) onButtonPressBalena {
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"balena" ofType:@"m4a"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);
}
덕분에 많이 일했다 – Mihai