Voice Record Demoをご覧ください。マイクが接続されている場合
チェック新しいオーディオセッションを作成します
- :それはUIのためCocos2Dを使用しますが、あなただけのHelloWorldScene.mクラスを見てみた場合、それはあなたがする必要があるすべてのコードが含まれています
- スタート
- 保存録音した音声ファイル
保存した音声ファイルを再生を記録
停止を記録はあなたのオーディオセッションを初期化した後は、指定したファイル名に記録を保存するには、以下のいずれかのようメソッドを使用することができます。
「安っぽいチュートリアルリンク」の -(void) saveAudioFileNamed:(NSString *)filename {
destinationString = [[self documentsPath] stringByAppendingPathComponent:filename];
NSLog(@"%@", destinationString);
NSURL *destinationURL = [NSURL fileURLWithPath: destinationString];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
NSError *error;
recorder = [[AVAudioRecorder alloc] initWithURL:destinationURL settings:settings error:&error];
recorder.delegate = self;
}
-1'ed - それが欠けていたという事実あなたが望んでいたものは、それがどれほど多くの仕事に費やされているかが目立っているので、それは気が狂っていません。 (私はそのチュートリアルと提携していない)。 –