AudioMixerCommon.h file
Namespaces
- namespace nCine
- Root namespace of nCine game engine.
- namespace nCine::AudioMixer
Functions
- auto Clamp01(float value) -> float
-
auto ClampToInt16(std::
int32_t value) -> std:: int16_t - Saturates a mixed sample to 16 bits.
-
auto ComputeResampleStep(std::
int32_t sourceFrequency, std:: int32_t mixFrequency, float pitch) -> std:: int64_t - Per-output-frame step through a source's samples, as a 32.32 fixed-point cursor.
- void ComputeStereoGains(bool relative, const Vector3f& position, const Vector3f& listenerPosition, float sourceGain, float masterGain, float& leftGain, float& rightGain)
- Per-voice stereo gains of a software-mixing backend.
Function documentation
std:: int16_t ClampToInt16(std:: int32_t value)
Saturates a mixed sample to 16 bits.
Clipping instead of wrapping, which would invert the waveform's polarity.
std:: int64_t ComputeResampleStep(std:: int32_t sourceFrequency,
std:: int32_t mixFrequency,
float pitch)
Per-output-frame step through a source's samples, as a 32.32 fixed-point cursor.
| Parameters | |
|---|---|
| sourceFrequency | Sample rate of the buffer being read |
| mixFrequency | Sample rate the backend is mixing at |
| pitch | Voice pitch, 1.0 for none |
void ComputeStereoGains(bool relative, const Vector3f& position, const Vector3f& listenerPosition, float sourceGain, float masterGain, float& leftGain, float& rightGain)
Per-voice stereo gains of a software-mixing backend.
Matches the OpenAL distance model (AL_LINEAR_DISTANCE_CLAMPED between IAudioDevice::position is in physical units, listenerPosition in pixels, so it's converted here. Relative sources are used as they are.