pub unsafe extern "C-unwind" fn AudioConverterNew(
in_source_format: NonNull<AudioStreamBasicDescription>,
in_destination_format: NonNull<AudioStreamBasicDescription>,
out_audio_converter: NonNull<*mut OpaqueAudioConverter>,
) -> i32Expand description
Create a new AudioConverter.
Parameter inSourceFormat: The format of the source audio to be converted.
Parameter inDestinationFormat: The destination format to which the audio is to be converted.
Parameter outAudioConverter: On successful return, points to a new AudioConverter instance.
Returns: An OSStatus result code.
For a pair of linear PCM formats, the following conversions are supported:
- addition and removal of channels, when the stream descriptions' mChannelsPerFrame does not match. Channels may also be reordered and removed using the kAudioConverterChannelMap property.
- sample rate conversion
- interleaving/deinterleaving, when the stream descriptions' (mFormatFlags & kAudioFormatFlagIsNonInterleaved) does not match.
- conversion between any pair of the following formats:
- 8 bit integer, signed or unsigned
- 16, 24, or 32-bit integer, big- or little-endian. Other integral bit depths, if high-aligned and non-packed, are also supported
- 32 and 64-bit float, big- or little-endian.
Also, encoding and decoding between linear PCM and compressed formats is supported. Functions in AudioToolbox/AudioFormat.h return information about the supported formats. When using a codec, you can use any supported PCM format (as above); the converter will perform any necessary additional conversion between your PCM format and the one created or consumed by the codec.
Note that AudioConverter may change the formats to correct any
inconsistent or erroneous values. The actual formats expected and used
by the newly created AudioConverter can be obtained by getting the
properties kAudioConverterCurrentInputStreamDescription and
kAudioConverterCurrentOutputStreamDescription from it.
ยงSafety
in_source_formatmust be a valid pointer.in_destination_formatmust be a valid pointer.out_audio_convertermust be a valid pointer.