Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
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  *****************************************************************************/
20 //=============================================================================
21 // Midi wrapper class, connecting QtMidi with JustIntonation
22 //=============================================================================
24 #ifndef MIDI_H
25 #define MIDI_H
27 #include <QObject>
28 #include <QtMidi/QMidiInput>
29 #include <QtMidi/QMidiOutput>
30 #include <QtMidi/QMidiDeviceInfo>
31 #include <QMidiAutoConnector>
33 #include "system/log.h"
39 class Midi : public QObject, public Log
40 {
42 public:
43  explicit Midi();
44  ~Midi(){}
46  bool init (QObject* qml);
48 public slots:
49  void sendMidiMessage (const QMidiMessage &event);
51 signals:
52  void receivedMidiMessage (const QMidiMessage &event);
54 private slots: // for signals coming from Qml
55  void selectInputDevice (QString deviceName);
56  void selectOutputDevice (QString deviceName);
57  void setAutomaticInputMode (bool autoconnect);
58  void setAutomaticOutputMode (bool autoconnect);
60 signals: // signals sent to Qml
61  void onInputDevicesChanged (QVariant devices);
62  void onOutputDevicesChanged (QVariant devices);
63  void onCurrentInputDeviceChanged (QVariant device);
64  void onCurrentOutputDeviceChanged (QVariant device);
66 signals: // for resetting sound-generating modules
67  void onStatusChanged();
69 private slots: // for signals coming from QMidi
70  void inputDeviceAttached (const QMidiDeviceInfo info);
71  void outputDeviceAttached (const QMidiDeviceInfo info);
72  void inputDeviceDetached (const QMidiDeviceInfo info);
73  void outputDeviceDetached (const QMidiDeviceInfo info);
75  void inputDeviceCreated (const QMidiInput* device);
76  void outputDeviceCreated (const QMidiOutput* device);
77  void inputDeviceDeleted (QMidiDeviceInfo info);
78  void outputDeviceDeleted (QMidiDeviceInfo info);
80  void acInputDeviceCreated(const QMidiDevice* dev);
81  void acOutputDeviceCreated(const QMidiDevice* dev);
82  void acDeviceDeleted(const QMidiDeviceInfo info, QMidi::Mode mode);
84  void receiveMessage(const QMidiMessage &m);
85 signals:
86  void sendMidiEventToOutputDevice (const QMidiMessage &event);
89 private:
90  QMidiAutoConnector* pConnector;
92  void disconnectInput();
93  void disconnectOutput();
94  void updateAvailableDevices (QMidi::Mode mode);
96  QMidiInput* pCurrentInputDevice;
97  QMidiOutput* pCurrentOutputDevice;
98 };
100 #endif // MIDI_H
QMidiAutoConnector * pConnector
Definition: midi.h:90
void outputDeviceDeleted(QMidiDeviceInfo info)
Private slot: Output device deleted (disconnected)
Definition: midi.cpp:269
void disconnectInput()
Disconnect current input device.
Definition: midi.cpp:362
void onCurrentOutputDeviceChanged(QVariant device)
void onInputDevicesChanged(QVariant devices)
QMidiOutput * pCurrentOutputDevice
Definition: midi.h:97
Class handling Midi input and output.
Definition: midi.h:39
bool init(QObject *qml)
Initialize the Midi wrapper and connect it with Qml.
Definition: midi.cpp:76
QMidiInput * pCurrentInputDevice
Definition: midi.h:96
void outputDeviceCreated(const QMidiOutput *device)
Private slot: Output device created (connected)
Definition: midi.cpp:235
void outputDeviceAttached(const QMidiDeviceInfo info)
Private slot: Output device attached.
Definition: midi.cpp:168
void acOutputDeviceCreated(const QMidiDevice *dev)
Private slot: Automatically connected output device created.
Definition: midi.cpp:302
void receiveMessage(const QMidiMessage &m)
Private slot: Receiving a Midi message from an external Midi device.
Definition: midi.cpp:338
void inputDeviceAttached(const QMidiDeviceInfo info)
Private slot: Input device attached.
Definition: midi.cpp:152
void inputDeviceDetached(const QMidiDeviceInfo info)
Private slot: Input device detached.
Definition: midi.cpp:184
void outputDeviceDetached(const QMidiDeviceInfo info)
Private slot: Output device detached.
Definition: midi.cpp:200
void selectInputDevice(QString deviceName)
Select the input device from a given device name.
Definition: midi.cpp:405
void setAutomaticInputMode(bool autoconnect)
Definition: midi.cpp:470
void onStatusChanged()
void sendMidiMessage(const QMidiMessage &event)
Send a Midi message to the output device.
Definition: midi.cpp:126
void acInputDeviceCreated(const QMidiDevice *dev)
Private slot: Automatically connected input device created.
Definition: midi.cpp:284
void sendMidiEventToOutputDevice(const QMidiMessage &event)
void updateAvailableDevices(QMidi::Mode mode)
Update the shown available devices.
Definition: midi.cpp:500
void setAutomaticOutputMode(bool autoconnect)
Set automatic output mode.
Definition: midi.cpp:485
void acDeviceDeleted(const QMidiDeviceInfo info, QMidi::Mode mode)
Private slot: Automatically connected device deleted (disconnected)
Definition: midi.cpp:321
void onOutputDevicesChanged(QVariant devices)
Base class for managing log messages.
Definition: log.h:83
void onCurrentInputDeviceChanged(QVariant device)
Constructor without functionality.
Definition: midi.cpp:36
void inputDeviceDeleted(QMidiDeviceInfo info)
Private slot: Input device deleted (disconnected)
Definition: midi.cpp:253
void inputDeviceCreated(const QMidiInput *device)
Private slot: Input device created (connected)
Definition: midi.cpp:217
void disconnectOutput()
Disconnect current output device.
Definition: midi.cpp:381
void receivedMidiMessage(const QMidiMessage &event)
Definition: midi.h:44
void selectOutputDevice(QString deviceName)
Select the output device from a given device name.
Definition: midi.cpp:439