1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
/*
* MidiWinMM.h - WinMM MIDI client
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef MIDI_WINMM_H
#define MIDI_WINMM_H
#include "lmmsconfig.h"
#ifdef LMMS_BUILD_WIN32
#include <windows.h>
#include <mmsystem.h>
#include "MidiClient.h"
#include "MidiPort.h"
class QLineEdit;
class MidiWinMM : public QObject, public MidiClient
{
Q_OBJECT
public:
MidiWinMM();
virtual ~MidiWinMM();
inline static QString probeDevice()
{
return QString::Null(); // no midi device name
}
inline static QString name()
{
return QT_TRANSLATE_NOOP( "MidiSetupWidget", "WinMM MIDI" );
}
inline static QString configSection()
{
return QString::Null(); // no configuration settings
}
virtual void processOutEvent( const MidiEvent & _me,
const MidiTime & _time,
const MidiPort * _port );
virtual void applyPortMode( MidiPort * _port );
virtual void removePort( MidiPort * _port );
// list devices as ports
virtual QStringList readablePorts() const
{
return m_inputDevices.values();
}
virtual QStringList writablePorts() const
{
return m_outputDevices.values();
}
// return name of port which specified MIDI event came from
virtual QString sourcePortName( const MidiEvent & ) const;
// (un)subscribe given MidiPort to/from destination-port
virtual void subscribeReadablePort( MidiPort * _port,
const QString & _dest,
bool _subscribe = true );
virtual void subscribeWritablePort( MidiPort * _port,
const QString & _dest,
bool _subscribe = true );
virtual void connectRPChanged( QObject * _receiver,
const char * _member )
{
connect( this, SIGNAL( readablePortsChanged() ),
_receiver, _member );
}
virtual void connectWPChanged( QObject * _receiver,
const char * _member )
{
connect( this, SIGNAL( writablePortsChanged() ),
_receiver, _member );
}
virtual bool isRaw() const
{
return false;
}
private:// slots:
void updateDeviceList();
private:
void openDevices();
void closeDevices();
static void WINAPI CALLBACK inputCallback( HMIDIIN _hm, UINT _msg,
DWORD_PTR _inst,
DWORD_PTR _param1,
DWORD_PTR _param2 );
void handleInputEvent( HMIDIIN _hm, DWORD _ev );
QMap<HMIDIIN, QString> m_inputDevices;
QMap<HMIDIOUT, QString> m_outputDevices;
// subscriptions
typedef QMap<QString, MidiPortList> SubMap;
SubMap m_inputSubs;
SubMap m_outputSubs;
signals:
void readablePortsChanged();
void writablePortsChanged();
} ;
#endif
#endif
|