|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Stereo panning utilities. More...
Classes | |
| struct | PanGain |
| Stereo pan gains (float) More... | |
Functions | |
| PanGain | constant_power (float position) |
| Compute constant-power pan gains (-3 dB at center) | |
| void | pan_mix (const float *mono, float *left, float *right, PanGain gain, uint16_t frames) |
| Apply pan gains to a mono buffer and accumulate into stereo buffers. | |
Stereo panning utilities.
constant_power() - Constant-power pan lawpan_mix_f() - Float stereo mix-in with PanGainF
|
inline |
Compute constant-power pan gains (-3 dB at center)
Uses sqrt-based constant-power pan law: L = sqrt(1 - p), R = sqrt(p)
This ensures L^2 + R^2 = 1 for any position, maintaining constant power across the stereo field.
| position | Pan position: 0.0 = hard left, 0.5 = center, 1.0 = hard right |
Definition at line 53 of file stereo.hpp.
|
inline |
Apply pan gains to a mono buffer and accumulate into stereo buffers.
Multiplies each mono sample by the left and right gains, and ADDS the result to the left[] and right[] buffers. Caller must zero the stereo buffers before the first call when mixing multiple sources.
| mono | Input mono buffer (read-only) |
| left | Left output buffer (accumulated, += semantics) |
| right | Right output buffer (accumulated, += semantics) |
| gain | Precomputed pan gains from constant_power() |
| frames | Number of samples |
Definition at line 78 of file stereo.hpp.
References sbl::dsp::stereo::PanGain::left, and sbl::dsp::stereo::PanGain::right.
Referenced by sbl::widgets::source::SuperSawOsc::process_stereo().