You need to set mFormatFlags

> On Nov 27, 2016, at 12:56 PM, Andreas Falkenhahn <[email protected]> 
> wrote:
> 
> Why does the following call to AudioConverterNew() fail on iOS 10?
> On macOS Sierra it's working fine.
> 
>       AudioStreamBasicDescription in, out;
> 
>       memset(&in, 0, sizeof(AudioStreamBasicDescription));
>       memset(&out, 0, sizeof(AudioStreamBasicDescription));
> 
>       in.mFormatID = kAudioFormatLinearPCM;

        in.mFormatFlags = kAudioFormatFlagsNativeEndian | 
kAudioFormatFlagIsSignedInteger;


>       in.mChannelsPerFrame = 1;
>       in.mSampleRate = 11025;
>       in.mBitsPerChannel = 16;
>       in.mFramesPerPacket = 1;
>       in.mBytesPerFrame = 2;
>       in.mBytesPerPacket = 2;
> 
>       out.mFormatID = kAudioFormatLinearPCM;
>       out.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
>       out.mBitsPerChannel = 32;
>       out.mChannelsPerFrame = 2;
>       out.mFramesPerPacket = 1;
>       out.mBytesPerPacket = asbd.mBytesPerFrame = sizeof(Float32);
>       out.mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
> 
>       ret = AudioConverterNew(&in, &out, &converter);
> 
> The call to AudioConverterNew() returns 'fmt?' in 'ret'. Since other
> input formats work, I think the problem is with the particular input
> format in the example above.
> 
> I agree, 11025hz, 16 bit and mono is rather uncommon but isn't that
> the point of audio converters, i.e. to be able to convert exotic
> audio formats to common audio formats supported by the hardware?
> 
> So could this be a bug in iOS? As I said, the same code works fine on
> macOS Sierra but it doesn't work on iOS 10.
> 
> -- 
> Best regards,
> Andreas Falkenhahn                          mailto:[email protected]
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/coreaudio-api/jmccartney%40apple.com
> 
> This email sent to [email protected]

James McCartney
Apple CoreAudio
[email protected]



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to