Skip to content

Instantly share code, notes, and snippets.

@pmatsinopoulos
Created June 11, 2021 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmatsinopoulos/d3a20a586a7c8e870faf44cf72b34d58 to your computer and use it in GitHub Desktop.
Save pmatsinopoulos/d3a20a586a7c8e870faf44cf72b34d58 to your computer and use it in GitHub Desktop.
UInt32 CalculateOutputBufferSize(AudioConverterRef audioConverter,
UInt32 iPacketsPerBuffer) {
UInt32 size = 0;
Boolean isWritable = false;
CheckError(AudioConverterGetPropertyInfo(audioConverter,
kAudioConverterPropertyMaximumOutputPacketSize,
&size,
&isWritable),
"Getting the Audio Converter property value size for property kAudioConverterPropertyMaximumOutputPacketSize");
UInt32 maximumOutputPackeSize = 0;
CheckError(AudioConverterGetProperty(audioConverter,
kAudioConverterPropertyMaximumOutputPacketSize,
&size,
&maximumOutputPackeSize),
"Getting the Audio Converter Property: MaximumOutputPacketSize");
return iPacketsPerBuffer * maximumOutputPackeSize;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment