xref: /haiku/headers/os/midi/MidiSynth.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 
2 #ifndef _MIDI_SYNTH_H
3 #define _MIDI_SYNTH_H
4 
5 #include <BeBuild.h>
6 #include <Midi.h>
7 #include <Synth.h>
8 #include <MidiDefs.h>
9 
10 class BSynth;
11 
12 class BMidiSynth : public BMidi {
13 public:
14 
15 	BMidiSynth();
16 	virtual ~BMidiSynth();
17 
18 	status_t EnableInput(bool enable, bool loadInstruments);
19 	bool IsInputEnabled(void) const;
20 
21 	void SetVolume(double volume);
22 	double Volume(void) const;
23 
24 	void SetTransposition(int16 offset);
25 	int16 Transposition(void) const;
26 
27 	void MuteChannel(int16 channel, bool do_mute);
28 	void GetMuteMap(char* pChannels) const;
29 
30 	void SoloChannel(int16 channel, bool do_solo);
31 	void GetSoloMap(char* pChannels) const;
32 
33 	status_t LoadInstrument(int16 instrument);
34 	status_t UnloadInstrument(int16 instrument);
35 	status_t RemapInstrument(int16 from, int16 to);
36 
37 	void FlushInstrumentCache(bool startStopCache);
38 
39 	uint32 Tick(void) const;
40 
41 	virtual void NoteOff(
42 		uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
43 
44 	virtual void NoteOn(
45 		uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
46 
47 	virtual void KeyPressure(
48 		uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
49 
50 	virtual void ControlChange(
51 		uchar channel, uchar controlNumber, uchar controlValue,
52 		uint32 time = B_NOW);
53 
54 	virtual void ProgramChange(
55 		uchar channel, uchar programNumber, uint32 time = B_NOW);
56 
57 	virtual void ChannelPressure(
58 		uchar channel, uchar pressure, uint32 time = B_NOW);
59 
60 	virtual void PitchBend(
61 		uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
62 
63 	virtual void AllNotesOff(bool justChannel, uint32 time = B_NOW);
64 
65 protected:
66 
67 	void* fSongVariables;
68 	void* fPerformanceVariables;
69 	bool fMidiQueue;
70 
71 private:
72 
73 	friend class BSynth;
74 
75 	virtual void _ReservedMidiSynth1();
76 	virtual void _ReservedMidiSynth2();
77 	virtual void _ReservedMidiSynth3();
78 	virtual void _ReservedMidiSynth4();
79 
80 	virtual void Run();
81 
82 	bigtime_t fCreationTime;
83 	int16 fTranspose;
84 	bool fInputEnabled;
85 };
86 
87 #endif // _MIDI_SYNTH_H
88