6.0.0-rc4Source

QtFM::FmSequence Class

The FmSequence type plays notes on a tempo grid, for jingles. More…

Header#include <QtFMQml/qfmqml.h>
CMaketarget_link_libraries(app PRIVATE Nt::FMQml)
ModuleNt FM QML Types
InheritsQObject

List of all members, including inherited members

Public Functions

FmSequence(QObject *parent = nullptr)
~FmSequence()
FmSoundBank *bank() const
voidsetBank(FmSoundBank *bank)
doubletempo() const
voidsetTempo(double beatsPerMinute)
QVariantListnotes() const
voidsetNotes(const QVariantList &notes)
boolloops() const
voidsetLoops(bool loops)
boolisPlaying() const
Sequencesequence() const
voidplay()
voidstop()

Signals

Detailed Description

Each note is an object with a beat and either the sound name of a patch in bank or a patch from FmPatch, and optionally pitch (semitones), length (beats) and gain (dB). Every note starts on its exact sample.

property FmSequence jingle: FmSequence {
    bank: game.bank
    tempo: 160
    notes: [
        { beat: 0, sound: "coin" },
        { beat: 0.5, sound: "coin", pitch: 4 },
        { beat: 1, sound: "coin", pitch: 7 },
        { beat: 1.5, sound: "coin", pitch: 12, gain: -3 }
    ]
}

Differences from Qt

A looping sequence is restarted by a timer, so its repeats are not sample-accurate.

Member Function Documentation

[explicit] QtFM::FmSequence::FmSequence(QObject *parent = nullptr)

Constructs a sequence with parent.

[override] QtFM::FmSequence::~FmSequence()

Destroys the sequence. Its notes play on.

FmSoundBank * QtFM::FmSequence::bank() const

Returns the bank that notes name their sounds in.

[signal] void QtFM::FmSequence::bankChanged()

This signal is emitted when bank() changes.

[signal] void QtFM::FmSequence::finished()

This signal is emitted when a sequence that does not loop has played its last beat.

bool QtFM::FmSequence::isPlaying() const

Returns true if the sequence plays.

bool QtFM::FmSequence::loops() const

Returns true if the sequence starts again when it ends.

[signal] void QtFM::FmSequence::loopsChanged()

This signal is emitted when loops() changes.

QVariantList QtFM::FmSequence::notes() const

Returns the notes, as a list of objects.

[signal] void QtFM::FmSequence::notesChanged()

This signal is emitted when notes() changes.

void QtFM::FmSequence::play()

Plays the sequence from its start.

[signal] void QtFM::FmSequence::playingChanged()

This signal is emitted when isPlaying() changes.

Sequence QtFM::FmSequence::sequence() const

Returns the notes as a QtFM::Sequence, with their patches looked up.

void QtFM::FmSequence::setBank(FmSoundBank *bank)

Sets the bank property to bank.

See also bank().

void QtFM::FmSequence::setLoops(bool loops)

Sets the loops property to loops.

See also loops().

void QtFM::FmSequence::setNotes(const QVariantList &notes)

Sets the notes property to notes.

See also notes().

void QtFM::FmSequence::setTempo(double beatsPerMinute)

Sets the tempo property to beatsPerMinute.

See also tempo().

void QtFM::FmSequence::stop()

Stops the sequence and fades out its notes.

double QtFM::FmSequence::tempo() const

Returns the tempo in beats a minute, 120 by default.

[signal] void QtFM::FmSequence::tempoChanged()

This signal is emitted when tempo() changes.