Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
midimicrotonal.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 // Microtonal Midi Converter
22 //=============================================================================
23 
24 #ifndef MIDIMICROTONE_H
25 #define MIDIMICROTONE_H
26 
47 
48 #include <QObject>
49 #include <QMutex>
50 #include <QMidiMessage>
51 #include <QTimer>
52 
53 #include "midimicrotonalhelper.h"
54 #include "system/log.h"
55 #include "system/shared.h"
56 
61 
62 class MidiMicrotonal : public QObject, public Log
63 {
64  Q_OBJECT
65 public:
67 
68  bool init();
69  bool exit();
70  bool start();
71  bool stop();
72  void suspend();
73  void resume();
74 
75  void activate (bool active);
76 
77 public slots:
84  void receiveMidiEvent (const QMidiMessage event);
85 
91  void receiveTuningCorrections (QMap<int,double> corrections);
92 
96  void allNotesOff();
97 
105  void setMidiOutputChannel(int channel);
106 
107 
113 
114 signals:
118  void sendMidiEvent (QMidiMessage event);
119 
131 
132 private:
133 
135  bool mRunning;
136  bool mActive;
139  QMutex mMutex;
140  QTimer mTimer;
141 
142 public:
143  static const QMidiMessage cLoopMarker; // Marker for closed Midi loops
144  bool isWorking() { return mRunning and mActive and not mSuspended; }
145 
146 };
147 
148 #endif // MIDIMICROTONE_H
bool stop()
Stop the microtonal converter.
void receiveTuningCorrections(QMap< int, double > corrections)
Input slot: Receive tuning corrections from the tuner (<key,cent>)
MidiMicrotonal()
Constructor, resetting member variables.
bool exit()
Shutdown, no functionality.
void onClosedMidiLoopDetected()
onClosedMidiLoopDetected
void sendMidiEvent(QMidiMessage event)
Output signal: This is the converted outgoing stream of Midi events.
bool start()
Start the microtonal converter.
void allNotesOff()
Slot: Turns all notes off.
void activate(bool active)
Activate or deactivate the module.
void setMidiOutputChannel(int channel)
Slot: Set the instrument channel of the external Midi device.
Class for converting an ordinary Midi stream into a microtonal one.
void resume()
Resume from suspend mode.
bool init()
Initialization, no functionality.
static const QMidiMessage cLoopMarker
Closed-loop marking event.
void suspend()
Suspend the microtonal converter.
Auxiliary class for microtonal conversion.
void reInitializeConvertedMidiStream()
Slot: Re-initialize the output stream.
void receiveMidiEvent(const QMidiMessage event)
Input slot: Here the module receives the stream of incoming Midi events.
Base class for managing log messages.
Definition: log.h:83
MidiMicrotonalHelper mMidiMicrotonalHelper