QtFM::FmEngine Class
The FmEngine singleton is the engine that every Nt FM QML type plays through. More…
| Header | #include <QtFMQml/qfmqml.h> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::FMQml) |
| Module | Nt FM QML Types |
| Inherits | QObject |
List of all members, including inherited members
Public Functions
| int | sampleRate() const |
| void | setSampleRate(int rate) |
| int | maxVoices() const |
| void | setMaxVoices(int voices) |
| double | masterGain() const |
| void | setMasterGain(double dB) |
| int | activeVoices() const |
| bool | isStarted() const |
| bool | autoStart() const |
| void | setAutoStart(bool start) |
| double | busGain(int bus) const |
| void | setBusGain(int bus, double dB) |
| bool | start() |
| void | stop() |
| void | stopAll() |
| QtFM::Engine * | engine() |
| void | requireChip(ChipType chip) |
Signals
| void | sampleRateChanged() |
| void | maxVoicesChanged() |
| void | masterGainChanged() |
| void | activeVoicesChanged() |
| void | startedChanged() |
| void | autoStartChanged() |
| void | voiceFinished(quint32 voiceId) |
| void | musicFinished() |
Static Public Members
Detailed Description
The engine is made the first time a sound plays, with the chips that the sounds of the loaded documents asked for, and started on the default sound output unless autoStart is false. Its sampleRate and maxVoices only take effect if they are set before that.
Component.onCompleted: FmEngine.setBusGain(1, -12) // quieter music
Differences from Qt
One engine serves the whole process. Its chips are fixed once it has been made.
Member Function Documentation
int QtFM::FmEngine::activeVoices() const
Returns the number of voices playing.
void QtFM::FmEngine::activeVoicesChanged()
This signal is emitted when activeVoices() changes.
bool QtFM::FmEngine::autoStart() const
Returns true if the engine starts on the default output when it is made; true by default. A test sets it to false and pulls samples from engine() instead.
void QtFM::FmEngine::autoStartChanged()
This signal is emitted when autoStart() changes.
double QtFM::FmEngine::busGain(int bus) const
Returns the gain of bus in decibels.
QtFM::Engine * QtFM::FmEngine::engine()
Returns the engine, making it, and starting it if autoStart is set, if it does not exist yet.
FmEngine * QtFM::FmEngine::instance()
Returns the engine of the process, making it on first use.
bool QtFM::FmEngine::isStarted() const
Returns true if the engine plays to a sound output.
double QtFM::FmEngine::masterGain() const
Returns the gain of the mix in decibels.
void QtFM::FmEngine::masterGainChanged()
This signal is emitted when masterGain() changes.
int QtFM::FmEngine::maxVoices() const
Returns the number of native voices, 32 by default.
void QtFM::FmEngine::maxVoicesChanged()
This signal is emitted when maxVoices() changes.
void QtFM::FmEngine::musicFinished()
This signal is emitted when music that does not loop ends.
void QtFM::FmEngine::requireChip(ChipType chip)
Asks for chip to be emulated by the engine, if it has not been made yet.
void QtFM::FmEngine::reset()
Stops and destroys the engine of the process, so that the next sound makes a new one; for tests.
int QtFM::FmEngine::sampleRate() const
Returns the sample rate in Hz, 48000 by default.
void QtFM::FmEngine::sampleRateChanged()
This signal is emitted when sampleRate() changes.
void QtFM::FmEngine::setAutoStart(bool start)
Sets the autoStart property to start.
See also autoStart().
void QtFM::FmEngine::setBusGain(int bus, double dB)
Sets the gain of bus (0 effects, 1 music, 2 interface) to dB.
void QtFM::FmEngine::setMasterGain(double dB)
Sets the masterGain property to dB.
See also masterGain().
void QtFM::FmEngine::setMaxVoices(int voices)
Sets the maxVoices property to voices.
See also maxVoices().
void QtFM::FmEngine::setSampleRate(int rate)
Sets the sampleRate property to rate.
See also sampleRate().
bool QtFM::FmEngine::start()
Starts the engine on the default sound output; returns false if there is none.
void QtFM::FmEngine::startedChanged()
This signal is emitted when isStarted() changes.
void QtFM::FmEngine::stop()
Stops the sound output.
void QtFM::FmEngine::stopAll()
Fades out every voice.
void QtFM::FmEngine::voiceFinished(quint32 voiceId)
This signal is emitted when the voice voiceId ends.