开发者

iphone sdk: initialization of a AVAudioRecorder returns nil

开发者 https://www.devze.com 2022-12-30 10:34 出处:网络
I want to initialize a AVAudioRecorder with the aac Format. To do so, I use the following code: soundFilePath = [soundFilePath stringByAppendingPathExtension:@\"aac\"];NSURL *url =

I want to initialize a AVAudioRecorder with the aac Format. To do so, I use the following code:

soundFilePath = [soundFilePath stringByAppendingPathExtension:@"aac"];NSURL *url = 
[NSURL fileURLWithPath:soundFilePath isDirectory:FALSE];

NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue:[NSNumber numberWithInt: 'aac '] forKey:AVFormatIDKey];                                     
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVEncoderAudioQualityKey];                //Encoder Settings 
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVSampleRateConverterAudioQualityKey];    //Sample Rate Conversi开发者_运维技巧on Settings

_recorder = [[AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:nil];

why doesn't this work? Id does work, if I change aac into ima4!


'aac' is not among the predefined format ids and so it doesnot work. U can have a look at the supported audiotype constants for getting a list of all these. They are availab here

at the Constants secion.

0

精彩评论

暂无评论...
验证码 换一张
取 消