QtFM::FmSequence Class
The FmSequence type plays notes on a tempo grid, for jingles. 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
| FmSequence(QObject *parent = nullptr) | |
| ~FmSequence() | |
| FmSoundBank * | bank() const |
| void | setBank(FmSoundBank *bank) |
| double | tempo() const |
| void | setTempo(double beatsPerMinute) |
| QVariantList | notes() const |
| void | setNotes(const QVariantList ¬es) |
| bool | loops() const |
| void | setLoops(bool loops) |
| bool | isPlaying() const |
| Sequence | sequence() const |
| void | play() |
| void | stop() |
Signals
| void | bankChanged() |
| void | tempoChanged() |
| void | notesChanged() |
| void | loopsChanged() |
| void | playingChanged() |
| void | finished() |
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
QtFM::FmSequence::FmSequence(QObject *parent = nullptr)
Constructs a sequence with parent.
QtFM::FmSequence::~FmSequence()
Destroys the sequence. Its notes play on.
FmSoundBank * QtFM::FmSequence::bank() const
Returns the bank that notes name their sounds in.
void QtFM::FmSequence::bankChanged()
This signal is emitted when bank() changes.
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.
void QtFM::FmSequence::loopsChanged()
This signal is emitted when loops() changes.
QVariantList QtFM::FmSequence::notes() const
Returns the notes, as a list of objects.
void QtFM::FmSequence::notesChanged()
This signal is emitted when notes() changes.
void QtFM::FmSequence::play()
Plays the sequence from its start.
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 ¬es)
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.
void QtFM::FmSequence::tempoChanged()
This signal is emitted when tempo() changes.