25 #include "common/frac.h" 38 typedef int16 st_sample_t;
39 typedef uint16 st_volume_t;
40 typedef uint32 st_size_t;
41 typedef uint32 st_rate_t;
45 ST_SAMPLE_MAX = 0x7fffL,
46 ST_SAMPLE_MIN = (-ST_SAMPLE_MAX - 1L)
49 static inline void clampedAdd(int16& a,
int b) {
51 #ifdef OUTPUT_UNSIGNED_AUDIO 52 val = (a ^ 0x8000) + b;
57 if (val > ST_SAMPLE_MAX)
59 else if (val < ST_SAMPLE_MIN)
62 #ifdef OUTPUT_UNSIGNED_AUDIO 63 a = ((int16)val) ^ 0x8000;
91 virtual int convert(
AudioStream &input, st_sample_t *outBuffer, st_size_t numSamples, st_volume_t vol_l, st_volume_t vol_r) = 0;
93 virtual void setInputRate(st_rate_t inputRate) = 0;
94 virtual void setOutputRate(st_rate_t outputRate) = 0;
96 virtual st_rate_t getInputRate()
const = 0;
97 virtual st_rate_t getOutputRate()
const = 0;
107 RateConverter *makeRateConverter(st_rate_t inRate, st_rate_t outRate,
bool inStereo,
bool outStereo,
bool reverseStereo);
Definition: audiostream.h:50
virtual bool needsDraining() const =0
virtual int convert(AudioStream &input, st_sample_t *outBuffer, st_size_t numSamples, st_volume_t vol_l, st_volume_t vol_r)=0