Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::dsp::comp::Pan Class Reference

Detailed Description

Definition at line 27 of file pan.hpp.

#include <pan.hpp>

Public Member Functions

 Pan ()
 
void set_position_su (float su)
 Set pan position. Port — accepts normalized [0,1] signal.
 
void process (const float *in, float *out_l, float *out_r, uint16_t n)
 Apply panning to a mono input, writing to stereo output buffers.
 
void process (float *buf_l, float *buf_r, uint16_t n)
 Apply panning in-place to a stereo pair (scales existing L/R).
 
float position () const
 Current smoothed position [0,1].
 
void reset ()
 Reset smoother to center (0.5)
 
void reset (float position)
 Reset smoother to a specific position.
 

Constructor & Destructor Documentation

◆ Pan()

sbl::dsp::comp::Pan::Pan ( )
inline
Note
All public methods are ISR-safe — bounded computation, no I/O.

Definition at line 31 of file pan.hpp.

References sbl::dsp::primitives::ParameterSmoother::reset(), sbl::dsp::types::SAMPLE_RATE_F, and sbl::dsp::primitives::ParameterSmoother::set_time_ms().

Member Function Documentation

◆ set_position_su()

void sbl::dsp::comp::Pan::set_position_su ( float  su)
inline

Set pan position. Port — accepts normalized [0,1] signal.

0.0 = hard left, 0.5 = center, 1.0 = hard right. Input is clamped to [0,1]. Smoothing is applied per-sample in process().

Parameters
suPan position in normalized units

Definition at line 44 of file pan.hpp.

Referenced by sbl::dsp::widgets::Channel< MaxFrames, MaxSends >::set_pan_su().

◆ process() [1/2]

void sbl::dsp::comp::Pan::process ( const float *  in,
float *  out_l,
float *  out_r,
uint16_t  n 
)
inline

Apply panning to a mono input, writing to stereo output buffers.

Output buffers are overwritten (= semantics, not +=). For accumulating multiple sources, use sbl::dsp::stereo::pan_mix().

Parameters
inMono input buffer
out_lLeft output buffer (overwritten)
out_rRight output buffer (overwritten)
nNumber of samples

Definition at line 61 of file pan.hpp.

References sbl::dsp::stereo::constant_power(), and sbl::dsp::primitives::ParameterSmoother::process().

Referenced by sbl::dsp::widgets::Channel< MaxFrames, MaxSends >::process().

◆ process() [2/2]

void sbl::dsp::comp::Pan::process ( float *  buf_l,
float *  buf_r,
uint16_t  n 
)
inline

Apply panning in-place to a stereo pair (scales existing L/R).

Multiplies existing left samples by the left pan gain and right samples by the right pan gain. Useful for adjusting stereo balance of an already-stereo signal.

Parameters
buf_lLeft buffer (modified in-place)
buf_rRight buffer (modified in-place)
nNumber of samples

Definition at line 81 of file pan.hpp.

References sbl::dsp::stereo::constant_power(), and sbl::dsp::primitives::ParameterSmoother::process().

◆ position()

float sbl::dsp::comp::Pan::position ( ) const
inline

Current smoothed position [0,1].

Returns
The smoother's current value, not the target

Definition at line 94 of file pan.hpp.

References sbl::dsp::primitives::ParameterSmoother::value().

Referenced by reset().

◆ reset() [1/2]

void sbl::dsp::comp::Pan::reset ( )
inline

Reset smoother to center (0.5)

Definition at line 97 of file pan.hpp.

References sbl::dsp::primitives::ParameterSmoother::reset().

◆ reset() [2/2]

void sbl::dsp::comp::Pan::reset ( float  position)
inline

Reset smoother to a specific position.

Definition at line 103 of file pan.hpp.

References position(), and sbl::dsp::primitives::ParameterSmoother::reset().


The documentation for this class was generated from the following file: