27 #include <QTextStream> 43 quint8 command, quint8 byte1, quint8 byte2)
66 , pEventIterator(mEventList.begin())
237 quint32 threshold = mMaxTime * percent / 100.0;
254 QFile file(filename);
255 if (not file.open(QIODevice::WriteOnly))
return;
256 QTextStream out(&file);
259 out <<
"t=" << e.deltaticks <<
"\t" <<
"tr=" << e.track <<
"\tcmd=" << e.command
260 <<
"\tb1="<< e.byte1 <<
"\tb2="<< e.byte2 <<
"\n";
262 if (file.isOpen()) file.close();
quint32 getCumulativeTime() const
Return time of actual event (zero if iterator is at the end of the list).
MidiPlayerEventList()
Constructor, resetting member variables.
double deltaticks
Time ticks elapsed since the last event.
quint8 byte2
Midi second argument byte (zero if none)
quint8 command
Midi command byte.
quint8 byte1
Midi first argument byte.
void advance()
Advance iterator in the list of events.
void clear()
Clear the event list (clear all Midi data).
MidiEventList mEventList
Instance of the event list.
bool atEnd() const
Predicate, telling us whether we are already at the end of the list.
Structure used internally in the MidiPlayer to hold a Midi event.
const MidiPlayerEvent getEvent() const
Return a copy of the actual event (zero event if iterator is at the end of the list).
quint8 track
Midi track number.
void rewind()
Rewind: Move the iterator back to the beginning of the Midi song.
double getProgressInPercent() const
Get the playing progress in percent.
QMutex mAccessMutex
Mutex for access.
MidiEventList::Iterator pEventIterator
Iterator playing the notes.
quint32 mMaxTime
Maximum time at the end of the list.
int getSize() const
Get actual list size.
void setProgress(double percent)
Set the EventList iterator according to a given progress in percent.
void writeListInReadableForm(QString filename)
Write content of the list to file in a readable form (for debugging).
void insert(double time, const MidiPlayerEvent &event)
Insert a new event in the time-ordered list of events.
MidiPlayerEvent(quint8 track=0, double deltaticks=0, quint8 command=0, quint8 byte1=0, quint8 byte2=0)
Constructor for a MidiPlayerEvent, copying the arguments.