Core engine (wauvio/core)
common.hpp — buffers, config, panning
Namespace wauvio. Defines the engine-wide constants, the global configuration and the audio buffer types all other modules exchange.
See it in action: Melodies, chords and arpeggios
Constants
TWO_PI and PI (double). The header also selects the platform by defining WAUVIO_WINDOWS (when _WIN32 is set; it includes windows.h and mmsystem.h with WIN32_LEAN_AND_MEAN) or WAUVIO_LINUX.
Global configuration
Config holds sample_rate = 44100, channels = 1, bits = 16. global_config() returns a reference to a function-local static instance, so changing global_config().sample_rate changes the default used by every function whose sample_rate argument is 0.
Buffers
Buffer=std::vector<float>(mono).StereoBufferholds two equal-length buffersLandR. Methods:size(),empty(),resize(n, val)(reassigns both channels),to_mono()(average of L and R),interleave()(LRLR… for WAV output).make_buffer(seconds, sr)/make_stereo(seconds, sr)allocate silent buffers ofseconds × sample_ratesamples.
Helper behaviour
| Function | Behaviour |
|---|---|
mix_into(dst, src, gain) | Adds src × gain into dst over the shorter of the two lengths (mono and stereo overloads). Does not grow dst. |
apply_gain | Multiplies every sample in place. |
clamp_buffer | Hard-limits samples to [-1, 1]. |
normalize(buf, target=0.9) | Scales so the peak (across both channels for stereo) equals target; does nothing if the peak is below 1e-7. |
fade_in / fade_out | Linear ramp over fade_seconds (capped to buffer length). |
to_pcm16 | Clamps and converts floats to int16_t (×32767). |
pan_mono(mono, pan, sr) | Constant-power pan; pan ∈ [-1, 1]. Angle = (pan+1)·π/4, left gain = cos, right gain = sin. |
haas_widen(mono, delay_ms=12) | L = original, R = delayed copy (Haas effect). |
mix_panned(dst, src, pan, gain) | Constant-power pan a mono source into a stereo bus. |
mix_stereo(dst, src, gain) | Adds a stereo source into a stereo bus. |
Full API listing
wauvio/core/common.hpp
This header declares no public types or functions (it is an umbrella / include-only header).