Files
haiku-beta6/headers/os/midi/Synth.h
T

110 lines
2.1 KiB
C++
Raw Normal View History

2002-10-26 18:51:58 +00: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 16:11:03 +00:00
B_DROP_SAMPLE = 0,
B_2_POINT_INTERPOLATION,
B_LINEAR_INTERPOLATION
}
interpolation_mode;
2002-10-26 18:51:58 +00: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 16:11:03 +00:00
}
reverb_mode;
typedef void (*synth_controller_hook) (
int16 channel, int16 controller, int16 value);
2002-10-26 18:51:58 +00:00
class BMidiSynth;
class BMidiSynthFile;
namespace BPrivate { class BSoftSynth; }
2002-10-26 18:51:58 +00:00
class BSynth
{
2002-11-01 16:11:03 +00:00
public:
2003-03-17 22:24:09 +00:00
2002-10-26 18:51:58 +00:00
BSynth();
BSynth(synth_mode synth);
2002-11-01 16:11:03 +00:00
virtual ~BSynth();
2002-10-26 18:51:58 +00:00
2002-11-01 16:11:03 +00:00
status_t LoadSynthData(entry_ref* instrumentsFile);
status_t LoadSynthData(synth_mode synth);
2002-10-26 18:51:58 +00:00
synth_mode SynthMode(void);
2002-11-01 16:11:03 +00: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 18:51:58 +00:00
interpolation_mode Interpolation() const;
2002-11-01 16:11:03 +00: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 18:51:58 +00:00
2002-11-01 16:11:03 +00:00
private:
2002-10-26 18:51:58 +00:00
2003-03-17 22:24:09 +00:00
friend BMidiSynth;
friend BMidiSynthFile;
2002-11-01 16:11:03 +00:00
virtual void _ReservedSynth1();
virtual void _ReservedSynth2();
virtual void _ReservedSynth3();
virtual void _ReservedSynth4();
2002-10-26 18:51:58 +00:00
void Init();
BPrivate::BSoftSynth* synth;
synth_mode synthMode;
int32 clientCount;
uint32 _reserved[10];
2002-10-26 18:51:58 +00:00
};
2002-11-01 16:11:03 +00:00
extern _IMPEXP_MIDI BSynth* be_synth;
2002-10-26 18:51:58 +00:00
2002-11-01 16:11:03 +00:00
#endif // _SYNTH_H