AudioQueueNewInput

Function AudioQueueNewInput 

Source
pub unsafe extern "C-unwind" fn AudioQueueNewInput(
    in_format: NonNull<AudioStreamBasicDescription>,
    in_callback_proc: AudioQueueInputCallback,
    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 recording audio data.

Outline of how to use the queue for input:

  • create input queue
  • allocate buffers
  • enqueue buffers (AudioQueueEnqueueBuffer, not with parameters, no packet descriptions)
  • the callback receives buffers and re-enqueues them

Parameter inFormat: A pointer to a structure describing the format of the audio data to be recorded. 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 filling 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 recording 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.