mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:44:21 +02:00
fix stubbing of MIDIManager if HAVE_RTMIDI not defined
This commit is contained in:
parent
dd8f7e81b1
commit
171660ded7
2 changed files with 13 additions and 9 deletions
|
@ -13,14 +13,13 @@
|
|||
|
||||
#include "MIDIManager.h"
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
|
||||
MIDIManager& MIDIManager::getInstance() {
|
||||
static MIDIManager sharedInstance;
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
void MIDIManager::midiCallback(double deltaTime, std::vector<unsigned char>* message, void* userData) {
|
||||
#ifdef HAVE_RTMIDI
|
||||
|
||||
MIDIEvent callbackEvent;
|
||||
callbackEvent.deltaTime = deltaTime;
|
||||
|
@ -36,15 +35,19 @@ void MIDIManager::midiCallback(double deltaTime, std::vector<unsigned char>* mes
|
|||
}
|
||||
|
||||
emit getInstance().midiEvent(callbackEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
MIDIManager::~MIDIManager() {
|
||||
#ifdef HAVE_RTMIDI
|
||||
delete _midiInput;
|
||||
#endif
|
||||
}
|
||||
|
||||
const int DEFAULT_MIDI_PORT = 0;
|
||||
|
||||
void MIDIManager::openDefaultPort() {
|
||||
#ifdef HAVE_RTMIDI
|
||||
if (!_midiInput) {
|
||||
_midiInput = new RtMidiIn();
|
||||
|
||||
|
@ -63,6 +66,5 @@ void MIDIManager::openDefaultPort() {
|
|||
_midiInput = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -12,15 +12,17 @@
|
|||
#ifndef hifi_MIDIManager_h
|
||||
#define hifi_MIDIManager_h
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtScript/QScriptEngine>
|
||||
|
||||
#include <MIDIEvent.h>
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
|
||||
#include <RtMidi.h>
|
||||
|
||||
#endif
|
||||
|
||||
class MIDIManager : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -46,11 +48,11 @@ signals:
|
|||
void midiEvent(const MIDIEvent& event);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_RTMIDI
|
||||
RtMidiIn* _midiInput;
|
||||
#endif HAVE_RTMIDI
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // hifi_MIDIManager_h
|
||||
|
||||
|
|
Loading…
Reference in a new issue