#ifndef M_VCO2_H
#define M_VCO2_H

#include "module.h"


#define MODULE_VCO2_WIDTH                 85
#define MODULE_VCO2_HEIGHT               170
/** single waveform version of the AMS oscillator
 *  save some serious cpu cycles by generating only one waveform
 */
enum WaveFormType {SINUS,TRIANGLE,SAWTOOTH,RECTANGLE, AWAVE_SAW, AWAVE_SAW2, AWAVE_SAW3 };

class M_vco2 : public Module
{
    Q_OBJECT

    float freq, phi0, pw0;
    float edge;
    float wave_period;
    PolyArr<float> phi;
   // float dphi, phi1, phi_const, pw, d, dd, dsaw, half_wave, third_wave; 
   // float freq_const, freq_tune, gain_linfm, log2, pw_low, pw_high,
    float wave_period_2,wave_period_3,Pi2Times,PKonst;
    float vcoExpFMGain, vcoLinFMGain, pwGain;
    int waveForm;
    int harmonic, subharmonic, octave;
    Port *port_M_freq, *port_M_exp, *port_M_lin, *port_M_pw;
    Port *port_sine, *port_tri, *port_saw, *port_rect, *port_aux;
    
  public: 
    M_vco2(QWidget* parent = 0, int id = 0);

    float **freqData;        
    float **pwData;  // Duty cycle modulation generated by M_lfo
    float **expFMData;        // Frequency modulation exp characteristic
    float **linFMData;        // Frequency modulation lin characteristic
                            
    void generateCycle();
};
  
#endif
