00001 /******************************************************************************* 00002 * Waveform.h (JackFX) 00003 ******************************************************************************/ 00004 00005 #ifndef _WAVEFORM_H_ 00006 #define _WAVEFORM_H_ 00007 00008 #include <JackFX.h> 00009 #include <cmath> 00010 00014 class Waveform : public ISoundSource 00015 { 00016 public: 00017 enum WaveType 00018 { 00019 W_SIN, 00020 W_TRI, 00021 W_SAW, 00022 W_RSAW, 00023 W_SQU 00024 }; 00025 00028 Waveform(WaveType t); 00029 00032 ~Waveform(); 00033 00034 void SetFrequency(float p) { m_freq = p; } 00035 void SetAmplitude(float p) { m_amplitude = p; } 00036 void SetOffset(float p) { m_offset = p; } 00037 void SetPhase(float p) { m_phase = p; } 00038 00039 00040 protected: 00041 00042 void Process(jack_nframes_t count); 00043 float CalcWave(float t); 00044 00045 private: 00046 WaveType m_wavetype; 00047 00048 float m_time; 00049 float m_last_time; 00050 00051 float m_freq; 00052 float m_amplitude; 00053 float m_offset; 00054 float m_phase; 00055 }; 00056 00057 #endif