2002-10-26 22:51:58 +04:00
|
|
|
|
|
|
|
#ifndef _SYNTH_H
|
|
|
|
#define _SYNTH_H
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <Entry.h>
|
|
|
|
#include <MidiDefs.h>
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
typedef enum interpolation_mode
|
|
|
|
{
|
2002-11-01 19:11:03 +03:00
|
|
|
B_DROP_SAMPLE = 0,
|
|
|
|
B_2_POINT_INTERPOLATION,
|
|
|
|
B_LINEAR_INTERPOLATION
|
|
|
|
}
|
|
|
|
interpolation_mode;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
|
|
|
typedef enum reverb_mode
|
|
|
|
{
|
|
|
|
B_REVERB_NONE = 1,
|
|
|
|
B_REVERB_CLOSET,
|
|
|
|
B_REVERB_GARAGE,
|
|
|
|
B_REVERB_BALLROOM,
|
|
|
|
B_REVERB_CAVERN,
|
|
|
|
B_REVERB_DUNGEON
|
2002-11-01 19:11:03 +03:00
|
|
|
}
|
|
|
|
reverb_mode;
|
|
|
|
|
|
|
|
typedef void (*synth_controller_hook) (
|
|
|
|
int16 channel, int16 controller, int16 value);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
|
|
|
class BMidiSynth;
|
|
|
|
class BMidiSynthFile;
|
|
|
|
|
2004-05-13 20:47:34 +04:00
|
|
|
namespace BPrivate { class BSoftSynth; }
|
|
|
|
|
2002-10-26 22:51:58 +04:00
|
|
|
class BSynth
|
|
|
|
{
|
2002-11-01 19:11:03 +03:00
|
|
|
public:
|
2003-03-18 01:24:09 +03:00
|
|
|
|
2002-10-26 22:51:58 +04:00
|
|
|
BSynth();
|
|
|
|
BSynth(synth_mode synth);
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual ~BSynth();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
status_t LoadSynthData(entry_ref* instrumentsFile);
|
|
|
|
status_t LoadSynthData(synth_mode synth);
|
2002-10-26 22:51:58 +04:00
|
|
|
synth_mode SynthMode(void);
|
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
void Unload(void);
|
|
|
|
bool IsLoaded(void) const;
|
|
|
|
|
|
|
|
status_t SetSamplingRate(int32 sample_rate);
|
|
|
|
int32 SamplingRate() const;
|
|
|
|
|
|
|
|
status_t SetInterpolation(interpolation_mode interp_mode);
|
2002-10-26 22:51:58 +04:00
|
|
|
interpolation_mode Interpolation() const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
|
|
|
void SetReverb(reverb_mode rev_mode);
|
|
|
|
reverb_mode Reverb() const;
|
|
|
|
|
|
|
|
status_t EnableReverb(bool reverb_enabled);
|
|
|
|
bool IsReverbEnabled() const;
|
|
|
|
|
|
|
|
status_t SetVoiceLimits(
|
|
|
|
int16 maxSynthVoices, int16 maxSampleVoices,
|
|
|
|
int16 limiterThreshhold);
|
|
|
|
|
|
|
|
int16 MaxSynthVoices(void) const;
|
|
|
|
int16 MaxSampleVoices(void) const;
|
|
|
|
int16 LimiterThreshhold(void) const;
|
|
|
|
|
|
|
|
void SetSynthVolume(double theVolume);
|
|
|
|
double SynthVolume(void) const;
|
|
|
|
|
|
|
|
void SetSampleVolume(double theVolume);
|
|
|
|
double SampleVolume(void) const;
|
|
|
|
|
|
|
|
status_t GetAudio(
|
|
|
|
int16* pLeft, int16* pRight, int32 max_samples) const;
|
|
|
|
|
|
|
|
void Pause(void);
|
|
|
|
void Resume(void);
|
|
|
|
|
|
|
|
void SetControllerHook(int16 controller, synth_controller_hook cback);
|
|
|
|
|
|
|
|
int32 CountClients(void) const;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
private:
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2005-11-18 01:53:30 +03:00
|
|
|
friend class BMidiSynth;
|
|
|
|
friend class BMidiSynthFile;
|
2003-03-18 01:24:09 +03:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void _ReservedSynth1();
|
|
|
|
virtual void _ReservedSynth2();
|
|
|
|
virtual void _ReservedSynth3();
|
|
|
|
virtual void _ReservedSynth4();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2004-05-13 20:47:34 +04:00
|
|
|
void Init();
|
|
|
|
|
|
|
|
BPrivate::BSoftSynth* synth;
|
|
|
|
synth_mode synthMode;
|
|
|
|
int32 clientCount;
|
|
|
|
|
|
|
|
uint32 _reserved[10];
|
2002-10-26 22:51:58 +04:00
|
|
|
};
|
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
extern _IMPEXP_MIDI BSynth* be_synth;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
#endif // _SYNTH_H
|