Add files via upload

This commit is contained in:
Bruce Brown 2017-12-29 10:40:59 -08:00 committed by GitHub
parent 4bbce011a4
commit fa10578293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 524 additions and 348 deletions

View file

@ -1,276 +1,424 @@
// //
// Midi.cpp // Midi.cpp
// libraries/midi/src // libraries/midi/src
// //
// Created by Burt Sloane // Created by Burt Sloane
// Copyright 2015 High Fidelity, Inc. // Modified by Bruce Brown
// // Copyright 2015 High Fidelity, Inc.
// Distributed under the Apache License, Version 2.0. //
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // Distributed under the Apache License, Version 2.0.
// // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "Midi.h"
#include "Midi.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/QLoggingCategory>
#if defined Q_OS_WIN32 #if defined Q_OS_WIN32
#include "Windows.h" #include "Windows.h"
#endif #endif
#if defined Q_OS_WIN32
#if defined Q_OS_WIN32 const int MIDI_BYTE_MASK = 0x0FF;
const int MIDI_BYTE_MASK = 0x0FF; const int MIDI_NIBBLE_MASK = 0x00F;
const int MIDI_SHIFT_NOTE = 8; const int MIDI_PITCH_BEND_MASK = 0x3F80;
const int MIDI_SHIFT_VELOCITY = 16; const int MIDI_SHIFT_STATUS = 4;
#endif const int MIDI_SHIFT_NOTE = 8;
const int MIDI_STATUS_MASK = 0x0F0; const int MIDI_SHIFT_VELOCITY = 16;
const int MIDI_NOTE_OFF = 0x080; const int MIDI_SHIFT_PITCH_BEND = 9;
const int MIDI_NOTE_ON = 0x090;
const int MIDI_CONTROL_CHANGE = 0x0b0; #endif
const int MIDI_CHANNEL_MODE_ALL_NOTES_OFF = 0x07b; // Status Decode
const int MIDI_NOTE_OFF = 0x8;
const int MIDI_NOTE_ON = 0x9;
static Midi* instance = NULL; // communicate this to non-class callbacks const int MIDI_POLYPHONIC_KEY_PRESSURE = 0xa;
static bool thruModeEnabled = false; const int MIDI_CONTROL_CHANGE = 0xb;
const int MIDI_PROGRAM_CHANGE = 0xc;
std::vector<QString> Midi::midiinexclude; const int MIDI_CHANNEL_PRESSURE = 0xd;
std::vector<QString> Midi::midioutexclude; const int MIDI_PITCH_BEND_CHANGE = 0xe;
const int MIDI_SYSTEM_MESSAGE = 0xf;
#if defined Q_OS_WIN32 const int MIDI_CHANNEL_MODE_ALL_NOTES_OFF = 0x07b;
#pragma comment(lib, "Winmm.lib") static Midi* instance = NULL; // communicate this to non-class callbacks
static bool thruModeEnabled = false;
// static bool broadcastEnabled = false;
std::vector<HMIDIIN> midihin; static bool typeNoteOffEnabled = true;
std::vector<HMIDIOUT> midihout; static bool typeNoteOnEnabled = true;
static bool typePolyKeyPressureEnabled = false;
static bool typeControlChangeEnabled = true;
void CALLBACK MidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { static bool typeProgramChangeEnabled = true;
switch (wMsg) { static bool typeChanPressureEnabled = false;
case MIM_OPEN: static bool typePitchBendEnabled = true;
// message not used static bool typeSystemMessageEnabled = false;
break;
case MIM_CLOSE: std::vector<QString> Midi::midiinexclude;
for (int i = 0; i < midihin.size(); i++) { std::vector<QString> Midi::midioutexclude;
if (midihin[i] == hMidiIn) {
midihin[i] = NULL; #if defined Q_OS_WIN32
instance->allNotesOff();
} #pragma comment(lib, "Winmm.lib")
}
break; //
case MIM_DATA: { std::vector<HMIDIIN> midihin;
int status = MIDI_BYTE_MASK & dwParam1; std::vector<HMIDIOUT> midihout;
int note = MIDI_BYTE_MASK & (dwParam1 >> MIDI_SHIFT_NOTE);
int vel = MIDI_BYTE_MASK & (dwParam1 >> MIDI_SHIFT_VELOCITY); void CALLBACK MidiInProc(HMIDIIN hMidiIn, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) {
if (thruModeEnabled) { switch (wMsg) {
instance->sendNote(status, note, vel); // relay the note on to all other midi devices case MIM_OPEN:
} // message not used
instance->noteReceived(status, note, vel); // notify the javascript break;
break; case MIM_CLOSE:
} for (int i = 0; i < midihin.size(); i++) {
} if (midihin[i] == hMidiIn) {
} midihin[i] = NULL;
instance->allNotesOff();
//instance->midiHardwareChange();
void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { }
switch (wMsg) { }
case MOM_OPEN: break;
// message not used case MIM_DATA: {
break; int device = -1;
case MOM_CLOSE: for (int i = 0; i < midihin.size(); i++) {
for (int i = 0; i < midihout.size(); i++) { if (midihin[i] == hMidiIn) {
if (midihout[i] == hmo) { device = i;
midihout[i] = NULL; }
instance->allNotesOff(); }
} int raw = dwParam1;
} int channel = (MIDI_NIBBLE_MASK & dwParam1) + 1;
break; int status = MIDI_BYTE_MASK & dwParam1;
} int type = MIDI_NIBBLE_MASK & (dwParam1 >> MIDI_SHIFT_STATUS);
} int note = MIDI_BYTE_MASK & (dwParam1 >> MIDI_SHIFT_NOTE);
int velocity = MIDI_BYTE_MASK & (dwParam1 >> MIDI_SHIFT_VELOCITY);
int bend = 0;
void Midi::sendNote(int status, int note, int vel) { int program = 0;
for (int i = 0; i < midihout.size(); i++) { if (!typeNoteOffEnabled && type == MIDI_NOTE_OFF) {
if (midihout[i] != NULL) { return;
midiOutShortMsg(midihout[i], status + (note << MIDI_SHIFT_NOTE) + (vel << MIDI_SHIFT_VELOCITY)); }
} if (!typeNoteOnEnabled && type == MIDI_NOTE_ON) {
} return;
} }
if (!typePolyKeyPressureEnabled && type == MIDI_POLYPHONIC_KEY_PRESSURE) {
return;
void Midi::MidiSetup() { }
midihin.clear(); if (!typeControlChangeEnabled && type == MIDI_CONTROL_CHANGE) {
midihout.clear(); return;
}
MIDIINCAPS incaps; if (typeProgramChangeEnabled && type == MIDI_PROGRAM_CHANGE) {
for (unsigned int i = 0; i < midiInGetNumDevs(); i++) { program = note;
midiInGetDevCaps(i, &incaps, sizeof(MIDIINCAPS)); note = 0;
}
bool found = false; if (typeChanPressureEnabled && type == MIDI_CHANNEL_PRESSURE) {
for (int j = 0; j < midiinexclude.size(); j++) { velocity = note;
if (midiinexclude[j].toStdString().compare(incaps.szPname) == 0) { note = 0;
found = true; }
break; if (typePitchBendEnabled && type == MIDI_PITCH_BEND_CHANGE) {
} bend = ((MIDI_BYTE_MASK & (dwParam1 >> MIDI_SHIFT_NOTE)) | (MIDI_PITCH_BEND_MASK & (dwParam1 >> MIDI_SHIFT_PITCH_BEND))) - 8192;
} channel = 0; // Weird values on different instruments
if (!found) { // EXCLUDE AN INPUT BY NAME note = 0;
HMIDIIN tmphin; velocity = 0;
midiInOpen(&tmphin, i, (DWORD_PTR)MidiInProc, NULL, CALLBACK_FUNCTION); }
midiInStart(tmphin); if (!typeSystemMessageEnabled && type == MIDI_SYSTEM_MESSAGE) {
midihin.push_back(tmphin); return;
} }
if (thruModeEnabled) {
} instance->sendNote(status, note, velocity); // relay the message on to all other midi devices.
//instance->sendMessage();
MIDIOUTCAPS outcaps; }
for (unsigned int i = 0; i < midiOutGetNumDevs(); i++) { instance->rawMidiReceived(device, raw); // notify the javascript
midiOutGetDevCaps(i, &outcaps, sizeof(MIDIINCAPS)); instance->midiReceived(device, raw, channel, status, type, note, velocity, bend, program); // notify the javascript
break;
bool found = false; }
for (int j = 0; j < midioutexclude.size(); j++) { }
if (midioutexclude[j].toStdString().compare(outcaps.szPname) == 0) { }
found = true;
break; void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) {
} switch (wMsg) {
} case MOM_OPEN:
if (!found) { // EXCLUDE AN OUTPUT BY NAME // message not used
HMIDIOUT tmphout; break;
midiOutOpen(&tmphout, i, (DWORD_PTR)MidiOutProc, NULL, CALLBACK_FUNCTION); case MOM_CLOSE:
midihout.push_back(tmphout); for (int i = 0; i < midihout.size(); i++) {
} if (midihout[i] == hmo) {
} midihout[i] = NULL;
instance->allNotesOff();
allNotesOff(); //instance->midiHardwareChange();
} }
}
void Midi::MidiCleanup() { break;
allNotesOff(); }
}
for (int i = 0; i < midihin.size(); i++) {
if (midihin[i] != NULL) { void Midi::sendRawMessage(int device, int raw) {
midiInStop(midihin[i]); if (broadcastEnabled) {
midiInClose(midihin[i]); for (int i = 0; i < midihout.size(); i++) {
} if (midihout[i] != NULL) {
} midiOutShortMsg(midihout[i], raw);
for (int i = 0; i < midihout.size(); i++) { }
if (midihout[i] != NULL) { }
midiOutClose(midihout[i]); } else {
} midiOutShortMsg(midihout[device], raw);
} }
midihin.clear(); }
midihout.clear();
} void Midi::sendMessage(int device, int channel, int type, int note, int velocity) {
#else int message = (channel - 1) | (type << MIDI_SHIFT_STATUS);
void Midi::sendNote(int status, int note, int vel) { if (broadcastEnabled) {
} for (int i = 0; i < midihout.size(); i++) {
if (midihout[i] != NULL) {
void Midi::MidiSetup() { midiOutShortMsg(midihout[i], message + (note << MIDI_SHIFT_NOTE) + (velocity << MIDI_SHIFT_VELOCITY));
allNotesOff(); }
} }
} else {
void Midi::MidiCleanup() { midiOutShortMsg(midihout[device], message + (note << MIDI_SHIFT_NOTE) + (velocity << MIDI_SHIFT_VELOCITY));
allNotesOff(); }
} }
#endif
void Midi::sendNote(int status, int note, int velocity) {
void Midi::noteReceived(int status, int note, int velocity) { for (int i = 0; i < midihout.size(); i++) {
if (((status & MIDI_STATUS_MASK) != MIDI_NOTE_OFF) && if (midihout[i] != NULL) {
((status & MIDI_STATUS_MASK) != MIDI_NOTE_ON) && midiOutShortMsg(midihout[i], status + (note << MIDI_SHIFT_NOTE) + (velocity << MIDI_SHIFT_VELOCITY));
((status & MIDI_STATUS_MASK) != MIDI_CONTROL_CHANGE)) { }
return; // NOTE: only sending note-on, note-off, and control-change to Javascript }
} }
QVariantMap eventData; void Midi::MidiSetup() {
eventData["status"] = status; midihin.clear();
eventData["note"] = note; midihout.clear();
eventData["velocity"] = velocity;
emit midiNote(eventData); MIDIINCAPS incaps;
} for (unsigned int i = 0; i < midiInGetNumDevs(); i++) {
midiInGetDevCaps(i, &incaps, sizeof(MIDIINCAPS));
//
bool found = false;
Midi::Midi() { for (int j = 0; j < midiinexclude.size(); j++) {
instance = this; if (midiinexclude[j].toStdString().compare(incaps.szPname) == 0) {
#if defined Q_OS_WIN32 found = true;
midioutexclude.push_back("Microsoft GS Wavetable Synth"); // we don't want to hear this thing break;
#endif }
MidiSetup(); }
} if (!found) { // EXCLUDE AN INPUT BY NAME
HMIDIIN tmphin;
Midi::~Midi() { midiInOpen(&tmphin, i, (DWORD_PTR)MidiInProc, NULL, CALLBACK_FUNCTION);
} midiInStart(tmphin);
midihin.push_back(tmphin);
void Midi::playMidiNote(int status, int note, int velocity) { }
sendNote(status, note, velocity); }
}
MIDIOUTCAPS outcaps;
void Midi::allNotesOff() { for (unsigned int i = 0; i < midiOutGetNumDevs(); i++) {
sendNote(MIDI_CONTROL_CHANGE, MIDI_CHANNEL_MODE_ALL_NOTES_OFF, 0); // all notes off midiOutGetDevCaps(i, &outcaps, sizeof(MIDIINCAPS));
}
bool found = false;
void Midi::resetDevices() { for (int j = 0; j < midioutexclude.size(); j++) {
MidiCleanup(); if (midioutexclude[j].toStdString().compare(outcaps.szPname) == 0) {
MidiSetup(); found = true;
} break;
}
void Midi::USBchanged() { }
instance->MidiCleanup(); if (!found) { // EXCLUDE AN OUTPUT BY NAME
instance->MidiSetup(); HMIDIOUT tmphout;
} midiOutOpen(&tmphout, i, (DWORD_PTR)MidiOutProc, NULL, CALLBACK_FUNCTION);
midihout.push_back(tmphout);
// }
}
QStringList Midi::listMidiDevices(bool output) {
QStringList rv; allNotesOff();
#if defined Q_OS_WIN32 //midiHardwareChange();
if (output) {
MIDIOUTCAPS outcaps; }
for (unsigned int i = 0; i < midiOutGetNumDevs(); i++) {
midiOutGetDevCaps(i, &outcaps, sizeof(MIDIINCAPS)); void Midi::MidiCleanup() {
rv.append(outcaps.szPname); allNotesOff();
}
} else { for (int i = 0; i < midihin.size(); i++) {
MIDIINCAPS incaps; if (midihin[i] != NULL) {
for (unsigned int i = 0; i < midiInGetNumDevs(); i++) { midiInStop(midihin[i]);
midiInGetDevCaps(i, &incaps, sizeof(MIDIINCAPS)); midiInClose(midihin[i]);
rv.append(incaps.szPname); }
} }
} for (int i = 0; i < midihout.size(); i++) {
#endif if (midihout[i] != NULL) {
return rv; midiOutClose(midihout[i]);
} }
}
void Midi::unblockMidiDevice(QString name, bool output) { midihin.clear();
if (output) { midihout.clear();
for (unsigned long i = 0; i < midioutexclude.size(); i++) { }
if (midioutexclude[i].toStdString().compare(name.toStdString()) == 0) { #else
midioutexclude.erase(midioutexclude.begin() + i); void Midi::sendRaw(int device, int raw) {
break; }
}
} void Midi::sendNote(int status, int note, int velocity) {
} else { }
for (unsigned long i = 0; i < midiinexclude.size(); i++) {
if (midiinexclude[i].toStdString().compare(name.toStdString()) == 0) { void Midi::sendMessage(int device, int channel, int type, int note, int velocity)
midiinexclude.erase(midiinexclude.begin() + i); }
break;
} void Midi::MidiSetup() {
} allNotesOff();
} }
}
void Midi::MidiCleanup() {
void Midi::blockMidiDevice(QString name, bool output) { allNotesOff();
unblockMidiDevice(name, output); // make sure it's only in there once }
if (output) { #endif
midioutexclude.push_back(name);
} else { void Midi::rawMidiReceived(int device, int raw) {
midiinexclude.push_back(name); QVariantMap eventData;
} eventData["device"] = device;
} eventData["raw"] = raw;
emit midiRaw(eventData);
void Midi::thruModeEnable(bool enable) { }
thruModeEnabled = enable;
} void Midi::midiReceived(int device, int raw, int channel, int status, int type, int note, int velocity, int bend, int program) {
QVariantMap eventData;
eventData["device"] = device;
eventData["raw"] = raw;
eventData["channel"] = channel;
eventData["status"] = status;
eventData["type"] = type;
eventData["note"] = note;
eventData["velocity"] = velocity;
eventData["bend"] = bend;
eventData["program"] = program;
emit midiNote(eventData);// Legacy
emit midiMessage(eventData);
}
void Midi::midiHardwareChange() {
emit midiReset();
}
//
Midi::Midi() {
instance = this;
#if defined Q_OS_WIN32
midioutexclude.push_back("Microsoft GS Wavetable Synth"); // we don't want to hear this thing (Lags)
#endif
MidiSetup();
}
Midi::~Midi() {
}
void Midi::sendRawDword(int device, int raw) {
sendRawMessage(device, raw);
}
void Midi::playMidiNote(int status, int note, int velocity) {
sendNote(status, note, velocity);
}
void Midi::sendMidiMessage(int device, int channel, int type, int note, int velocity) {
sendMessage(device, channel, type, note, velocity);
}
void Midi::allNotesOff() {
sendNote(MIDI_CONTROL_CHANGE, MIDI_CHANNEL_MODE_ALL_NOTES_OFF, 0); // all notes off
// sendMessage();// all notes off
}
void Midi::resetDevices() {
MidiCleanup();
MidiSetup();
}
void Midi::USBchanged() {
instance->MidiCleanup();
instance->MidiSetup();
instance->midiHardwareChange();
}
//
QStringList Midi::listMidiDevices(bool output) {
QStringList rv;
#if defined Q_OS_WIN32
if (output) {
MIDIOUTCAPS outcaps;
for (unsigned int i = 0; i < midiOutGetNumDevs(); i++) {
midiOutGetDevCaps(i, &outcaps, sizeof(MIDIINCAPS));
rv.append(outcaps.szPname);
}
}
else {
MIDIINCAPS incaps;
for (unsigned int i = 0; i < midiInGetNumDevs(); i++) {
midiInGetDevCaps(i, &incaps, sizeof(MIDIINCAPS));
rv.append(incaps.szPname);
}
}
#endif
return rv;
}
void Midi::unblockMidiDevice(QString name, bool output) {
if (output) {
for (unsigned long i = 0; i < midioutexclude.size(); i++) {
if (midioutexclude[i].toStdString().compare(name.toStdString()) == 0) {
midioutexclude.erase(midioutexclude.begin() + i);
break;
}
}
}
else {
for (unsigned long i = 0; i < midiinexclude.size(); i++) {
if (midiinexclude[i].toStdString().compare(name.toStdString()) == 0) {
midiinexclude.erase(midiinexclude.begin() + i);
break;
}
}
}
}
void Midi::blockMidiDevice(QString name, bool output) {
unblockMidiDevice(name, output); // make sure it's only in there once
if (output) {
midioutexclude.push_back(name);
}
else {
midiinexclude.push_back(name);
}
}
void Midi::thruModeEnable(bool enable) {
thruModeEnabled = enable;
}
void Midi::broadcastEnable(bool enable) {
broadcastEnabled = enable;
}
void Midi::typeNoteOffEnable(bool enable) {
typeNoteOffEnabled = enable;
}
void Midi::typeNoteOnEnable(bool enable) {
typeNoteOnEnabled = enable;
}
void Midi::typePolyKeyPressureEnable(bool enable) {
typePolyKeyPressureEnabled = enable;
}
void Midi::typeControlChangeEnable(bool enable) {
typeControlChangeEnabled = enable;
}
void Midi::typeProgramChangeEnable(bool enable) {
typeProgramChangeEnabled = enable;
}
void Midi::typeChanPressureEnable(bool enable) {
typeChanPressureEnabled = enable;
}
void Midi::typePitchBendEnable(bool enable) {
typePitchBendEnabled = enable;
}
void Midi::typeSystemMessageEnable(bool enable) {
typeSystemMessageEnabled = enable;
}

View file

@ -1,72 +1,100 @@
// //
// Midi.h // Midi.h
// libraries/midi/src // libraries/midi/src
// //
// Created by Burt Sloane // Created by Burt Sloane
// Copyright 2015 High Fidelity, Inc. // Modified by Bruce Brown
// // Copyright 2015 High Fidelity, Inc.
// Distributed under the Apache License, Version 2.0. //
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // Distributed under the Apache License, Version 2.0.
// // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_Midi_h
#define hifi_Midi_h #ifndef hifi_Midi_h
#define hifi_Midi_h
#include <QtCore/QObject>
#include <QAbstractNativeEventFilter> #include <QtCore/QObject>
#include <DependencyManager.h> #include <QAbstractNativeEventFilter>
#include <DependencyManager.h>
#include <vector>
#include <string> #include <vector>
#include <string>
class Midi : public QObject, public Dependency {
Q_OBJECT class Midi : public QObject, public Dependency {
SINGLETON_DEPENDENCY Q_OBJECT
SINGLETON_DEPENDENCY
public:
void noteReceived(int status, int note, int velocity); // relay a note to Javascript public:
void sendNote(int status, int note, int vel); // relay a note to MIDI outputs void rawMidiReceived(int device, int raw); //relay raw midi data to Javascript
static void USBchanged(); void midiReceived(int device, int raw, int channel, int status, int type, int note, int velocity, int bend, int program); // relay a note to Javascript
void midiHardwareChange(); // relay hardware change to Javascript
private: void sendRawMessage(int device, int raw); // relay midi message to MIDI outputs
static std::vector<QString> midiinexclude; void sendNote(int status, int note, int velocity); // relay a note to MIDI outputs
static std::vector<QString> midioutexclude; void sendMessage(int device, int channel, int type, int note, int velocity); // relay a message to MIDI outputs, Future add: (int device)
static void USBchanged();
private:
void MidiSetup(); private:
void MidiCleanup(); static std::vector<QString> midiinexclude;
static std::vector<QString> midioutexclude;
signals:
void midiNote(QVariantMap eventData); private:
void MidiSetup();
public slots: void MidiCleanup();
/// play a note on all connected devices
/// @param {int} status: 0x80 is noteoff, 0x90 is noteon (if velocity=0, noteoff), etc signals:
/// @param {int} note: midi note number void midiNote(QVariantMap eventData);
/// @param {int} velocity: note velocity (0 means noteoff) void midiMessage(QVariantMap eventData);
Q_INVOKABLE void playMidiNote(int status, int note, int velocity); void midiRaw(QVariantMap eventData);
void midiReset();
/// turn off all notes on all connected devices
Q_INVOKABLE void allNotesOff(); public slots:
// Send Raw Midi Packet to all connected devices
/// clean up and re-discover attached devices Q_INVOKABLE void sendRawDword(int device, int raw);
Q_INVOKABLE void resetDevices();
// Send Midi Message to all connected devices
/// ask for a list of inputs/outputs Q_INVOKABLE void sendMidiMessage(int device, int channel, int type, int note, int velocity);
Q_INVOKABLE QStringList listMidiDevices(bool output); /// play a note on all connected devices
/// @param {int} status: 0x80 is noteoff, 0x90 is noteon (if velocity=0, noteoff), etc
/// block an input/output by name /// @param {int} note: midi note number
Q_INVOKABLE void blockMidiDevice(QString name, bool output); /// @param {int} velocity: note velocity (0 means noteoff)
/// unblock an input/output by name Q_INVOKABLE void playMidiNote(int status, int note, int velocity);
Q_INVOKABLE void unblockMidiDevice(QString name, bool output);
/// turn off all notes on all connected devices
/// repeat all incoming notes to all outputs (default disabled) Q_INVOKABLE void allNotesOff();
Q_INVOKABLE void thruModeEnable(bool enable);
/// clean up and re-discover attached devices
public: Q_INVOKABLE void resetDevices();
Midi();
virtual ~Midi(); /// ask for a list of inputs/outputs
}; Q_INVOKABLE QStringList listMidiDevices(bool output);
#endif // hifi_Midi_h /// block an input/output by name
Q_INVOKABLE void blockMidiDevice(QString name, bool output);
/// unblock an input/output by name
Q_INVOKABLE void unblockMidiDevice(QString name, bool output);
/// repeat all incoming notes to all outputs (default disabled)
Q_INVOKABLE void thruModeEnable(bool enable);
/// broadcast on all unblocked devices
Q_INVOKABLE void broadcastEnable(bool enable);
/// filter by event types
Q_INVOKABLE void typeNoteOffEnable(bool enable);
Q_INVOKABLE void typeNoteOnEnable(bool enable);
Q_INVOKABLE void typePolyKeyPressureEnable(bool enable);
Q_INVOKABLE void typeControlChangeEnable(bool enable);
Q_INVOKABLE void typeProgramChangeEnable(bool enable);
Q_INVOKABLE void typeChanPressureEnable(bool enable);
Q_INVOKABLE void typePitchBendEnable(bool enable);
Q_INVOKABLE void typeSystemMessageEnable(bool enable);
public:
Midi();
virtual ~Midi();
};
#endif // hifi_Midi_h