Extract Floats with Advanced Audio File Services (ExtAudioFileRead)

I am trying to write a program to write float values ​​of samples in an audio file. My steps are as follows:

  • Open advanced audio file
  • Setting the audio format (AudioStreamBasicDescription)
  • Apply audio format to my extended audio file.
  • Setting the AudioBufferList List
  • Read extended audio file in AudioBufferList using ExtAudioFileRead ()
  • Log float values ​​for AudioBufferList

I put all this 90-line class: https://gist.github.com/792630

The problem is that if I apply the audio format to my extended audio file (step 3), I get an error message trying to read the file (step 5). If I comment on step 5, the file reads normally, but I will not use my format for reading, and I do not get a float when registering.

Any suggestions would be greatly appreciated. Thank!

+3
source share
1 answer

One thing I noticed right away is that you allocate an AudioBufferList on the stack, but set mNumberBuffers to 2. It's great to use ABL on the stack, but if you do, they can only contain one buffer. But since you set the client format to mono, this is not your real problem.

, fileRef ExtAudioFileOpenURL - , .

:

CheckResult(ExtAudioFileOpenURL(inputFileURL, &fileRef), "ExtAudioFileOpenURL failed");

, .

+3

Source: https://habr.com/ru/post/1787356/


All Articles