Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/midi/midideviceportmidi.h

Go to the documentation of this file.
00001 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef MIDIDEVICEPORTMIDI_H
00019 #define MIDIDEVICEPORTMIDI_H
00020 
00021 #include <portmidi.h>
00022 #include <porttime.h>
00023 #include <QtCore>
00024 #include "mididevice.h"
00025 
00026 #define MIXXX_PORTMIDI_BUFFER_LEN 64 
00027 #define MIXXX_PORTMIDI_NO_DEVICE_STRING "None" 
00033 class MidiDevicePortMidi : public MidiDevice {
00034 public:
00035     MidiDevicePortMidi(MidiMapping* mapping, 
00036                        const PmDeviceInfo* inputDeviceInfo, 
00037                        const PmDeviceInfo* outputDeviceInfo, 
00038                        int inputDeviceIndex,
00039                        int outputDeviceIndex);
00040     ~MidiDevicePortMidi();
00041     int open();
00042     int close();
00043     void sendShortMsg(unsigned int word);
00044     void sendSysexMsg(unsigned char data[], unsigned int length);
00045 protected:
00046     void run();
00047     const PmDeviceInfo* m_pInputDeviceInfo;
00048     const PmDeviceInfo* m_pOutputDeviceInfo;
00049     int m_iInputDeviceIndex;
00050     int m_iOutputDeviceIndex;
00051     PortMidiStream *m_pInputStream;
00052     PortMidiStream *m_pOutputStream;
00053     PmEvent m_midiBuffer[MIXXX_PORTMIDI_BUFFER_LEN];
00054     static QList<QString> m_deviceList;
00055     QMutex m_mutex;         
00056     static QMutex m_sPMLock;    // PortMidi is not thread-safe, so we need to only allow one thread at a time
00057     bool m_bStopRequested;
00058 };
00059 
00060 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines