1 2 #ifndef _SYNTH_H 3 #define _SYNTH_H 4 5 #include <BeBuild.h> 6 #include <Entry.h> 7 #include <MidiDefs.h> 8 #include <OS.h> 9 10 typedef enum interpolation_mode 11 { 12 B_DROP_SAMPLE = 0, 13 B_2_POINT_INTERPOLATION, 14 B_LINEAR_INTERPOLATION 15 } 16 interpolation_mode; 17 18 typedef enum reverb_mode 19 { 20 B_REVERB_NONE = 1, 21 B_REVERB_CLOSET, 22 B_REVERB_GARAGE, 23 B_REVERB_BALLROOM, 24 B_REVERB_CAVERN, 25 B_REVERB_DUNGEON 26 } 27 reverb_mode; 28 29 typedef void (*synth_controller_hook) ( 30 int16 channel, int16 controller, int16 value); 31 32 class BMidiSynth; 33 class BMidiSynthFile; 34 35 namespace BPrivate { class BSoftSynth; } 36 37 class BSynth 38 { 39 public: 40 41 BSynth(); 42 BSynth(synth_mode synth); 43 virtual ~BSynth(); 44 45 status_t LoadSynthData(entry_ref* instrumentsFile); 46 status_t LoadSynthData(synth_mode synth); 47 synth_mode SynthMode(void); 48 49 void Unload(void); 50 bool IsLoaded(void) const; 51 52 status_t SetSamplingRate(int32 sample_rate); 53 int32 SamplingRate() const; 54 55 status_t SetInterpolation(interpolation_mode interp_mode); 56 interpolation_mode Interpolation() const; 57 58 void SetReverb(reverb_mode rev_mode); 59 reverb_mode Reverb() const; 60 61 status_t EnableReverb(bool reverb_enabled); 62 bool IsReverbEnabled() const; 63 64 status_t SetVoiceLimits( 65 int16 maxSynthVoices, int16 maxSampleVoices, 66 int16 limiterThreshhold); 67 68 int16 MaxSynthVoices(void) const; 69 int16 MaxSampleVoices(void) const; 70 int16 LimiterThreshhold(void) const; 71 72 void SetSynthVolume(double theVolume); 73 double SynthVolume(void) const; 74 75 void SetSampleVolume(double theVolume); 76 double SampleVolume(void) const; 77 78 status_t GetAudio( 79 int16* pLeft, int16* pRight, int32 max_samples) const; 80 81 void Pause(void); 82 void Resume(void); 83 84 void SetControllerHook(int16 controller, synth_controller_hook cback); 85 86 int32 CountClients(void) const; 87 88 private: 89 90 friend BMidiSynth; 91 friend BMidiSynthFile; 92 93 virtual void _ReservedSynth1(); 94 virtual void _ReservedSynth2(); 95 virtual void _ReservedSynth3(); 96 virtual void _ReservedSynth4(); 97 98 void Init(); 99 100 BPrivate::BSoftSynth* synth; 101 synth_mode synthMode; 102 int32 clientCount; 103 104 uint32 _reserved[10]; 105 }; 106 107 extern _IMPEXP_MIDI BSynth* be_synth; 108 109 #endif // _SYNTH_H 110