my App is recording audio with
kAudioFormatLinearPCM
set up in der
AudioStreamBasicDescription
. It all works fine on iOS12 (checked by downloading the container). After updating to iOS13 the audio file is saved correctly but when reopening the file, a wrong frame count is returned.The audio is unusable.
We are using a mix of swift and objective c code.
My
AudioStreamBasicDescription
:
self.audioFormat = AudioStreamBasicDescription(
mSampleRate: Double(self.hardwareSampleRate),
mFormatID: kAudioFormatLinearPCM,
mFormatFlags: ( kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked ),
mBytesPerPacket: 4,
mFramesPerPacket: 1,
mBytesPerFrame: 4,
mChannelsPerFrame: 1,
mBitsPerChannel: 32,
mReserved: 0 );
self.audioPlot = XOAudioPlotGL();
self.audioPlot.initialize(withSourceAudioFormat: self.audioFormat);
hardwareSampleReate = 44100
And reopening the file:
CheckError(ExtAudioFileOpenURL(readURL, &mAudioFileRef), "Error: Open File");
CheckError(ExtAudioFileSetProperty(mAudioFileRef,kExtAudioFileProperty_ClientDataFormat, sizeof(audioFormat), &audioFormat), "Set Client Data Format");
CFRelease(readURL);
UInt32 propSize = sizeof(SInt64);
UInt32 numberOfFrames = 0;
CheckError(ExtAudioFileGetProperty(mAudioFileRef, kExtAudioFileProperty_FileLengthFrames, &propSize, &numberOfFrames), "Get Number of Frames");
Here a lower framenumber is returned.
I don't see a reason why this all would work on iOS12 but not on iOS13.
Please let me know if I missed something or more details are needed.
Any help is appreciated.