QcAudioEngine Class
Everything the graphical client hears: sound cues placed around the listener, UI sounds, the four ambience loops and the background music. More...
| Header: | #include <audio/QcAudioEngine.h> |
| Inherits: | QObject |
Public Functions
| QcAudioEngine(QObject *parent = nullptr) | |
| QcAudioEngine(const QcAudioEngine &) | |
| QcAudioEngine(QcAudioEngine &&) | |
| const QcContentRegistry * | content() const |
| bool | isActive() const |
| bool | isBankReady() const |
| const QcSoundSpatial::Listener & | listener() const |
| void | moveListener(const QcSoundSpatial::Listener &listener) |
| QcAudioOutput & | output() |
| void | play(const QcSoundCue &cue, const QcSoundSpatial::Listener &listener) |
| void | playUi(const QString &key) |
| void | setAmbience(QcAmbience::Levels levels) |
| void | setContent(std::shared_ptr<const QcContentRegistry> content) |
| void | setMusicEnabled(bool enabled) |
| void | setVolumes(double master, double effects, double music, double ambient, bool muted) |
| void | start(bool enabled) |
| void | stopWorldSounds() |
| QcAudioEngine & | operator=(QcAudioEngine &&) |
| QcAudioEngine & | operator=(const QcAudioEngine &) |
Signals
| void | bankReady() |
Static Public Members
| const float | audibleGain |
| const int | firstMusicDelay |
| const int | maxMusicPause |
| const int | minMusicPause |
| const float | musicGain |
Detailed Description
Lives in the GUI thread; rendering the sound bank and music pieces happens on worker threads, so no frame ever waits for synthesis.
Member Function Documentation
[explicit] QcAudioEngine::QcAudioEngine(QObject *parent = nullptr)
A silent engine, child of parent; start() opens the output.
[delete] QcAudioEngine::QcAudioEngine(const QcAudioEngine &)
Copy-constructs an instance of QcAudioEngine. This function is deleted.
[delete] QcAudioEngine::QcAudioEngine(QcAudioEngine &&)
Move-constructs an instance of QcAudioEngine. This function is deleted.
[signal] void QcAudioEngine::bankReady()
The sound bank of the content is rendered; cues play from now on.
const QcContentRegistry *QcAudioEngine::content() const
Returns the content of the sounds, null before setContent().
See also setContent().
bool QcAudioEngine::isActive() const
Returns whether an output device plays.
bool QcAudioEngine::isBankReady() const
Returns whether the sound bank of the content is rendered (bankReady()).
const QcSoundSpatial::Listener &QcAudioEngine::listener() const
Returns where moveListener() placed the listener last (also while the output is inactive).
void QcAudioEngine::moveListener(const QcSoundSpatial::Listener &listener)
Places the playing positional voices anew for where listener is now (every tick).
QcAudioOutput &QcAudioEngine::output()
Returns the output (device, mixer).
void QcAudioEngine::play(const QcSoundCue &cue, const QcSoundSpatial::Listener &listener)
Plays cue as listener hears it; its voice follows the listener until it ends (moveListener).
void QcAudioEngine::playUi(const QString &key)
Plays the sound key without a position (menu clicks).
void QcAudioEngine::setAmbience(QcAmbience::Levels levels)
Sets the levels of the ambience loops; a loop starts with its first audible level.
void QcAudioEngine::setContent(std::shared_ptr<const QcContentRegistry> content)
Renders the sounds of content in the background; until that is done cues are skipped.
See also content().
void QcAudioEngine::setMusicEnabled(bool enabled)
Background music plays while enabled (in a world), with pauses between pieces.
void QcAudioEngine::setVolumes(double master, double effects, double music, double ambient, bool muted)
Sets the volumes of the buses, each from 0 to 1: master over all, effects, music and ambient; muted silences everything.
void QcAudioEngine::start(bool enabled)
Opens the output device; with enabled false no device is touched and the game is silent.
void QcAudioEngine::stopWorldSounds()
Stops ambience, music and effects (leaving a world).
[delete] QcAudioEngine &QcAudioEngine::operator=(QcAudioEngine &&)
Move-assigns other to this QcAudioEngine instance. This function is deleted.
[delete] QcAudioEngine &QcAudioEngine::operator=(const QcAudioEngine &)
Copy-assigns other to this QcAudioEngine instance. This function is deleted.
Member Variable Documentation
const float QcAudioEngine::audibleGain
Quieter voices are not worth a mixer voice.
const float QcAudioEngine::musicGain
Level of the music relative to its bus volume.