0
在我的應用程序我使用AudioToolbox框架,我需要打一個循環可以嗎?我可以使用音頻工具箱播放循環嗎?
這是AVAudioplayer代碼,同時與
- (AVAudioPlayer *)getNoteFromFilename:(NSString *)name andoftype:(NSString *)type{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:name
ofType:type];
NSURL *fileURL = [NSURL fileURLWithPath:soundPath];
AVAudioPlayer *note = [[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL
error:nil] autorelease];
return note;
}
2個觸摸在viewDidLoad中
ViewDidLoad {
self.Note = [self getNoteFromFilename:@"Note" andoftype:@"wav"];
}
在IBAction爲調用它這個慢慢雲:
[Note prepareToPlay];
[Note play];
NB:我擁有所有按鈕和AVAudioPlayer
你好,如果我想使用AVAudioPLayer我會失去音量控制,因爲所有的聲音加載與audiotoolbox將修復沒有增加和減少它的音量 – 2010-10-17 13:52:51
有'[AVAudioPlayer卷]屬性,這是否解決您的問題? – zoul 2010-10-17 14:33:09
AVAudioPlayer沒有問題,但與從包含AudioServicesPlaySystemSound – 2010-10-17 14:39:04