因此,我爲我工作的醫院製作了一個音板,它爲放療師播放了不同的呼吸音,以便爲進一步的教育和學員聽取意見。我可以停下來,開始很好的聲音。我遇到的問題是聲音完整。您必須點擊任意按鈕兩次才能播放下一個聲音。所以我想知道如何在完成後重置聲音文件。我對obj-c非常陌生,我的直覺告訴我要實現NSTime,但是我不知道如何去做,或者如果這甚至是我想要做的。Xcode iOS:如何在使用AVFoundation播放後重置聲音
在此先感謝!
- (IBAction)play {
if (soundIsPlaying == YES) {
[audioplayer release];
soundIsPlaying = NO;
}
else if (soundIsPlaying == NO) {
NSString *path = [[NSBundle mainBundle] pathForResource:@"breathe1" ofType:@"wav"];
audioplayer=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
audioplayer.delegate = self;
audioplayer.volume = 1.2;
audioplayer.numberOfLoops = 0;
[audioplayer play];
soundIsPlaying = YES;
}
}
本意是說*** NSTimer – GhostShaman 2011-12-21 02:26:51