AudioQueueProcessingTapNew

Function AudioQueueProcessingTapNew 

Source
pub unsafe extern "C-unwind" fn AudioQueueProcessingTapNew(
    in_aq: AudioQueueRef,
    in_callback: AudioQueueProcessingTapCallback,
    in_client_data: *mut c_void,
    in_flags: AudioQueueProcessingTapFlags,
    out_max_frames: NonNull<u32>,
    out_processing_format: NonNull<AudioStreamBasicDescription>,
    out_aq_tap: NonNull<AudioQueueProcessingTapRef>,
) -> i32
Available on crate features AudioQueue and objc2-core-audio-types only.
Expand description

Create a new processing tap

This function creates a processing tap on a given audio queue. A processing tap can only be established (or removed) on an audio queue that is stopped (paused is not sufficient). The processing tap will then be used to process either decoded data in the case of an output queue, or input data (before it is encoded) in the case of an input queue.

The processing is performed on audio either before or after any effects or other processing (varispeed, etc) is applied by the audio queue, depending on inFlags.

Parameter inAQ: The audio queue from which to create the processing tap

Parameter inCallback: A callback which the queue will call to process the audio

Parameter inClientData: Client data provided to the callback

Parameter inFlags: Flags that are used to control aspects of the processing tap. Valid flags are:

  • kAudioQueueProcessingTap_PreEffects: processing is done before any further effects are applied by the audio queue to the audio
  • kAudioQueueProcessingTap_PostEffects: processing is done after all processing is done, including that of other taps.
  • kAudioQueueProcessingTap_Siphon

Parameter outMaxFrames: The maximum number of sample frames that can be requested of a processing tap at any one time. Typically this will be approximately 50 msec of audio (2048 samples @ 44.1kHz)

Parameter outProcessingFormat: The format in which the client will receive the audio data to be processed. This will always be the same sample rate as the client format and usually the same number of channels as the client format of the audio queue. (NOTE: the number of channels may be different in some cases if the client format has some channel count restrictions, for instance the client provides 5.1 AAC, but the decoder can only produce stereo). The channel order, if the same as the client format, will be the same as the client channel order. If the channel count is changed, it will be to either 1 (mono) or 2 (stereo, in which case the first channel is left, the second right).

If the data is not in a convenient format for the client to process in, then the client should convert the data to and from that format. This is the most efficient mechanism to use (as the audio queue can chose a format that is most efficient from its playback (or recording) requirement.

Parameter outAQTap: The processing tap object.

Returns: An OSStatus result code.

ยงSafety

  • in_aq must be a valid pointer.
  • in_callback must be implemented correctly.
  • in_client_data must be a valid pointer or null.
  • out_max_frames must be a valid pointer.
  • out_processing_format must be a valid pointer.
  • out_aq_tap must be a valid pointer.