zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

LFOParams.h (3350B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   LFOParams.h - Parameters for LFO
      5   Copyright (C) 2002-2005 Nasca Octavian Paul
      6   Author: Nasca Octavian Paul
      7 
      8   This program is free software; you can redistribute it and/or
      9   modify it under the terms of the GNU General Public License
     10   as published by the Free Software Foundation; either version 2
     11   of the License, or (at your option) any later version.
     12 */
     13 
     14 #ifndef LFO_PARAMS_H
     15 #define LFO_PARAMS_H
     16 
     17 #include <Misc/Time.h>
     18 #include <rtosc/ports.h>
     19 #include "Presets.h"
     20 #include <cstdint>
     21 
     22 #define LFO_SINE      0
     23 #define LFO_TRIANGLE  1
     24 #define LFO_SQUARE    2
     25 #define LFO_RAMPUP    3
     26 #define LFO_RAMPDOWN  4
     27 #define LFO_EXP_DOWN1 5
     28 #define LFO_EXP_DOWN2 6
     29 #define LFO_RANDOM    7
     30 
     31 namespace zyn {
     32 
     33 class XMLwrapper;
     34 
     35 class LFOParams:public Presets
     36 {
     37     public:
     38         LFOParams(const AbsTime* time_ = nullptr);
     39         LFOParams(consumer_location_t loc,
     40                   const AbsTime* time_ = nullptr);
     41         LFOParams(float freq_,
     42                   char Pintensity_,
     43                   char Pstartphase_,
     44                   char Pcutoff_,
     45                   char PLFOtype_,
     46                   char Prandomness_,
     47                   float delay_,
     48                   float fadein_,
     49                   float fadeout_,
     50                   char Pcontinous,
     51                   consumer_location_t loc,
     52                   const AbsTime* time_ = nullptr);
     53         ~LFOParams() override;
     54 
     55         void add2XML(XMLwrapper& xml) override;
     56         void defaults();
     57         /**Loads the LFO from the xml*/
     58         void getfromXML(XMLwrapper& xml);
     59         void paste(LFOParams &);
     60 
     61         /*  MIDI Parameters*/
     62         float         freq;      /**<frequency*/
     63         unsigned char Pintensity; /**<intensity*/
     64         unsigned char Pstartphase; /**<start phase (0=random)*/
     65         unsigned char Pcutoff; /**<cutoff */
     66         unsigned char PLFOtype; /**<LFO type (sin,triangle,square,ramp,...)*/
     67         unsigned char Prandomness; /**<randomness (0=off)*/
     68         unsigned char Pfreqrand; /**<frequency randomness (0=off)*/
     69         float         delay; /**<delay (0=off)*/
     70         float         fadein; /**<fadein, relative to delay*/
     71         float         fadeout; /**<fadeout on key release (10.0=off)*/
     72         unsigned char Pcontinous; /**<1 if LFO is continous*/
     73         int           numerator;  /**<numerator for integer ratio between system tempo and LFO freq (0=off)*/
     74         int           denominator;/**<denominator for integer ratio between system tempo and LFO freq (0=off)*/
     75         unsigned char Pstretch; /**<how the LFO is "stretched" according the note frequency (64=no stretch)*/
     76 
     77         //! what kind is the LFO (0 - frequency, 1 - amplitude, 2 - filter)
     78         consumer_location_type_t fel;
     79         int loc; //!< consumer location
     80 
     81         const AbsTime *time;
     82         int64_t last_update_timestamp;
     83 
     84         static const rtosc::Ports &ports;
     85     private:
     86         //! common functionality of ctors
     87         void setup();
     88 
     89         /* Default parameters */
     90         float         Dfreq;
     91         unsigned char Dintensity;
     92         unsigned char Dstartphase;
     93         unsigned char Dcutoff;
     94         unsigned char DLFOtype;
     95         unsigned char Drandomness;
     96         float         Ddelay;
     97         float         Dfadein;
     98         float         Dfadeout;
     99         unsigned char Dcontinous;
    100 };
    101 
    102 }
    103 
    104 #endif