nRF Connect SDK API 0.1.0
|
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.
[in,out] | ctx | Pointer to the sample rate conversion context. |
[in] | filter | Filter type to be used for the conversion. |
[in] | input | Pointer to samples to process. |
[in] | input_size | Size of the input in bytes. |
[in] | input_sample_rate | Sample rate of the input bytes. |
[out] | output | Array that output will be written. |
[in] | output_size | Size of the output array in bytes. |
[out] | output_written | Number of bytes written to output. |
[in] | output_sample_rate | Sample rate of output. |
0 | On success. |
-EINVAL | Invalid parameters for sample rate conversion. |
-EFAULT | Output ring buffer has either not enough bytes to output, or not enough space to store bytes. |