QtCraft API C++ classes QML types Handbook

QcClientSounds Class

The sounds of a client session: the cues of the last moments (oldest first, at most recentLimit), the player's own steps and the ambience loops around them. More...

Header: #include <clientcore/session/QcClientSounds.h>

Public Functions

const QcAmbience::Levels &ambience() const
void clearRecent()
QcLocalSounds &local()
const QList<QcSoundCue> &recent() const
std::optional<QcSoundCue> record(QcSoundCue cue, quint64 tick)
void updateAmbience(const QcBlockAccess &world, const QcVec3 &eye, double rain, quint64 tick, const std::function<void (const QcSoundCue &)> &play)

Static Public Members

const int ambienceTicks
const qsizetype recentLimit

Detailed Description

Plays nothing itself; QcClientSession hands the cues on with its soundCue signal.

Member Function Documentation

const QcAmbience::Levels &QcClientSounds::ambience() const

Returns the ambience levels as faded so far.

void QcClientSounds::clearRecent()

Forgets the recent cues.

QcLocalSounds &QcClientSounds::local()

Returns the player's steps, landings and swimming.

const QList<QcSoundCue> &QcClientSounds::recent() const

Returns the cues of the last moments, oldest first.

std::optional<QcSoundCue> QcClientSounds::record(QcSoundCue cue, quint64 tick)

Keeps cue stamped with tick among the recent ones and returns it; none for a cue without a key.

void QcClientSounds::updateAmbience(const QcBlockAccess &world, const QcVec3 &eye, double rain, quint64 tick, const std::function<void (const QcSoundCue &)> &play)

Fades the ambience levels towards the surroundings of eye in world with rain of strength rain falling there, sampled again every ambienceTicks (by the client tick); then nearby lava may pop (a cue for play).

Member Variable Documentation

const int QcClientSounds::ambienceTicks

The ambience targets are sampled every this many ticks.

const qsizetype QcClientSounds::recentLimit

Most cues kept in recent().