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