0

i'm working on an iPhone project and wants to save mp3 files instead of car, i wrote this code to save record files in .caf extensions:

NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
    [recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
    [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
    NSString *recorderFilePath =[NSString stringWithFormat:@"%@/%@.caf",  DOCUMENTS_FOLDER,fileName];

i tried this:

[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey];
 NSString *recorderFilePath =[NSString stringWithFormat:@"%@/%@.mp3", DOCUMENTS_FOLDER,fileName];

but it didn't save in mp3 format! is it available in objective c or there's any third party code that makes that, i see that method in AudioToolbox.framework:

OSStatus AudioConverterConvertBuffer (
AudioConverterRef  inAudioConverter,
UInt32             inInputDataSize,

const void         *inInputData,

UInt32             *ioOutputDataSize,

void               *outOutputData

);

any help is welcomed,thanks.

4

1 に答える 1

0

オープン ソース プロジェクトlameがあります。課題は、iPhoneで機能させることです。 これにより、ios のクロス コンパイルに向けた方向性が示されます。

GPLであることにも注意してください。

于 2012-05-07T14:27:13.863 に答える