AudioConverterNew() fails on iOS 10, but works on macOS Sierra
AudioConverterNew() fails on iOS 10, but works on macOS Sierra
- Subject: AudioConverterNew() fails on iOS 10, but works on macOS Sierra
- From: Andreas Falkenhahn <email@hidden>
- Date: Sun, 27 Nov 2016 21:56:41 +0100
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.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@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden