Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / kits / midi / SoftSynth.h
blobccd7cb4b9dc0eb86ee789892253c62b1508ec5c0
1 /*
2 * Copyright 2006-2014, Haiku.
3 *
4 * Copyright (c) 2004-2005 Matthijs Hollemans
5 * Copyright (c) 2003 Jerome Leveque
6 * Distributed under the terms of the MIT License.
8 * Authors:
9 * Jérôme Duval
10 * Jérôme Leveque
11 * Matthijs Hollemans
12 * Pete Goodeve
15 #ifndef _SOFT_SYNTH_H
16 #define _SOFT_SYNTH_H
19 This version of SoftSynth is a wrapper libfluidsynth.so.
22 #include <fluidsynth.h>
23 #include <Midi.h>
24 #include <SoundPlayer.h>
25 #include <Synth.h>
27 class BMidiConsumer;
28 class BMidiSynth;
29 class BSynth;
31 namespace BPrivate {
33 class BSoftSynth {
34 public:
35 bool InitCheck();
37 void Unload();
38 bool IsLoaded() const;
40 status_t SetDefaultInstrumentsFile();
41 status_t SetInstrumentsFile(const char* path);
43 status_t LoadAllInstruments();
44 status_t LoadInstrument(int16 instrument);
45 status_t UnloadInstrument(int16 instrument);
46 status_t RemapInstrument(int16 from, int16 to);
47 void FlushInstrumentCache(bool startStopCache);
49 void SetVolume(double volume);
50 double Volume(void) const;
52 status_t SetSamplingRate(int32 rate);
53 int32 SamplingRate() const;
55 status_t SetInterpolation(interpolation_mode mode);
56 interpolation_mode Interpolation() const;
58 status_t EnableReverb(bool enabled);
59 bool IsReverbEnabled() const;
60 void SetReverb(reverb_mode mode);
61 reverb_mode Reverb() const;
63 status_t SetMaxVoices(int32 max);
64 int16 MaxVoices(void) const;
66 status_t SetLimiterThreshold(int32 threshold);
67 int16 LimiterThreshold(void) const;
69 void Pause(void);
70 void Resume(void);
72 void NoteOff(uchar, uchar, uchar, uint32);
73 void NoteOn(uchar, uchar, uchar, uint32);
74 void KeyPressure(uchar, uchar, uchar, uint32);
75 void ControlChange(uchar, uchar, uchar, uint32);
76 void ProgramChange(uchar, uchar, uint32);
77 void ChannelPressure(uchar, uchar, uint32);
78 void PitchBend(uchar, uchar, uchar, uint32);
79 void SystemExclusive(void*, size_t, uint32);
80 void SystemCommon(uchar, uchar, uchar, uint32);
81 void SystemRealTime(uchar, uint32);
82 void TempoChange(int32, uint32);
83 void AllNotesOff(bool, uint32);
85 private:
87 friend class ::BSynth;
88 friend class ::BMidiSynth;
90 BSoftSynth();
91 ~BSoftSynth();
93 void _Init();
94 void _Done();
95 static void PlayBuffer(void* cookie, void* data, size_t size,
96 const media_raw_audio_format& format);
98 bool fInitCheck;
99 char* fInstrumentsFile;
100 int32 fSampleRate;
101 interpolation_mode fInterpMode;
102 int16 fMaxVoices;
103 int16 fLimiterThreshold;
104 reverb_mode fReverbMode;
105 bool fReverbEnabled;
107 fluid_synth_t* fSynth;
108 fluid_settings_t* fSettings;
110 BSoundPlayer* fSoundPlayer;
112 float* fMonitor;
113 size_t fMonitorSize;
114 int16 fMonitorChans;
117 } // namespace BPrivate
119 #endif // _SOFT_SYNTH_H