Skip to main content

odin_encoder_create

enum OdinError odin_encoder_create(uint32_t sample_rate,
bool stereo,
struct OdinEncoder **out_encoder);

Overview

Creates a new ODIN encoder instance with default settings used to encode audio captured from local sources, such as a microphone. The encoder encapsulates an ingress resampler using the given sample rate and channel layout.

Parameters

NameTypeDescription
sample_rateuint32_tThe sample rate of the input audio (e.g. 48000).
stereoboolTrue for stereo input, false for mono.
out_encoderstruct OdinEncoder **Pointer to receive the new encoder handle.

Return Value

TypeDescription
OdinErrorODIN_ERROR_SUCCESS on success.

Example

OdinEncoder *encoder;
// Create an encoder for 48kHz mono input
OdinError err = odin_encoder_create(48000, false, &encoder);
if (err == ODIN_ERROR_SUCCESS) {
// Access the pipeline to add effects
const OdinPipeline *pipeline = odin_encoder_get_pipeline(encoder);

// ... add effects ...

// When done, free the encoder
odin_encoder_free(encoder);
}