tags:

views:

128

answers:

1

Why does this work?

- (void)setupAudioFormat:(AudioStreamBasicDescription*)format 
{
    format->mSampleRate = 44100;
    format->mFormatID = kAudioFormatLinearPCM;
    format->mFramesPerPacket = 1;
    format->mChannelsPerFrame = 1;
    format->mBytesPerFrame = 2;
    format->mBytesPerPacket = 2;
    format->mBitsPerChannel = 32;
    format->mReserved = 0;

    format->mFormatFlags = kLinearPCMFormatFlagIsBigEndian |
    kLinearPCMFormatFlagIsSignedInteger |
    kLinearPCMFormatFlagIsPacked;
}

but when I change the mFormatFlag it doesn't and I get a kAudioFileUnsupportedDataFormatError.

format->mFormatFlags = kAudioFormatFlagIsFloat |
    kLinearPCMFormatFlagIsBigEndian |
    kAudioFormatFlagIsPacked;

I am recieving the error when calling...

OSStatus    status = AudioQueueNewInput(&recordState.dataFormat,
               AudioInputCallback,
               self,
               CFRunLoopGetCurrent(),
                   kCFRunLoopCommonModes,
               0,
               &recordState.queue);

I am sure the problem lies in the format flags as the error only happens when I try to use the float flag, any ideas how to get around it?

Many thanks.

A: 

Simple, but a hard one to answer and has taken many hours, but it looks like floats are not supported. Thanks.

Chris Beeson