Skip to main content

aic_processor_initialize

Function aic_processor_initialize 

Source
pub unsafe extern "C" fn aic_processor_initialize(
    processor: *mut AicProcessor,
    sample_rate: u32,
    num_channels: u16,
    num_frames: usize,
    allow_variable_frames: bool,
) -> Type
Expand description

Configures the processor for a specific audio format.

This function must be called before processing any audio. For the lowest delay use the sample rate and frame size returned by aic_model_get_optimal_sample_rate and aic_model_get_optimal_num_frames.

§Parameters

  • processor: Processor instance to configure. Must not be NULL.
  • sample_rate: Audio sample rate in Hz (8000 - 192000).
  • num_channels: Number of audio channels (1 for mono, 2 for stereo, etc.).
  • num_frames: Number of samples per channel in each process call.
  • allow_variable_frames: Allows varying frame counts per process call (up to num_frames), but increases delay.

§Returns

  • AIC_ERROR_CODE_SUCCESS: Configuration accepted
  • AIC_ERROR_CODE_NULL_POINTER: processor is NULL
  • AIC_ERROR_CODE_UNSUPPORTED_AUDIO_CONFIG: Configuration is not supported

§Note

All channels are mixed to mono for processing. To process channels independently, create separate processor instances.

§Safety

  • This function allocates memory. Avoid calling it from real-time audio threads.
  • This function is not thread-safe. Ensure no other threads are using the processor during initialization.