QtCraft API C++ classes QML types Handbook

QcNoteBudget Class

Which notes of note blocks may sound (decision E-767), so that a fast clock driving many note blocks cannot flood the clients with sounds: a block plays at most once every minIntervalTicks (several notes of one block in one tick become one), and all blocks together at most maxPerTick notes a tick. More...

Header: #include <server/signal/QcNoteBudget.h>

Public Functions

bool allow(QcBlockPos pos, quint64 tick)
qsizetype remembered() const

Static Public Members

const int maxPerTick
const quint64 minIntervalTicks

Detailed Description

A note over either limit is dropped (the block still changes state).

Member Function Documentation

bool QcNoteBudget::allow(QcBlockPos pos, quint64 tick)

Returns whether the note block at pos may play in tick tick; counts it if so.

qsizetype QcNoteBudget::remembered() const

Returns the number of blocks remembered (tests): those that played within the last minIntervalTicks.

Member Variable Documentation

const int QcNoteBudget::maxPerTick

Notes of all blocks in a tick at most.

const quint64 QcNoteBudget::minIntervalTicks

Ticks between two notes of one block at least.