1 /* 2 * Copyright (c) 2004 Matthijs Hollemans 3 * Copyright (c) 2003 Jerome Leveque 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24 #ifndef _SOFT_SYNTH_H 25 #define _SOFT_SYNTH_H 26 27 #include <Midi.h> 28 #include <Synth.h> 29 30 namespace BPrivate { 31 32 class BSoftSynth 33 { 34 public: 35 36 void Unload(void); 37 bool IsLoaded(void) const; 38 39 status_t SetDefaultInstrumentsFile(); 40 status_t SetInstrumentsFile(const char* path); 41 42 status_t LoadAllInstruments(); 43 status_t LoadInstrument(int16 instrument); 44 status_t UnloadInstrument(int16 instrument); 45 status_t RemapInstrument(int16 from, int16 to); 46 void FlushInstrumentCache(bool startStopCache); 47 48 void SetVolume(double volume); 49 double Volume(void) const; 50 51 status_t SetSamplingRate(int32 rate); 52 int32 SamplingRate() const; 53 54 status_t SetInterpolation(interpolation_mode mode); 55 interpolation_mode Interpolation() const; 56 57 status_t EnableReverb(bool enabled); 58 bool IsReverbEnabled() const; 59 void SetReverb(reverb_mode mode); 60 reverb_mode Reverb() const; 61 62 status_t SetMaxVoices(int32 max); 63 int16 MaxVoices(void) const; 64 65 status_t SetLimiterThreshold(int32 threshold); 66 int16 LimiterThreshold(void) const; 67 68 void Pause(void); 69 void Resume(void); 70 71 void NoteOff(uchar, uchar, uchar, uint32); 72 void NoteOn(uchar, uchar, uchar, uint32); 73 void KeyPressure(uchar, uchar, uchar, uint32); 74 void ControlChange(uchar, uchar, uchar, uint32); 75 void ProgramChange(uchar, uchar, uint32); 76 void ChannelPressure(uchar, uchar, uint32); 77 void PitchBend(uchar, uchar, uchar, uint32); 78 void SystemExclusive(void*, size_t, uint32); 79 void SystemCommon(uchar, uchar, uchar, uint32); 80 void SystemRealTime(uchar, uint32); 81 void TempoChange(int32, uint32); 82 void AllNotesOff(bool, uint32); 83 84 private: 85 86 friend class BSynth; 87 friend class BMidiSynth; 88 89 BSoftSynth(); 90 ~BSoftSynth(); 91 92 char* instrumentsFile; 93 int32 sampleRate; 94 interpolation_mode interpMode; 95 int16 maxVoices; 96 int16 limiterThreshold; 97 reverb_mode reverbMode; 98 bool reverbEnabled; 99 double volumeScale; 100 }; 101 102 } // namespace BPrivate 103 104 #endif // _SYNTH_CONSUMER_H 105