Skip to main content

odin_pipeline_insert_apm_effect

enum OdinError odin_pipeline_insert_apm_effect(const struct OdinPipeline *pipeline,
uint32_t index,
uint32_t playback_sample_rate,
bool playback_stereo,
uint32_t *out_effect_id);

Overview

Inserts an Audio Processing Module (APM) effect into the audio pipeline at the specified index and returns a unique effect identifier.

Parameters

NameTypeDescription
pipelineconst struct OdinPipeline *The pipeline handle (from encoder or decoder).
indexuint32_tThe index at which to insert the effect.
playback_sample_rateuint32_tSample rate of reverse stream (loopback).
playback_stereoboolStereo configuration of reverse stream.
out_effect_iduint32_t *Pointer to receive the new effect ID.

Return Value

TypeDescription
OdinErrorODIN_ERROR_SUCCESS on success.

Example

const OdinPipeline *pipeline = odin_encoder_get_pipeline(encoder);
uint32_t effect_id;

// Insert APM effect at the end of the pipeline
// We assume 48kHz stereo playback for loopback processing
OdinError err = odin_pipeline_insert_apm_effect(
pipeline,
odin_pipeline_get_effect_count(pipeline),
48000,
true,
&effect_id
);

if (err == ODIN_ERROR_SUCCESS) {
// Configure APM settings
struct OdinApmConfig config;
odin_pipeline_get_apm_config(pipeline, effect_id, &config);
config.echo_canceller = true;
odin_pipeline_set_apm_config(pipeline, effect_id, &config);
}