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

◆ pcm_mix()

int pcm_mix ( void *const  pcm_a,
size_t  size_a,
void const *const  pcm_b,
size_t  size_b,
enum pcm_mix_mode  mix_mode 
)

#include <include/pcm_mix.h>

Mixes two buffers of PCM data.

Note
Uses simple addition with hard clip protection. Input can be mono or stereo as long as the inputs match. By selecting the mix mode, mono can also be mixed into a stereo buffer. Hard coded for the signed 16-bit PCM.
Parameters
pcm_a[in/out] Pointer to the PCM data buffer A.
size_a[in] Size of the PCM data buffer A (in bytes).
pcm_b[in] Pointer to the PCM data buffer B.
size_b[in] Size of the PCM data buffer B (in bytes).
mix_mode[in] Mixing mode according to pcm_mix_mode.
Return values
0Success. Result stored in pcm_a.
-EINVALpcm_a is NULL or size_a = 0.
-EPERMEither size_b < size_a (for stereo to stereo, mono to mono) or size_a/2 < size_b (for mono to stereo mix).
-ESRCHInvalid mixing mode.