@@ -5,31 +5,41 @@
|
||||
class Oscillator {
|
||||
private:
|
||||
OscillatorType m_osc;
|
||||
float m_freq;
|
||||
float m_fine;
|
||||
float m_key;
|
||||
float m_volume;
|
||||
float m_phase;
|
||||
float m_phase_dt;
|
||||
float (Oscillator::*m_osc_function)(void);
|
||||
void SineOscPhaseIncr();
|
||||
void SawOscPhaseIncr();
|
||||
float CalcSawPhaseDelta(float freq);
|
||||
float CalcSinePhaseDelta(float freq);
|
||||
float SawOsc();
|
||||
float TriangleOsc();
|
||||
float SquareOsc();
|
||||
float Sign(float v);
|
||||
float SineOsc();
|
||||
|
||||
protected:
|
||||
float m_phase_dt;
|
||||
float (Oscillator::*m_dt_function)(float freq);
|
||||
void sine_osc_phase_incr();
|
||||
void saw_osc_phase_incr();
|
||||
float calc_saw_phase_delta(float freq);
|
||||
float calc_sine_phase_delta(float freq);
|
||||
float sawosc();
|
||||
float triangleosc();
|
||||
float squareosc();
|
||||
float sign(float v);
|
||||
float sineosc();
|
||||
|
||||
public:
|
||||
Oscillator(OscillatorType osc, float freq, float volume);
|
||||
Oscillator(OscillatorType osc, float fine, float volume);
|
||||
~Oscillator();
|
||||
OscillatorType GetType() { return m_osc; }
|
||||
void SetType(OscillatorType osc);
|
||||
float GetVolume() { return m_volume; }
|
||||
void SetVolume(float volume) { m_volume = volume; }
|
||||
float GetFreq() { return m_freq; }
|
||||
void SetFreq(float freq);
|
||||
float GetKey() { return m_key; }
|
||||
void SetKey(float key);
|
||||
float GetFine() { return m_fine; }
|
||||
void SetFine(float fine) {
|
||||
if (fine != m_fine) {
|
||||
assert(fine >= -2.f && fine <= 2.f);
|
||||
m_fine = fine;
|
||||
}
|
||||
}
|
||||
void Reset();
|
||||
float Process();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user