#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
-
| 0 | Success. Result stored in pcm_a. |
| -EINVAL | pcm_a is NULL or size_a = 0. |
| -EPERM | Either size_b < size_a (for stereo to stereo, mono to mono) or size_a/2 < size_b (for mono to stereo mix). |
| -ESRCH | Invalid mixing mode. |