AudioQueueNewOutput

Function AudioQueueNewOutput 

Source
pub unsafe extern "C-unwind" fn AudioQueueNewOutput(
    in_format: NonNull<AudioStreamBasicDescription>,
    in_callback_proc: AudioQueueOutputCallback,
    in_user_data: *mut c_void,
    in_callback_run_loop: Option<&CFRunLoop>,
    in_callback_run_loop_mode: Option<&CFString>,
    in_flags: u32,
    out_aq: NonNull<AudioQueueRef>,
) -> i32
Available on crate features AudioQueue and objc2-core-audio-types and objc2-core-foundation only.
Expand description

Creates a new audio queue for playing audio data.

To create an playback audio queue, you allocate buffers, then queue buffers (using AudioQueueEnqueueBuffer). The callback receives buffers and typically queues them again. To schedule a buffer for playback, providing parameter and start time information, call AudioQueueEnqueueBufferWithParameters.

Parameter inFormat: A pointer to a structure describing the format of the audio data to be played. For linear PCM, only interleaved formats are supported. Compressed formats are supported.

Parameter inCallbackProc: A pointer to a callback function to be called when the audio queue has finished playing a buffer.

Parameter inUserData: A value or pointer to data that you specify to be passed to the callback function.

Parameter inCallbackRunLoop: The event loop on which inCallbackProc is to be called. If you specify NULL, the callback is called on one of the audio queue’s internal threads.

Parameter inCallbackRunLoopMode: The run loop mode in which to call the callback. Typically, you pass kCFRunLoopCommonModes. (NULL also specifies kCFRunLoopCommonModes). Other possibilities are implementation specific. You can choose to create your own thread with your own run loops. For more information on run loops, see Run Loops or CFRunLoop Reference.

Parameter inFlags: Reserved for future use. Pass 0.

Parameter outAQ: On return, this variable contains a pointer to the newly created playback audio queue object.

Returns: An OSStatus result code.

§Safety

  • in_format must be a valid pointer.
  • in_callback_proc must be implemented correctly.
  • in_user_data must be a valid pointer or null.
  • in_callback_run_loop possibly has additional threading requirements.
  • out_aq must be a valid pointer.