2014-03-28 94 views
2

我正在使用AVAudioRecorder录制音频。我正在使用下面的代码:AVAudioRecorder默认记录设置

[[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSetting error:NULL];

我想知道如果我将recordSetting设置为零,那么此刻录机使用的默认记录设置是什么。我的意思是,如果我们将设置参数作为nil传递,那么AVFormatIDKey,AVSampleRateKey,AVEncoderBitRateKey,AVNumberOfChannelsKey和AVAudioQualityMax的值是什么。

我需要这些键的默认值。

我将不胜感激任何帮助。

回答

0

以下是您可以设置的默认记录器设置。

NSMutableDictionary recordSetting = [[NSMutableDictionary alloc] init]; 

[recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey]; 
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey]; 
0

默认AVAudioRecorder设置如下;

defaultSettings =  { 
    AVFormatIDKey = 1768775988; 
    AVLinearPCMBitDepthKey = 16; 
    AVLinearPCMIsBigEndianKey = 0; 
    AVLinearPCMIsFloatKey = 0; 
    AVNumberOfChannelsKey = 2; 
    AVSampleRateKey = 44100; 
};