Canorus
0.7
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
interface
mididevice.h
Go to the documentation of this file.
1
8
#ifndef MIDIDEVICE_H_
9
#define MIDIDEVICE_H_
10
11
#include <QStringList>
12
#include <QVector>
13
#include <QMap>
14
#include <QString>
15
#include <QObject>
16
17
#include "
core/diatonicpitch.h
"
18
19
class
CASheet
;
20
class
CADiatonicKey
;
21
22
class
CAMidiDevice
:
public
QObject
{
23
#ifndef SWIG
24
Q_OBJECT
25
#endif
26
27
friend
void
rtMidiInCallback
(
double
deltatime, std::vector< unsigned char > *message,
void
*userData );
28
public
:
29
enum
CAMidiDeviceType
{
30
RtMidiDevice
,
31
MidiExportDevice
32
};
33
34
CAMidiDevice
();
35
36
enum
midiCommands
{
37
Meta_Text
= 0x01,
38
Meta_Copyright
= 0x02,
39
Meta_SeqTrkName
= 0x03,
40
Meta_InstrName
= 0x04,
41
Meta_Lyric
= 0x05,
42
Meta_Marker
= 0x06,
43
Meta_CuePoint
= 0x07,
44
Meta_Tempo
= 0x51,
// len=03 tt tt tt microseconds per midi quarter note
45
Meta_SMPTEOffs
= 0x54,
// len=05 hr mn se fr ff SMPTE Offset
46
Meta_Timesig
= 0x58,
47
Meta_Keysig
= 0x59,
48
Meta_Track_End
= 0x2f,
49
50
Midi_Ctl_Reverb
= 0x5b,
51
Midi_Ctl_Chorus
= 0x5d,
52
Midi_Ctl_Pan
= 0x0a,
53
Midi_Ctl_Volume
= 0x07,
54
Midi_Ctl_Sustain
= 0x40,
55
Midi_Ctl_Event
= 0xff,
56
// Events with midi channel on the low nibble:
57
Midi_Note_Off
= 0x80,
// 3 byte
58
Midi_Note_On
= 0x90,
59
Midi_Prog_Change
= 0xc0,
// 2 byte
60
Midi_Control_Chg
= 0xb0
// 3 byte
61
};
62
63
64
QStringList
GM_INSTRUMENTS
;
65
static
unsigned
char
freeMidiChannel
(
CASheet
* );
66
67
virtual
~CAMidiDevice
() {};
68
69
inline
CAMidiDeviceType
midiDeviceType
() {
return
_midiDeviceType
; };
70
71
bool
isRealTime
() {
return
_realTime
; }
72
virtual
QMap<int, QString>
getOutputPorts
() = 0;
73
virtual
QMap<int, QString>
getInputPorts
() = 0;
74
75
virtual
bool
openOutputPort
(
int
port) = 0;
// return true on success, false otherwise
76
virtual
bool
openInputPort
(
int
port) = 0;
// return true on success, false otherwise
77
virtual
void
closeOutputPort
() = 0;
78
virtual
void
closeInputPort
() = 0;
79
virtual
void
send
(QVector<unsigned char> message,
int
mSeconds=0) = 0;
// message and absolute time of the message in miliseconds
80
81
#ifndef SWIG
82
signals:
83
void
midiInEvent
( QVector< unsigned char > message );
84
#endif
85
86
public
:
87
static
int
diatonicPitchToMidiPitch
(
CADiatonicPitch
);
88
static
CADiatonicPitch
midiPitchToDiatonicPitch
(
int
);
89
static
CADiatonicPitch
midiPitchToDiatonicPitch
(
int
,
CADiatonicKey
k );
90
91
protected
:
92
void
setRealTime
(
bool
r ) {
_realTime
= r; }
93
inline
void
setMidiDeviceType
(
CAMidiDeviceType
t ) {
_midiDeviceType
= t; }
94
CAMidiDeviceType
_midiDeviceType
;
95
bool
_realTime
;
// is the device
96
};
97
98
#endif
/* MIDIDEVICE_H_ */
Generated on Fri Jan 11 2013 14:40:12 for Canorus by
1.8.3