41 , mTimeOfLastKeypress(-1)
76 const QVector<QString> names =
77 {
"C",
"C#",
"D",
"D#",
"E",
"F",
"F#",
"G",
"G#",
"A",tr(
"A#"),tr(
"B")};
78 return names[key%12] + QString::number(key/12-1);
94 int key =
event.byte1() & 0x7F;
96 switch (event.byte0() & 0xF0)
127 if (corrections.size() == 0)
return;
129 qint64 time =
mTimer.elapsed();
133 QString msg =
"<font color=\"orange\">" +
134 QString::number(0.01*qRound(100*(corrections.first()))) +
"</font> ";
135 double prevValue = 0;
136 for (
auto it = corrections.begin(); it != corrections.end(); it++)
138 int key = it.key() % 128;
139 if (key != corrections.firstKey())
141 msg +=
" " + QString::number(0.01*qRound(100*(it.value()-prevValue))) +
" ";
142 prevValue = it.value();
144 msg +=
"</font>|<b>"+
noteName(key)+
"</b>|<font color=\"blue\">";
145 prevValue = it.value();
164 QTime time(0,static_cast<int>(milliseconds/60000L),
165 static_cast<int>((milliseconds/1000L)%60L),
166 static_cast<int>(milliseconds%1000L));
167 emit
signalNewLogMessage(time.toString(
"mm:ss.zzz") +
" <font color=\"blue\">" + line +
"</font>");
190 qint64 time =
mTimer.elapsed();
212 QString line; QTextStream str(&line);
216 str <<
"<font color=\"red\">RELEASED";
223 str <<
"<font color=\"green\">PRESSED";
void registerKeypress(int key, bool pressed)
Public slot: Register pressed or released key.
void setModuleName(const QString &name)
Specify the name of the class-specific module.
void flushKeypress()
Terminate collection of multiple keypresses/releases and send them to the logfile.
void signalNewLogMessage(QVariant str)
void receiveTuningCorrections(const QMap< int, double > &corrections)
Public slot: Receive tuning corrections.
void activateLogFile(bool on)
Switch logging on and off.
void receiveMidiEvent(QMidiMessage event)
Public slot: Receive MIDI event.
qint64 mTimeOfLastKeypress
QString noteName(int key)
Note Name of a key.
void addLine(quint64 milliseconds, const QString &line)
Add a line to the logfile output.
LogFile()
Constructor of the LogFile, resets member variables.