你好,我是 iOS 的新手,我有一个特殊的任务,首先我用 AVAudioRecorder 录制声音,我可以毫无困难地录制和播放它,但我需要在记录中获取数据,这是我的功能:
@interface recordViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate>
{
AVAudioRecorder *audioRecorder;
AVAudioPlayer *audioPlayer;
UIButton *playButton;
UIButton *recordButton;
UIButton *stopButton;
}
记录:
-(void) recordAudio {
if (!audioRecorder.recording)
{
playButton.enabled = NO;
stopButton.enabled = YES;
[audioRecorder record];
}
}
玩:
-(void) playAudio {
if (!audioRecorder.recording)
{
stopButton.enabled = YES;
recordButton.enabled = NO;
NSError *error;
audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:audioRecorder.url
error:&error];
audioPlayer.delegate = self;
if (error)
NSLog(@"Error: %@", [error localizedDescription]);
else
[audioPlayer play];
}
}
我怎样才能在记录中获取数据?我在 iOS Developer API 中搜索,但我找不到任何东西,在此先感谢。