2 * Copyright 2006, Haiku.
4 * Copyright (c) 2003 Matthijs Hollemans
5 * Copyright (c) 2002 Jerome Leveque
6 * Distributed under the terms of the MIT License.
17 using namespace BPrivate
;
20 BMidiGlue::BMidiGlue(BMidi
* midiObject_
, const char* name
)
21 : BMidiLocalConsumer(name
)
23 fMidiObject
= midiObject_
;
29 uchar channel
, uchar note
, uchar velocity
, bigtime_t time
)
31 fMidiObject
->NoteOff(channel
+ 1, note
, velocity
, MAKE_TIME(time
));
37 uchar channel
, uchar note
, uchar velocity
, bigtime_t time
)
39 fMidiObject
->NoteOn(channel
+ 1, note
, velocity
, MAKE_TIME(time
));
44 BMidiGlue::KeyPressure(
45 uchar channel
, uchar note
, uchar pressure
, bigtime_t time
)
47 fMidiObject
->KeyPressure(channel
+ 1, note
, pressure
, MAKE_TIME(time
));
52 BMidiGlue::ControlChange(
53 uchar channel
, uchar controlNumber
, uchar controlValue
, bigtime_t time
)
55 fMidiObject
->ControlChange(
56 channel
+ 1, controlNumber
, controlValue
, MAKE_TIME(time
));
61 BMidiGlue::ProgramChange(
62 uchar channel
, uchar programNumber
, bigtime_t time
)
64 fMidiObject
->ProgramChange(channel
+ 1, programNumber
, MAKE_TIME(time
));
69 BMidiGlue::ChannelPressure(
70 uchar channel
, uchar pressure
, bigtime_t time
)
72 fMidiObject
->ChannelPressure(channel
+ 1, pressure
, MAKE_TIME(time
));
78 uchar channel
, uchar lsb
, uchar msb
, bigtime_t time
)
80 fMidiObject
->PitchBend(channel
+ 1, lsb
, msb
, MAKE_TIME(time
));
85 BMidiGlue::SystemExclusive(
86 void* data
, size_t length
, bigtime_t time
)
88 fMidiObject
->SystemExclusive(data
, length
, MAKE_TIME(time
));
93 BMidiGlue::SystemCommon(
94 uchar status
, uchar data1
, uchar data2
, bigtime_t time
)
96 fMidiObject
->SystemCommon(status
, data1
, data2
, MAKE_TIME(time
));
101 BMidiGlue::SystemRealTime(uchar status
, bigtime_t time
)
103 fMidiObject
->SystemRealTime(status
, MAKE_TIME(time
));
108 BMidiGlue::TempoChange(int32 beatsPerMinute
, bigtime_t time
)
110 fMidiObject
->TempoChange(beatsPerMinute
, MAKE_TIME(time
));
114 BMidiPortGlue::BMidiPortGlue(BMidiPort
* midiObject_
, const char* name
)
115 : BMidiLocalConsumer(name
)
117 fMidiObject
= midiObject_
;
122 BMidiPortGlue::NoteOff(
123 uchar channel
, uchar note
, uchar velocity
, bigtime_t time
)
125 fMidiObject
->SprayNoteOff(channel
+ 1, note
, velocity
, MAKE_TIME(time
));
130 BMidiPortGlue::NoteOn(
131 uchar channel
, uchar note
, uchar velocity
, bigtime_t time
)
133 fMidiObject
->SprayNoteOn(channel
+ 1, note
, velocity
, MAKE_TIME(time
));
138 BMidiPortGlue::KeyPressure(
139 uchar channel
, uchar note
, uchar pressure
, bigtime_t time
)
141 fMidiObject
->SprayKeyPressure(
142 channel
+ 1, note
, pressure
, MAKE_TIME(time
));
147 BMidiPortGlue::ControlChange(
148 uchar channel
, uchar controlNumber
, uchar controlValue
, bigtime_t time
)
150 fMidiObject
->SprayControlChange(
151 channel
+ 1, controlNumber
, controlValue
, MAKE_TIME(time
));
156 BMidiPortGlue::ProgramChange(
157 uchar channel
, uchar programNumber
, bigtime_t time
)
159 fMidiObject
->SprayProgramChange(
160 channel
+ 1, programNumber
, MAKE_TIME(time
));
165 BMidiPortGlue::ChannelPressure(
166 uchar channel
, uchar pressure
, bigtime_t time
)
168 fMidiObject
->SprayChannelPressure(channel
+ 1, pressure
, MAKE_TIME(time
));
173 BMidiPortGlue::PitchBend(
174 uchar channel
, uchar lsb
, uchar msb
, bigtime_t time
)
176 fMidiObject
->SprayPitchBend(channel
+ 1, lsb
, msb
, MAKE_TIME(time
));
181 BMidiPortGlue::SystemExclusive(
182 void* data
, size_t length
, bigtime_t time
)
184 fMidiObject
->SpraySystemExclusive(data
, length
, MAKE_TIME(time
));
189 BMidiPortGlue::SystemCommon(
190 uchar status
, uchar data1
, uchar data2
, bigtime_t time
)
192 fMidiObject
->SpraySystemCommon(status
, data1
, data2
, MAKE_TIME(time
));
197 BMidiPortGlue::SystemRealTime(uchar status
, bigtime_t time
)
199 fMidiObject
->SpraySystemRealTime(status
, MAKE_TIME(time
));
204 BMidiPortGlue::TempoChange(int32 beatsPerMinute
, bigtime_t time
)
206 fMidiObject
->SprayTempoChange(beatsPerMinute
, MAKE_TIME(time
));