nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ sample_rate_converter_process()

int sample_rate_converter_process ( struct sample_rate_converter_ctx ctx,
enum sample_rate_converter_filter  filter,
void const *const  input,
size_t  input_size,
uint32_t  input_sample_rate,
void *const  output,
size_t  output_size,
size_t *  output_written,
uint32_t  output_sample_rate 
)

#include <include/sample_rate_converter.h>

Process input samples and produce output samples with new sample rate.

Takes samples with the input sample rate, and converts them to the new requested sample rate by filtering the samples before adding or removing samples. The context for the sample rate conversion does not need to be initialized before calling process, and if any parameters change between calls the context will be re-inititalized. As the process has requirements for the number of input samples based on the conversion ratio, the module will buffer both input and output bytes when needed to meet this criteria.

Parameters
[in,out]ctxPointer to the sample rate conversion context.
[in]filterFilter type to be used for the conversion.
[in]inputPointer to samples to process.
[in]input_sizeSize of the input in bytes.
[in]input_sample_rateSample rate of the input bytes.
[out]outputArray that output will be written.
[in]output_sizeSize of the output array in bytes.
[out]output_writtenNumber of bytes written to output.
[in]output_sample_rateSample rate of output.
Return values
0On success.
-EINVALInvalid parameters for sample rate conversion.
-EFAULTOutput ring buffer has either not enough bytes to output, or not enough space to store bytes.