0

根据iOS 技术概述,据说支持 DVI/Intel IMA ADPCM 格式。具体来说,有一段表明:

iOS 支持许多行业标准和 Apple 特定的音频格式,包括:

AAC
Apple 无损 (ALAC)
A-law
IMA/ADPCM (IMA4)
线性 PCM
µ-law
DVI/Intel IMA ADPCM
Microsoft GSM 6.10
AES3-2003

但是,在尝试使用 kAudioFormatDVIIntelIMA 格式键时:

[[AVAudioSession sharedInstance]
     setCategory: AVAudioSessionCategoryRecord
     error: &error];

    NSDictionary *recordSettings = @{
        AVFormatIDKey : [NSNumber numberWithInt: kAudioFormatDVIIntelIMA],
        AVSampleRateKey : [NSNumber numberWithFloat: 8000.0],
        AVEncoderBitRateKey : [NSNumber numberWithInt:16],
        AVNumberOfChannelsKey : [NSNumber numberWithInt:1]
    };

    NSError *error;
    AVAudioRecorder *newRecorder =
    [[AVAudioRecorder alloc] initWithURL: soundFileURL
                                settings: recordSettings
                                   error: &error];

    NSLog(@"Recorder Errors: %@", [error description]);

我收到错误消息:

Error Domain=NSOSStatusErrorDomain Code=1718449215 "The operation couldn’t be completed. (OSStatus error 1718449215.)

kAudioFormatUnsupportedDataFormatError 为 1718449215。那么给出了什么?

(请注意,如果我将其更改为 kAudioFormatAppleIMA4,则上面的代码可以正常工作。所以似乎只支持 IMA4 ADPCM,而不支持 DVI/Intel IMA ADPCM)。

4

0 回答 0