#include <qsmf.h>
Classes | |
class | QSmfPrivate |
struct | QSmfRecTempo |
Tempo change within a SMF or sequence. | |
Signals | |
void | signalSMFError (const QString &errorStr) |
Emitted for a SMF read or write error. | |
void | signalSMFHeader (int format, int ntrks, int division) |
Emitted after reading a SMF header. | |
void | signalSMFNoteOn (int chan, int pitch, int vol) |
Emitted after reading a Note On message. | |
void | signalSMFNoteOff (int chan, int pitch, int vol) |
Emitted after reading a Note Off message. | |
void | signalSMFKeyPress (int chan, int pitch, int press) |
Emitted after reading a Polyphonic Aftertouch message. | |
void | signalSMFCtlChange (int chan, int ctl, int value) |
Emitted after reading a Control Change message. | |
void | signalSMFPitchBend (int chan, int value) |
Emitted after reading a Bender message. | |
void | signalSMFProgram (int chan, int patch) |
Emitted after reading a Program change message. | |
void | signalSMFChanPress (int chan, int press) |
Emitted after reading a Channel Aftertouch message. | |
void | signalSMFSysex (const QByteArray &data) |
Emitted after reading a System Exclusive message. | |
void | signalSMFSeqSpecific (const QByteArray &data) |
Emitted after reading a Sequencer specific message. | |
void | signalSMFMetaUnregistered (int typ, const QByteArray &data) |
Emitted after reading an unregistered SMF Meta message. | |
void | signalSMFMetaMisc (int typ, const QByteArray &data) |
Emitted after reading any SMF Meta message. | |
void | signalSMFSequenceNum (int seq) |
Emitted after reading a Sequence number message. | |
void | signalSMFforcedChannel (int channel) |
Emitted after reading a Forced channel message. | |
void | signalSMFforcedPort (int port) |
Emitted after reading a Forced port message. | |
void | signalSMFText (int typ, const QString &data) |
Emitted after reading a SMF text message. | |
void | signalSMFSmpte (int b0, int b1, int b2, int b3, int b4) |
Emitted after reading a SMPT offset message. | |
void | signalSMFTimeSig (int b0, int b1, int b2, int b3) |
Emitted after reading a SMF Time signature message. | |
void | signalSMFKeySig (int b0, int b1) |
Emitted after reading a SMF Key Signature smessage. | |
void | signalSMFTempo (int tempo) |
Emitted after reading a Tempo Change message. | |
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 write the tempo track. | |
void | signalSMFWriteTrack (int track) |
Emitted to request the user to write a track. | |
Public Member Functions | |
QSmf (QObject *parent=0) | |
Constructor. | |
virtual | ~QSmf () |
Destructor. | |
void | readFromStream (QDataStream *stream) |
Reads a SMF stream. | |
void | readFromFile (const QString &fileName) |
Reads a SMF stream from a disk file. | |
void | writeToStream (QDataStream *stream) |
Writes a SMF stream. | |
void | writeToFile (const QString &fileName) |
Writes a SMF stream to a disk file. | |
void | writeMetaEvent (long deltaTime, int type, const QByteArray &data) |
Writes a variable length Meta Event. | |
void | writeMetaEvent (long deltaTime, int type, const QString &data) |
Writes a Text Meta Event. | |
void | writeMetaEvent (long deltaTime, int type, int data) |
Writes a simple Meta event. | |
void | writeMetaEvent (long deltaTime, int type) |
Writes a simple Meta event. | |
void | writeMidiEvent (long deltaTime, int type, int chan, int b1) |
Writes a MIDI message with a single parameter. | |
void | writeMidiEvent (long deltaTime, int type, int chan, int b1, int b2) |
Writes a MIDI message with two parameters. | |
void | writeMidiEvent (long deltaTime, int type, int chan, const QByteArray &data) |
Writes a variable length MIDI message. | |
void | writeMidiEvent (long deltaTime, int type, long len, char *data) |
Writes a variable length MIDI message. | |
void | writeTempo (long deltaTime, long tempo) |
Writes a Tempo change message. | |
void | writeBpmTempo (long deltaTime, int tempo) |
Writes a Tempo change message. | |
void | writeTimeSignature (long deltaTime, int num, int den, int cc, int bb) |
Writes a Time Signature message. | |
void | writeKeySignature (long deltaTime, int tone, int mode) |
Writes a key Signature message. | |
void | writeSequenceNumber (long deltaTime, int seqnum) |
Writes a MIDI Sequence number. | |
long | getCurrentTime () |
Gets the current time in ticks. | |
long | getCurrentTempo () |
Gets the current tempo. | |
long | getRealTime () |
Gets the real time in seconds. | |
long | getFilePos () |
Gets the position in the SMF stream. | |
int | getDivision () |
Gets the resolution. | |
void | setDivision (int division) |
Sets the resolution. | |
int | getTracks () |
Gets the number of tracks. | |
void | setTracks (int tracks) |
Sets the number of tracks. | |
int | getFileFormat () |
Gets the SMF file format. | |
void | setFileFormat (int fileFormat) |
Sets the SMF file format. | |
QTextCodec * | getTextCodec () |
Gets the text codec used for text meta-events I/O. | |
void | setTextCodec (QTextCodec *codec) |
Sets the text codec for text meta-events. |
This class is used to parse and encode Standard MIDI Files (SMF)
Definition at line 83 of file qsmf.h.
~QSmf | ( | ) | [virtual] |
long getCurrentTempo | ( | ) |
Gets the current tempo.
Definition at line 1123 of file qsmf.cpp.
References QSmfPrivate::m_CurrTempo.
long getCurrentTime | ( | ) |
Gets the current time in ticks.
Definition at line 1114 of file qsmf.cpp.
References QSmfPrivate::m_CurrTime.
int getDivision | ( | ) |
Gets the resolution.
Definition at line 1141 of file qsmf.cpp.
References QSmfPrivate::m_Division.
int getFileFormat | ( | ) |
Gets the SMF file format.
Definition at line 1177 of file qsmf.cpp.
References QSmfPrivate::m_fileFormat.
long getFilePos | ( | ) |
Gets the position in the SMF stream.
Definition at line 1195 of file qsmf.cpp.
References QSmfPrivate::m_IOStream.
long getRealTime | ( | ) |
Gets the real time in seconds.
Definition at line 1132 of file qsmf.cpp.
References QSmfPrivate::m_RealTime.
QTextCodec * getTextCodec | ( | ) |
Gets the text codec used for text meta-events I/O.
Definition at line 1205 of file qsmf.cpp.
References QSmfPrivate::m_codec.
int getTracks | ( | ) |
Gets the number of tracks.
Definition at line 1159 of file qsmf.cpp.
References QSmfPrivate::m_Tracks.
void readFromFile | ( | const QString & | fileName | ) |
Reads a SMF stream from a disk file.
fileName | Name of an existing file. |
Definition at line 434 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 424 of file qsmf.cpp.
References QSmfPrivate::m_IOStream.
Referenced by QSmf::readFromFile().
void setDivision | ( | int | division | ) |
Sets the resolution.
division | Resolution in ticks per quarter note |
Definition at line 1150 of file qsmf.cpp.
References QSmfPrivate::m_Division.
void setFileFormat | ( | int | fileFormat | ) |
Sets the SMF file format.
fileFormat | File format (0, 1, or 2) |
Definition at line 1186 of file qsmf.cpp.
References QSmfPrivate::m_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 |
Definition at line 1217 of file qsmf.cpp.
References QSmfPrivate::m_codec.
void setTracks | ( | int | tracks | ) |
Sets the number of tracks.
tracks | Number of tracks |
Definition at line 1168 of file qsmf.cpp.
References QSmfPrivate::m_Tracks.
void signalSMFChanPress | ( | int | chan, | |
int | press | |||
) | [signal] |
Emitted after reading a Channel Aftertouch message.
chan | MIDI Channel | |
press | Pressure amount |
void signalSMFCtlChange | ( | int | chan, | |
int | ctl, | |||
int | value | |||
) | [signal] |
Emitted after reading a Control Change message.
chan | MIDI Channel | |
ctl | MIDI Controller | |
value | Control value |
void signalSMFendOfTrack | ( | ) | [signal] |
Emitted after reading a End-Of-Track message.
void signalSMFError | ( | const QString & | errorStr | ) | [signal] |
Emitted for a SMF read or write error.
errorStr | Error string |
void signalSMFforcedChannel | ( | int | channel | ) | [signal] |
Emitted after reading a Forced channel message.
channel | MIDI Channel |
void signalSMFforcedPort | ( | int | port | ) | [signal] |
Emitted after reading a Forced port message.
port | Port number |
void signalSMFHeader | ( | int | format, | |
int | ntrks, | |||
int | division | |||
) | [signal] |
Emitted after reading a SMF header.
format | SMF format (0/1) | |
ntrks | Number pof tracks | |
division | Division (resolution in ticks per quarter note) |
void signalSMFKeyPress | ( | int | chan, | |
int | pitch, | |||
int | press | |||
) | [signal] |
Emitted after reading a Polyphonic Aftertouch message.
chan | MIDI Channel | |
pitch | MIDI Note | |
press | Pressure amount |
void signalSMFKeySig | ( | int | b0, | |
int | b1 | |||
) | [signal] |
Emitted after reading a SMF Key Signature smessage.
b0 | Number of alterations (negative=flats, positive=sharps) | |
b1 | Scale Mode (0=major, 1=minor) |
void signalSMFMetaMisc | ( | int | typ, | |
const QByteArray & | data | |||
) | [signal] |
Emitted after reading any SMF Meta message.
typ | Message type | |
data | Message data |
void signalSMFMetaUnregistered | ( | int | typ, | |
const QByteArray & | data | |||
) | [signal] |
Emitted after reading an unregistered SMF Meta message.
typ | Message type | |
data | Message data |
void signalSMFNoteOff | ( | int | chan, | |
int | pitch, | |||
int | vol | |||
) | [signal] |
Emitted after reading a Note Off message.
chan | MIDI Channel | |
pitch | MIDI Note | |
vol | Velocity |
void signalSMFNoteOn | ( | int | chan, | |
int | pitch, | |||
int | vol | |||
) | [signal] |
Emitted after reading a Note On message.
chan | MIDI Channel | |
pitch | MIDI Note | |
vol | Velocity |
void signalSMFPitchBend | ( | int | chan, | |
int | value | |||
) | [signal] |
Emitted after reading a Bender message.
chan | MIDI Channel | |
value | Bender value |
void signalSMFProgram | ( | int | chan, | |
int | patch | |||
) | [signal] |
Emitted after reading a Program change message.
chan | MIDI Channel | |
patch | Program number |
void signalSMFSeqSpecific | ( | const QByteArray & | data | ) | [signal] |
Emitted after reading a Sequencer specific message.
data | Message data |
void signalSMFSequenceNum | ( | int | seq | ) | [signal] |
Emitted after reading a Sequence number message.
seq | Sequence number |
void signalSMFSmpte | ( | int | b0, | |
int | b1, | |||
int | b2, | |||
int | b3, | |||
int | b4 | |||
) | [signal] |
Emitted after reading a SMPT offset message.
b0 | Hours | |
b1 | Minutes | |
b2 | Seconds | |
b3 | Frames | |
b4 | Fractional frames |
void signalSMFSysex | ( | const QByteArray & | data | ) | [signal] |
Emitted after reading a System Exclusive message.
data | Sysex bytes |
void signalSMFTempo | ( | int | tempo | ) | [signal] |
Emitted after reading a Tempo Change message.
tempo | Microseconds per quarter note |
void signalSMFText | ( | int | typ, | |
const QString & | data | |||
) | [signal] |
Emitted after reading a SMF text message.
typ | Text type | |
data | Text data |
void signalSMFTimeSig | ( | int | b0, | |
int | b1, | |||
int | b2, | |||
int | b3 | |||
) | [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 |
void signalSMFTrackEnd | ( | ) | [signal] |
Emitted after a track has finished.
void signalSMFTrackStart | ( | ) | [signal] |
Emitted after reading a track prefix.
void signalSMFWriteTempoTrack | ( | ) | [signal] |
Emitted to request the user to write the tempo track.
This is the first track in a format 1 SMF.
void signalSMFWriteTrack | ( | int | track | ) | [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 748 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 780 of file qsmf.cpp.
References key_signature, QSmfPrivate::m_LastStatus, and 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 569 of file qsmf.cpp.
References QSmfPrivate::m_LastStatus, and 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 555 of file qsmf.cpp.
References QSmfPrivate::m_LastStatus, and 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 533 of file qsmf.cpp.
References QSmfPrivate::m_codec, QSmfPrivate::m_LastStatus, and 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 516 of file qsmf.cpp.
References QSmfPrivate::m_LastStatus, and meta_event.
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 687 of file qsmf.cpp.
References end_of_sysex, QSmfPrivate::m_LastStatus, and system_exclusive.
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 584 of file qsmf.cpp.
References end_of_sysex, QSmfPrivate::m_LastStatus, and 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 658 of file qsmf.cpp.
References end_of_sysex, QSmfPrivate::m_LastStatus, and 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 629 of file qsmf.cpp.
References end_of_sysex, QSmfPrivate::m_LastStatus, and system_exclusive.
void writeSequenceNumber | ( | long | deltaTime, | |
int | seqnum | |||
) |
Writes a MIDI Sequence number.
deltaTime | Time offset in ticks | |
seqnum | Sequence number |
Definition at line 716 of file qsmf.cpp.
References QSmfPrivate::m_LastStatus, meta_event, and 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 732 of file qsmf.cpp.
References QSmfPrivate::m_LastStatus, meta_event, and 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 762 of file qsmf.cpp.
References QSmfPrivate::m_LastStatus, meta_event, and time_signature.
void writeToFile | ( | const QString & | fileName | ) |
Writes a SMF stream to a disk file.
fileName | File name |
Definition at line 457 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 447 of file qsmf.cpp.
References QSmfPrivate::m_IOStream.
Referenced by QSmf::writeToFile().