drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
|
Standard MIDI Files input/output. More...
#include <qsmf.h>
Signals | |
void | signalSMFError (const QString &errorStr) |
Emitted for a SMF read or write error. More... | |
void | signalSMFHeader (int format, int ntrks, int division) |
Emitted after reading a SMF header. More... | |
void | signalSMFNoteOn (int chan, int pitch, int vol) |
Emitted after reading a Note On message. More... | |
void | signalSMFNoteOff (int chan, int pitch, int vol) |
Emitted after reading a Note Off message. More... | |
void | signalSMFKeyPress (int chan, int pitch, int press) |
Emitted after reading a Polyphonic Aftertouch message. More... | |
void | signalSMFCtlChange (int chan, int ctl, int value) |
Emitted after reading a Control Change message. More... | |
void | signalSMFPitchBend (int chan, int value) |
Emitted after reading a Bender message. More... | |
void | signalSMFProgram (int chan, int patch) |
Emitted after reading a Program change message. More... | |
void | signalSMFChanPress (int chan, int press) |
Emitted after reading a Channel Aftertouch message. More... | |
void | signalSMFSysex (const QByteArray &data) |
Emitted after reading a System Exclusive message. More... | |
void | signalSMFSeqSpecific (const QByteArray &data) |
Emitted after reading a Sequencer specific message. More... | |
void | signalSMFMetaUnregistered (int typ, const QByteArray &data) |
Emitted after reading an unregistered SMF Meta message. More... | |
void | signalSMFMetaMisc (int typ, const QByteArray &data) |
Emitted after reading any SMF Meta message. More... | |
void | signalSMFSequenceNum (int seq) |
Emitted after reading a Sequence number message. More... | |
void | signalSMFforcedChannel (int channel) |
Emitted after reading a Forced channel message. More... | |
void | signalSMFforcedPort (int port) |
Emitted after reading a Forced port message. More... | |
Q_DECL_DEPRECATED void | signalSMFText (int typ, const QString &data) |
Emitted after reading a SMF text message. More... | |
void | signalSMFText2 (int typ, const QByteArray &data) |
Emitted after reading a SMF text message. More... | |
void | signalSMFSmpte (int b0, int b1, int b2, int b3, int b4) |
Emitted after reading a SMPT offset message. More... | |
void | signalSMFTimeSig (int b0, int b1, int b2, int b3) |
Emitted after reading a SMF Time signature message. More... | |
void | signalSMFKeySig (int b0, int b1) |
Emitted after reading a SMF Key Signature smessage. More... | |
void | signalSMFTempo (int tempo) |
Emitted after reading a Tempo Change message. More... | |
void | signalSMFendOfTrack () |
Emitted after reading a End-Of-Track message. | |
void | signalSMFTrackStart () |
Emitted after reading a track prefix. | |
void | signalSMFTrackEnd () |
Emitted after a track has finished. | |
void | signalSMFWriteTempoTrack () |
Emitted to request the user to prepare the tempo track. More... | |
void | signalSMFWriteTrack (int track) |
Emitted to request the user to write a track. More... | |
Public Member Functions | |
QSmf (QObject *parent=nullptr) | |
Constructor. More... | |
virtual | ~QSmf () |
Destructor. | |
void | readFromStream (QDataStream *stream) |
Reads a SMF stream. More... | |
void | readFromFile (const QString &fileName) |
Reads a SMF stream from a disk file. More... | |
void | writeToStream (QDataStream *stream) |
Writes a SMF stream. More... | |
void | writeToFile (const QString &fileName) |
Writes a SMF stream to a disk file. More... | |
void | writeMetaEvent (long deltaTime, int type, const QByteArray &data) |
Writes a variable length Meta Event. More... | |
void | writeMetaEvent (long deltaTime, int type, const QString &data) |
Writes a Text Meta Event. More... | |
void | writeMetaEvent (long deltaTime, int type, int data) |
Writes a simple Meta event. More... | |
void | writeMetaEvent (long deltaTime, int type) |
Writes a simple Meta event. More... | |
void | writeMidiEvent (long deltaTime, int type, int chan, int b1) |
Writes a MIDI message with a single parameter. More... | |
void | writeMidiEvent (long deltaTime, int type, int chan, int b1, int b2) |
Writes a MIDI message with two parameters. More... | |
void | writeMidiEvent (long deltaTime, int type, int chan, const QByteArray &data) |
Writes a variable length MIDI message. More... | |
void | writeMidiEvent (long deltaTime, int type, long len, char *data) |
Writes a variable length MIDI message. More... | |
void | writeTempo (long deltaTime, long tempo) |
Writes a Tempo change message. More... | |
void | writeBpmTempo (long deltaTime, int tempo) |
Writes a Tempo change message. More... | |
void | writeTimeSignature (long deltaTime, int num, int den, int cc, int bb) |
Writes a Time Signature message. More... | |
void | writeKeySignature (long deltaTime, int tone, int mode) |
Writes a key Signature message. More... | |
void | writeSequenceNumber (long deltaTime, int seqnum) |
Writes a MIDI Sequence number. More... | |
long | getCurrentTime () |
Gets the current time in ticks. More... | |
long | getCurrentTempo () |
Gets the current tempo. More... | |
long | getRealTime () |
Gets the real time in seconds. More... | |
long | getFilePos () |
Gets the position in the SMF stream. More... | |
int | getDivision () |
Gets the resolution. More... | |
void | setDivision (int division) |
Sets the resolution. More... | |
int | getTracks () |
Gets the number of tracks. More... | |
void | setTracks (int tracks) |
Sets the number of tracks. More... | |
int | getFileFormat () |
Gets the SMF file format. More... | |
void | setFileFormat (int fileFormat) |
Sets the SMF file format. More... | |
Q_DECL_DEPRECATED QTextCodec * | getTextCodec () |
Gets the text codec used for text meta-events I/O. More... | |
Q_DECL_DEPRECATED void | setTextCodec (QTextCodec *codec) |
Sets the text codec for text meta-events. More... | |
Standard MIDI Files input/output.
This class is used to parse and encode Standard MIDI Files (SMF)
long getCurrentTempo | ( | ) |
long getCurrentTime | ( | ) |
int getDivision | ( | ) |
int getFileFormat | ( | ) |
long getFilePos | ( | ) |
long getRealTime | ( | ) |
QTextCodec * getTextCodec | ( | ) |
Gets the text codec used for text meta-events I/O.
int getTracks | ( | ) |
void readFromFile | ( | const QString & | fileName | ) |
Reads a SMF stream from a disk file.
fileName | Name of an existing file. |
Definition at line 452 of file qsmf.cpp.
References QSmf::readFromStream().
void readFromStream | ( | QDataStream * | stream | ) |
Reads a SMF stream.
stream | Pointer to an existing and opened stream |
Definition at line 442 of file qsmf.cpp.
Referenced by QSmf::readFromFile().
void setDivision | ( | int | division | ) |
void setFileFormat | ( | int | fileFormat | ) |
void setTextCodec | ( | QTextCodec * | codec | ) |
Sets the text codec for text meta-events.
The engine doesn't take ownership of the codec instance.
codec | QTextCodec pointer |
void setTracks | ( | int | tracks | ) |
|
signal |
Emitted after reading a Channel Aftertouch message.
chan | MIDI Channel |
press | Pressure amount |
|
signal |
Emitted after reading a Control Change message.
chan | MIDI Channel |
ctl | MIDI Controller |
value | Control value |
|
signal |
Emitted for a SMF read or write error.
errorStr | Error string |
|
signal |
Emitted after reading a Forced channel message.
channel | MIDI Channel |
|
signal |
Emitted after reading a Forced port message.
port | Port number |
|
signal |
Emitted after reading a SMF header.
format | SMF format (0/1) |
ntrks | Number pof tracks |
division | Division (resolution in ticks per quarter note) |
|
signal |
Emitted after reading a Polyphonic Aftertouch message.
chan | MIDI Channel |
pitch | MIDI Note |
press | Pressure amount |
|
signal |
Emitted after reading a SMF Key Signature smessage.
b0 | Number of alterations (negative=flats, positive=sharps) |
b1 | Scale Mode (0=major, 1=minor) |
|
signal |
Emitted after reading any SMF Meta message.
typ | Message type |
data | Message data |
|
signal |
Emitted after reading an unregistered SMF Meta message.
typ | Message type |
data | Message data |
|
signal |
Emitted after reading a Note Off message.
chan | MIDI Channel |
pitch | MIDI Note |
vol | Velocity |
|
signal |
Emitted after reading a Note On message.
chan | MIDI Channel |
pitch | MIDI Note |
vol | Velocity |
|
signal |
Emitted after reading a Bender message.
chan | MIDI Channel |
value | Bender value |
|
signal |
Emitted after reading a Program change message.
chan | MIDI Channel |
patch | Program number |
|
signal |
Emitted after reading a Sequencer specific message.
data | Message data |
|
signal |
Emitted after reading a Sequence number message.
seq | Sequence number |
|
signal |
Emitted after reading a SMPT offset message.
b0 | Hours |
b1 | Minutes |
b2 | Seconds |
b3 | Frames |
b4 | Fractional frames |
|
signal |
Emitted after reading a System Exclusive message.
data | Sysex bytes |
|
signal |
Emitted after reading a Tempo Change message.
tempo | Microseconds per quarter note |
|
signal |
Emitted after reading a SMF text message.
typ | Text type |
data | Text data |
|
signal |
Emitted after reading a SMF text message.
typ | Text type |
data | Text data |
|
signal |
Emitted after reading a SMF Time signature message.
b0 | Numerator |
b1 | Denominator (exponent in a power of two) |
b2 | Number of MIDI clocks per metronome click |
b3 | Number of notated 32nd notes per 24 MIDI clocks |
|
signal |
Emitted to request the user to prepare the tempo track.
The signal handler should not call the writeTempo() or writeBpmTempo() methods directly, but instead it should fill the Conductor track with tempo and other SMF meta events like key and time signatures to be written later, at the signalSMFWriteTrack() handler.
The Conductor track is the first track in a format 1 SMF.
|
signal |
Emitted to request the user to write a track.
track | Track number |
void writeBpmTempo | ( | long | deltaTime, |
int | tempo | ||
) |
Writes a Tempo change message.
deltaTime | Time offset in ticks |
tempo | Tempo expressed in quarter notes per minute |
Definition at line 767 of file qsmf.cpp.
References QSmf::writeTempo().
void writeKeySignature | ( | long | deltaTime, |
int | tone, | ||
int | mode | ||
) |
Writes a key Signature message.
deltaTime | Time offset in ticks |
tone | Number of alterations (positive=sharps, negative=flats) |
mode | Scale mode (0=major, 1=minor) |
Definition at line 799 of file qsmf.cpp.
References drumstick::File::key_signature, and drumstick::File::meta_event.
void writeMetaEvent | ( | long | deltaTime, |
int | type | ||
) |
Writes a simple Meta event.
deltaTime | Time offset in ticks |
type | Meta event type |
Definition at line 587 of file qsmf.cpp.
References drumstick::File::meta_event.
void writeMetaEvent | ( | long | deltaTime, |
int | type, | ||
const QByteArray & | data | ||
) |
Writes a variable length Meta Event.
deltaTime | Time offset in ticks |
type | Meta event type |
data | Message data |
Definition at line 534 of file qsmf.cpp.
References drumstick::File::meta_event.
void writeMetaEvent | ( | long | deltaTime, |
int | type, | ||
const QString & | data | ||
) |
Writes a Text Meta Event.
deltaTime | Time offset in ticks |
type | Meta event type |
data | Message text |
Definition at line 551 of file qsmf.cpp.
References drumstick::File::meta_event.
void writeMetaEvent | ( | long | deltaTime, |
int | type, | ||
int | data | ||
) |
Writes a simple Meta event.
deltaTime | Time offset in ticks |
type | Meta event type |
data | Meta event data |
Definition at line 573 of file qsmf.cpp.
References drumstick::File::meta_event.
void writeMidiEvent | ( | long | deltaTime, |
int | type, | ||
int | chan, | ||
const QByteArray & | data | ||
) |
Writes a variable length MIDI message.
deltaTime | Time offset in ticks |
type | MIDI event type |
chan | MIDI Channel |
data | Message data |
Definition at line 602 of file qsmf.cpp.
References drumstick::File::end_of_sysex, and drumstick::File::system_exclusive.
void writeMidiEvent | ( | long | deltaTime, |
int | type, | ||
int | chan, | ||
int | b1 | ||
) |
Writes a MIDI message with a single parameter.
deltaTime | Time offset in ticks |
type | MIDI event type |
chan | MIDI Channel |
b1 | Message parameter |
Definition at line 648 of file qsmf.cpp.
References drumstick::File::end_of_sysex, and drumstick::File::system_exclusive.
void writeMidiEvent | ( | long | deltaTime, |
int | type, | ||
int | chan, | ||
int | b1, | ||
int | b2 | ||
) |
Writes a MIDI message with two parameters.
deltaTime | Time offset in ticks |
type | MIDI event type |
chan | MIDI Channel |
b1 | Message parameter 1 |
b2 | Message parameter 2 |
Definition at line 677 of file qsmf.cpp.
References drumstick::File::end_of_sysex, and drumstick::File::system_exclusive.
void writeMidiEvent | ( | long | deltaTime, |
int | type, | ||
long | len, | ||
char * | data | ||
) |
Writes a variable length MIDI message.
deltaTime | Time offset in ticks |
type | MIDI event type |
len | Message length |
data | Message data |
Definition at line 706 of file qsmf.cpp.
References drumstick::File::end_of_sysex, and drumstick::File::system_exclusive.
void writeSequenceNumber | ( | long | deltaTime, |
int | seqnum | ||
) |
Writes a MIDI Sequence number.
deltaTime | Time offset in ticks |
seqnum | Sequence number |
Definition at line 735 of file qsmf.cpp.
References drumstick::File::meta_event, and drumstick::File::sequence_number.
void writeTempo | ( | long | deltaTime, |
long | tempo | ||
) |
Writes a Tempo change message.
deltaTime | Time offset in ticks |
tempo | Tempo in microseconds per quarter note |
Definition at line 751 of file qsmf.cpp.
References drumstick::File::meta_event, and drumstick::File::set_tempo.
Referenced by QSmf::writeBpmTempo().
void writeTimeSignature | ( | long | deltaTime, |
int | num, | ||
int | den, | ||
int | cc, | ||
int | bb | ||
) |
Writes a Time Signature message.
deltaTime | Time offset in ticks |
num | Numerator |
den | Denominator (exponent for a power of two) |
cc | Number of MIDI clocks in a metronome click |
bb | Number of notated 32nd notes in 24 MIDI clocks |
Definition at line 781 of file qsmf.cpp.
References drumstick::File::meta_event, and drumstick::File::time_signature.
void writeToFile | ( | const QString & | fileName | ) |
Writes a SMF stream to a disk file.
fileName | File name |
Definition at line 475 of file qsmf.cpp.
References QSmf::writeToStream().
void writeToStream | ( | QDataStream * | stream | ) |
Writes a SMF stream.
stream | Pointer to an existing and opened stream |
Definition at line 465 of file qsmf.cpp.
Referenced by QSmf::writeToFile().