14b867062Sbeveloper 24b867062Sbeveloper #ifndef _SYNTH_H 34b867062Sbeveloper #define _SYNTH_H 44b867062Sbeveloper 54b867062Sbeveloper #include <BeBuild.h> 64b867062Sbeveloper #include <Entry.h> 74b867062Sbeveloper #include <MidiDefs.h> 84b867062Sbeveloper #include <OS.h> 94b867062Sbeveloper 104b867062Sbeveloper typedef enum interpolation_mode 114b867062Sbeveloper { 124b867062Sbeveloper B_DROP_SAMPLE = 0, 134b867062Sbeveloper B_2_POINT_INTERPOLATION, 144b867062Sbeveloper B_LINEAR_INTERPOLATION 15173d0cd7Smahlzeit } 16173d0cd7Smahlzeit interpolation_mode; 174b867062Sbeveloper 184b867062Sbeveloper typedef enum reverb_mode 194b867062Sbeveloper { 204b867062Sbeveloper B_REVERB_NONE = 1, 214b867062Sbeveloper B_REVERB_CLOSET, 224b867062Sbeveloper B_REVERB_GARAGE, 234b867062Sbeveloper B_REVERB_BALLROOM, 244b867062Sbeveloper B_REVERB_CAVERN, 254b867062Sbeveloper B_REVERB_DUNGEON 26173d0cd7Smahlzeit } 27173d0cd7Smahlzeit reverb_mode; 284b867062Sbeveloper 29173d0cd7Smahlzeit typedef void (*synth_controller_hook) ( 30173d0cd7Smahlzeit int16 channel, int16 controller, int16 value); 31173d0cd7Smahlzeit 324b867062Sbeveloper class BMidiSynth; 334b867062Sbeveloper class BMidiSynthFile; 344b867062Sbeveloper 351b13b75fSmahlzeit namespace BPrivate { class BSoftSynth; } 361b13b75fSmahlzeit 37*d553b90cSStefano Ceccherini class BSynth { 384b867062Sbeveloper public: 3938c7401eSmahlzeit 404b867062Sbeveloper BSynth(); 414b867062Sbeveloper BSynth(synth_mode synth); 424b867062Sbeveloper virtual ~BSynth(); 434b867062Sbeveloper 444b867062Sbeveloper status_t LoadSynthData(entry_ref* instrumentsFile); 454b867062Sbeveloper status_t LoadSynthData(synth_mode synth); 464b867062Sbeveloper synth_mode SynthMode(void); 474b867062Sbeveloper 484b867062Sbeveloper void Unload(void); 494b867062Sbeveloper bool IsLoaded(void) const; 504b867062Sbeveloper 514b867062Sbeveloper status_t SetSamplingRate(int32 sample_rate); 524b867062Sbeveloper int32 SamplingRate() const; 534b867062Sbeveloper 544b867062Sbeveloper status_t SetInterpolation(interpolation_mode interp_mode); 554b867062Sbeveloper interpolation_mode Interpolation() const; 564b867062Sbeveloper 574b867062Sbeveloper void SetReverb(reverb_mode rev_mode); 584b867062Sbeveloper reverb_mode Reverb() const; 594b867062Sbeveloper 604b867062Sbeveloper status_t EnableReverb(bool reverb_enabled); 614b867062Sbeveloper bool IsReverbEnabled() const; 624b867062Sbeveloper 63173d0cd7Smahlzeit status_t SetVoiceLimits( 64173d0cd7Smahlzeit int16 maxSynthVoices, int16 maxSampleVoices, 654b867062Sbeveloper int16 limiterThreshhold); 664b867062Sbeveloper 674b867062Sbeveloper int16 MaxSynthVoices(void) const; 684b867062Sbeveloper int16 MaxSampleVoices(void) const; 694b867062Sbeveloper int16 LimiterThreshhold(void) const; 704b867062Sbeveloper 714b867062Sbeveloper void SetSynthVolume(double theVolume); 724b867062Sbeveloper double SynthVolume(void) const; 734b867062Sbeveloper 744b867062Sbeveloper void SetSampleVolume(double theVolume); 754b867062Sbeveloper double SampleVolume(void) const; 764b867062Sbeveloper 77173d0cd7Smahlzeit status_t GetAudio( 78173d0cd7Smahlzeit int16* pLeft, int16* pRight, int32 max_samples) const; 794b867062Sbeveloper 804b867062Sbeveloper void Pause(void); 814b867062Sbeveloper void Resume(void); 824b867062Sbeveloper 83173d0cd7Smahlzeit void SetControllerHook(int16 controller, synth_controller_hook cback); 844b867062Sbeveloper 854b867062Sbeveloper int32 CountClients(void) const; 864b867062Sbeveloper 874b867062Sbeveloper private: 884b867062Sbeveloper 8965f512e0SIngo Weinhold friend class BMidiSynth; 9065f512e0SIngo Weinhold friend class BMidiSynthFile; 9138c7401eSmahlzeit 924b867062Sbeveloper virtual void _ReservedSynth1(); 934b867062Sbeveloper virtual void _ReservedSynth2(); 944b867062Sbeveloper virtual void _ReservedSynth3(); 954b867062Sbeveloper virtual void _ReservedSynth4(); 964b867062Sbeveloper 974810cdcdSJérôme Duval void _Init(); 981b13b75fSmahlzeit 994810cdcdSJérôme Duval BPrivate::BSoftSynth* fSynth; 1004810cdcdSJérôme Duval synth_mode fSynthMode; 1014810cdcdSJérôme Duval int32 fClientCount; 1021b13b75fSmahlzeit 1031b13b75fSmahlzeit uint32 _reserved[10]; 1044b867062Sbeveloper }; 1054b867062Sbeveloper 106f6e4cbb9SAxel Dörfler extern BSynth* be_synth; 1074b867062Sbeveloper 108173d0cd7Smahlzeit #endif // _SYNTH_H 109