2
* @file midideviceportmidi.h
3
* @author Albert Santoni alberts@mixxx.org
4
* @date Thu Dec 18 2008
5
* @brief PortMidi-based MIDI backend
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#ifndef MIDIDEVICEPORTMIDI_H
19
#define MIDIDEVICEPORTMIDI_H
24
#include "mididevice.h"
26
#define MIXXX_PORTMIDI_BUFFER_LEN 64 /**Number of MIDI messages to buffer*/
27
#define MIXXX_PORTMIDI_NO_DEVICE_STRING "None" /**String to display for no MIDI devices present */
29
*@author Albert Santoni
32
/** A PortMidi-based implementation of MidiDevice */
33
class MidiDevicePortMidi : public MidiDevice {
35
MidiDevicePortMidi(MidiMapping* mapping,
36
const PmDeviceInfo* inputDeviceInfo,
37
const PmDeviceInfo* outputDeviceInfo,
39
int outputDeviceIndex);
40
~MidiDevicePortMidi();
43
void sendShortMsg(unsigned int word);
44
void sendSysexMsg(unsigned char data[], unsigned int length);
47
const PmDeviceInfo* m_pInputDeviceInfo;
48
const PmDeviceInfo* m_pOutputDeviceInfo;
49
int m_iInputDeviceIndex;
50
int m_iOutputDeviceIndex;
51
PortMidiStream *m_pInputStream;
52
PortMidiStream *m_pOutputStream;
53
PmEvent m_midiBuffer[MIXXX_PORTMIDI_BUFFER_LEN];
54
static QList<QString> m_deviceList;
55
QMutex m_mutex; /** Protects access to this object. Makes it thread safe. */
56
static QMutex m_sPMLock; // PortMidi is not thread-safe, so we need to only allow one thread at a time
57
bool m_bStopRequested;