Just Intonation  Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
logfile.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3  *
4  * This file is part of JustIntonation.
5  *
6  * JustIntonation is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * JustIntonation is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with JustIntonation. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 //=============================================================================
21 // Tuning Log - Create a data log of all tuning events
22 //=============================================================================
23 
24 #ifndef LOGFILE_H
25 #define LOGFILE_H
26 
27 #include <QMidiMessage>
28 #include <QMap>
29 #include <QVariant>
30 #include <QElapsedTimer>
31 #include <QFile>
32 #include <QTextStream>
33 
34 #include "system/log.h"
35 #include "system/shared.h"
36 
41 
42 class LogFile : public QObject, public Log
43 {
44  Q_OBJECT
45 public:
46  LogFile();
47 
48 signals:
50  void signalNewLogMessage (QVariant str);
51 
52 public slots:
53  void activateLogFile (bool on);
54  void receiveMidiEvent (QMidiMessage event);
55  void receiveTuningCorrections(const QMap<int, double> &corrections);
56 
57 private:
58  QString noteName(int key);
59  void addLine (quint64 milliseconds, const QString &line);
60  void registerKeypress (int key, bool pressed);
61  void flushKeypress ();
62 
63 private:
64  QElapsedTimer mTimer;
65  bool isActive;
66  QList<int> mPressed, mReleased;
68  QString mTuningMessage;
69 };
70 
71 #endif // LOGFILE_H
void registerKeypress(int key, bool pressed)
Public slot: Register pressed or released key.
Definition: logfile.cpp:186
QList< int > mReleased
Definition: logfile.h:66
void flushKeypress()
Terminate collection of multiple keypresses/releases and send them to the logfile.
Definition: logfile.cpp:209
void signalNewLogMessage(QVariant str)
bool isActive
Definition: logfile.h:65
void receiveTuningCorrections(const QMap< int, double > &corrections)
Public slot: Receive tuning corrections.
Definition: logfile.cpp:124
Create a data log of keypress and tuning events.
Definition: logfile.h:42
QElapsedTimer mTimer
Definition: logfile.h:64
QList< int > mPressed
Definition: logfile.h:66
QString mTuningMessage
Definition: logfile.h:68
void activateLogFile(bool on)
Switch logging on and off.
Definition: logfile.cpp:57
void receiveMidiEvent(QMidiMessage event)
Public slot: Receive MIDI event.
Definition: logfile.cpp:92
qint64 mTimeOfLastKeypress
Definition: logfile.h:67
Base class for managing log messages.
Definition: log.h:83
QString noteName(int key)
Note Name of a key.
Definition: logfile.cpp:74
void addLine(quint64 milliseconds, const QString &line)
Add a line to the logfile output.
Definition: logfile.cpp:161
LogFile()
Constructor of the LogFile, resets member variables.
Definition: logfile.cpp:36