6.0.0-rc4Source

QtFM::Sequence Class

The Sequence class holds timed notes on a tempo grid, for jingles and short cues. More…

Header#include <QtFM>
CMaketarget_link_libraries(app PRIVATE Nt::FM)
ModuleNt FM C++ Classes

List of all members, including inherited members

Public Functions

Sequence()
voidsetTempo(float beatsPerMinute)
floattempo() const
voidaddNote(float beat, const Patch &patch, float pitch = 0, float length = -1, float gain = 0)
voidclear()
QList<Note>notes() const
intnoteCount() const
floatduration() const
doublesecondsAt(float beat) const

Detailed Description

Notes are placed on beats; Engine::play() starts all of them at once, each on its exact sample.

// A jingle: four notes, each starting on its own sample.
Sequence jingle;
jingle.setTempo(150);
const Patch pickup = Patch::generate(Category::Pickup, 11);
jingle.addNote(0, pickup);
jingle.addNote(0.5f, pickup, 4);
jingle.addNote(1, pickup, 7);
jingle.addNote(1.5f, pickup, 12);
PlayOptions later;
later.delay = 0.6f;
engine.play(jingle, later);

Differences from Qt

Notes cannot be added while the sequence plays, and there is no looping or swing.

Member Function Documentation

QtFM::Sequence::Sequence()

Constructs an empty sequence at 120 beats a minute.

void QtFM::Sequence::addNote(float beat, const Patch &patch, float pitch = 0, float length = -1, float gain = 0)

Adds a note of patch on beat, transposed by pitch semitones, released after length beats (-1 for the patch's own length) and at gain decibels.

void QtFM::Sequence::clear()

Removes every note.

float QtFM::Sequence::duration() const

Returns the length of the sequence in beats: the end of its last note, counting a note without a length as one beat.

int QtFM::Sequence::noteCount() const

Returns the number of notes.

QList<Note> QtFM::Sequence::notes() const

Returns the notes, in the order they were added.

double QtFM::Sequence::secondsAt(float beat) const

Returns the time in seconds of beat at the sequence's tempo.

void QtFM::Sequence::setTempo(float beatsPerMinute)

Sets the tempo to beatsPerMinute, from 1 to 1000.

float QtFM::Sequence::tempo() const

Returns the tempo in beats a minute.