xref: /haiku/src/apps/midiplayer/SynthBridge.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright (c) 2004 Matthijs Hollemans
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef SYNTH_BRIDGE_H
24 #define SYNTH_BRIDGE_H
25 
26 #include <MidiConsumer.h>
27 #include <MidiSynth.h>
28 
29 class SynthBridge : public BMidiLocalConsumer
30 {
31 public:
32 
33 	SynthBridge();
34 
35 	bool Init(synth_mode mode);
36 
37 	BMidiSynth* MidiSynth();
38 
39 	virtual	void NoteOff(
40 		uchar channel, uchar note, uchar velocity, bigtime_t time);
41 
42 	virtual	void NoteOn(
43 		uchar channel, uchar note, uchar velocity, bigtime_t time);
44 
45 	virtual	void KeyPressure(
46 		uchar channel, uchar note, uchar pressure, bigtime_t time);
47 
48 	virtual	void ControlChange(
49 		uchar channel, uchar controlNumber, uchar controlValue,
50 		bigtime_t time);
51 
52 	virtual	void ProgramChange(
53 		uchar channel, uchar programNumber, bigtime_t time);
54 
55 	virtual	void ChannelPressure(
56 		uchar channel, uchar pressure, bigtime_t time);
57 
58 	virtual	void PitchBend(
59 		uchar channel, uchar lsb, uchar msb, bigtime_t time);
60 
61 	virtual void AllNotesOff(
62 		bool justChannel, bigtime_t time);
63 
64 protected:
65 
66 	virtual ~SynthBridge() { }
67 
68 private:
69 
70 	BMidiSynth midiSynth;
71 };
72 
73 #endif // SYNTH_BRIDGE_H
74