QtCraft API C++ classes QML types Handbook

QcSoundSynthesizer Class

Renders sound definitions into PCM. More...

Header: #include <clientcore/sound/QcSoundSynthesizer.h>

Static Public Members

const int defaultSampleRate
const double endFadeSeconds
const double loopBlendShare
const double maxLoopBlendSeconds
const float peak
QcSampleBuffer render(const QcSoundDefinition &sound, int variant, int sampleRate = defaultSampleRate)
QcSampleBuffer renderLayers(const QList<QcSoundLayer> &layers, quint32 seed, bool loop, int sampleRate = defaultSampleRate)
quint32 seedOf(const QString &name, int variant)

Detailed Description

Deterministic: the same definition, variant and sample rate always give the same samples. Every rendering is normalised to peak, so it never clips; the layers' gains only weigh them against each other and the definition's volume is applied at play time.

Member Function Documentation

[static] QcSampleBuffer QcSoundSynthesizer::render(const QcSoundDefinition &sound, int variant, int sampleRate = defaultSampleRate)

Returns the variant variant of sound at sampleRate.

[static] QcSampleBuffer QcSoundSynthesizer::renderLayers(const QList<QcSoundLayer> &layers, quint32 seed, bool loop, int sampleRate = defaultSampleRate)

Returns arbitrary layers rendered with the noise of seed, as a loop when loop, at sampleRate (music is many notes); only the values' finiteness is required.

[static] quint32 QcSoundSynthesizer::seedOf(const QString &name, int variant)

Returns the seed of variant, from the sound's name, so that renaming a sound changes its noise.

Member Variable Documentation

const int QcSoundSynthesizer::defaultSampleRate

Sample rate the sounds are rendered at unless asked otherwise.

const double QcSoundSynthesizer::endFadeSeconds

Non-looping layers fade out over their last few milliseconds so they end without a click.

const float QcSoundSynthesizer::peak

Level every rendering is normalised to.