home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / ZynAddFX / Setup_ZynAddSubFX-2.1.1.exe / ADnoteParameters.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-08-24  |  7.1 KB  |  280 lines

  1. /*
  2.   ZynAddSubFX - a software synthesizer
  3.  
  4.   ADnoteParameters.h - Parameters for ADnote (ADsynth)
  5.   Copyright (C) 2002-2004 Nasca Octavian Paul
  6.   Author: Nasca Octavian Paul
  7.  
  8.   This program is free software; you can redistribute it and/or modify
  9.   it under the terms of version 2 of the GNU General Public License 
  10.   as published by the Free Software Foundation.
  11.  
  12.   This program is distributed in the hope that it will be useful,
  13.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.   GNU General Public License (version 2) for more details.
  16.  
  17.   You should have received a copy of the GNU General Public License (version 2)
  18.   along with this program; if not, write to the Free Software Foundation,
  19.   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  20.  
  21. */
  22.  
  23. #ifndef AD_NOTE_PARAMETERS_H
  24. #define AD_NOTE_PARAMETERS_H
  25.  
  26.  
  27. #include "../globals.h"
  28. #include "EnvelopeParams.h"
  29. #include "LFOParams.h"
  30. #include "FilterParams.h"
  31. #include "../Synth/OscilGen.h"
  32. #include "../Synth/Resonance.h"
  33. #include "../Misc/Util.h"
  34. #include "../Misc/XMLwrapper.h"
  35. #include "../DSP/FFTwrapper.h"
  36. #include "Presets.h"
  37.  
  38.   enum FMTYPE{NONE,MORPH,RING_MOD,PHASE_MOD,FREQ_MOD,PITCH_MOD};
  39.     
  40.    /*****************************************************************/
  41.    /*                    GLOBAL PARAMETERS                          */
  42.    /*****************************************************************/
  43.  
  44.     struct ADnoteGlobalParam{
  45.     
  46.        /* The instrument type  - MONO/STEREO
  47.       If the mode is MONO, the panning of voices are not used
  48.       Stereo=1, Mono=0. */
  49.      
  50.     unsigned char PStereo; 
  51.       
  52.     
  53.        /******************************************
  54.     *     FREQUENCY GLOBAL PARAMETERS        *
  55.     ******************************************/
  56.     unsigned short int PDetune;//fine detune
  57.     unsigned short int PCoarseDetune;//coarse detune+octave
  58.     unsigned char PDetuneType;//detune type
  59.  
  60.     EnvelopeParams *FreqEnvelope; //Frequency Envelope
  61.     
  62.     LFOParams *FreqLfo;//Frequency LFO
  63.  
  64.        /********************************************
  65.     *     AMPLITUDE GLOBAL PARAMETERS          *
  66.     ********************************************/
  67.  
  68.     /* Panning -  0 - random 
  69.               1 - left
  70.              64 - center
  71.             127 - right */
  72.     unsigned char PPanning;
  73.  
  74.     unsigned char PVolume;
  75.  
  76.     unsigned char PAmpVelocityScaleFunction;
  77.  
  78.     EnvelopeParams *AmpEnvelope;
  79.    
  80.     LFOParams *AmpLfo;   
  81.  
  82.     unsigned char PPunchStrength,PPunchTime,PPunchStretch,PPunchVelocitySensing;
  83.  
  84.        /******************************************
  85.     *        FILTER GLOBAL PARAMETERS        *
  86.     ******************************************/
  87.     FilterParams *GlobalFilter;
  88.  
  89.     // filter velocity sensing
  90.     unsigned char PFilterVelocityScale; 
  91.  
  92.     // filter velocity sensing
  93.     unsigned char PFilterVelocityScaleFunction;
  94.     
  95.     EnvelopeParams *FilterEnvelope;
  96.     
  97.     LFOParams *FilterLfo;
  98.     
  99.     // RESONANCE
  100.     Resonance *Reson;
  101.     
  102.     //how the randomness is applied to the harmonics on more voices using the same oscillator
  103.     unsigned char Hrandgrouping;
  104.     };  
  105.  
  106.  
  107.     
  108.    /***********************************************************/
  109.    /*                    VOICE PARAMETERS                     */
  110.    /***********************************************************/
  111.     struct ADnoteVoiceParam{
  112.  
  113.         /* If the voice is enabled */
  114.         unsigned char Enabled; 
  115.  
  116.     /* Type of the voice (0=Sound,1=Noise)*/
  117.     unsigned char Type;
  118.     
  119.     /* Voice Delay */
  120.         unsigned char PDelay;
  121.  
  122.     /* If the resonance is enabled for this voice */
  123.     unsigned char Presonance;
  124.     
  125.     // What external oscil should I use, -1 for internal OscilSmp&FMSmp
  126.         short int Pextoscil,PextFMoscil;
  127.     // it is not allowed that the externoscil,externFMoscil => current voice
  128.  
  129.     // oscillator phases
  130.     unsigned char Poscilphase,PFMoscilphase;
  131.  
  132.     // filter bypass
  133.     unsigned char Pfilterbypass;
  134.  
  135.         /* Voice oscillator */ 
  136.         OscilGen *OscilSmp;    
  137.  
  138.         /**********************************
  139.     *     FREQUENCY PARAMETERS        *
  140.     **********************************/
  141.  
  142.     /* If the base frequency is fixed to 440 Hz*/
  143.     unsigned char Pfixedfreq;
  144.     
  145.     /* Equal temperate (this is used only if the Pfixedfreq is enabled)
  146.        If this parameter is 0, the frequency is fixed (to 440 Hz);
  147.        if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */
  148.     unsigned char PfixedfreqET;
  149.  
  150.     /* Fine detune */
  151.     unsigned short int PDetune;
  152.  
  153.     /* Coarse detune + octave */
  154.     unsigned short int PCoarseDetune;
  155.  
  156.     /* Detune type */
  157.     unsigned char PDetuneType;
  158.     
  159.     /* Frequency Envelope */
  160.     unsigned char PFreqEnvelopeEnabled;
  161.     EnvelopeParams *FreqEnvelope;
  162.  
  163.     /* Frequency LFO */
  164.     unsigned char PFreqLfoEnabled;
  165.     LFOParams *FreqLfo;
  166.     
  167.  
  168.     /***************************
  169.     *   AMPLITUDE PARAMETERS   *
  170.     ***************************/
  171.  
  172.     /* Panning       0 - random
  173.              1 - left
  174.                 64 - center
  175.                127 - right
  176.        The Panning is ignored if the instrument is mono */          
  177.     unsigned char PPanning;
  178.  
  179.     /* Voice Volume */
  180.     unsigned char PVolume;
  181.     
  182.     /* If the Volume negative */
  183.     unsigned char PVolumeminus;
  184.  
  185.     /* Velocity sensing */
  186.     unsigned char PAmpVelocityScaleFunction;
  187.  
  188.     /* Amplitude Envelope */
  189.     unsigned char PAmpEnvelopeEnabled;
  190.     EnvelopeParams *AmpEnvelope;
  191.     
  192.     /* Amplitude LFO */
  193.     unsigned char PAmpLfoEnabled;
  194.     LFOParams *AmpLfo;
  195.  
  196.  
  197.  
  198.     /*************************
  199.     *   FILTER PARAMETERS    *
  200.     *************************/
  201.     
  202.     /* Voice Filter */
  203.     unsigned char PFilterEnabled;
  204.     FilterParams *VoiceFilter;
  205.     
  206.     /* Filter Envelope */
  207.     unsigned char PFilterEnvelopeEnabled;
  208.     EnvelopeParams *FilterEnvelope;
  209.     
  210.     /* LFO Envelope */
  211.     unsigned char PFilterLfoEnabled;
  212.     LFOParams *FilterLfo;
  213.  
  214.     /****************************
  215.     *   MODULLATOR PARAMETERS   *
  216.     ****************************/
  217.  
  218.     /* Modullator Parameters (0=off,1=Morph,2=RM,3=PM,4=FM.. */
  219.     unsigned char PFMEnabled;
  220.         
  221.     /* Voice that I use as modullator instead of FMSmp. 
  222.        It is -1 if I use FMSmp(default).
  223.        It maynot be equal or bigger than current voice */
  224.     short int PFMVoice;
  225.     
  226.     /* Modullator oscillator */
  227.     OscilGen *FMSmp;    
  228.  
  229.     /* Modullator Volume */
  230.     unsigned char PFMVolume;
  231.  
  232.     /* Modullator damping at higher frequencies */
  233.     unsigned char PFMVolumeDamp;
  234.  
  235.     /* Modullator Velocity Sensing */
  236.     unsigned char PFMVelocityScaleFunction;
  237.  
  238.     /* Fine Detune of the Modullator*/
  239.     unsigned short int PFMDetune; 
  240.  
  241.     /* Coarse Detune of the Modullator */
  242.     unsigned short int PFMCoarseDetune; 
  243.  
  244.     /* The detune type */
  245.     unsigned char PFMDetuneType;
  246.         
  247.     /* Frequency Envelope of the Modullator */
  248.     unsigned char PFMFreqEnvelopeEnabled;
  249.     EnvelopeParams *FMFreqEnvelope;
  250.  
  251.     /* Frequency Envelope of the Modullator */
  252.     unsigned char PFMAmpEnvelopeEnabled;
  253.     EnvelopeParams *FMAmpEnvelope;
  254.     }; 
  255.  
  256. class ADnoteParameters:public Presets{
  257.     public:
  258.     ADnoteParameters(FFTwrapper *fft_);
  259.     ~ADnoteParameters();
  260.  
  261.     ADnoteGlobalParam GlobalPar;
  262.     ADnoteVoiceParam VoicePar[NUM_VOICES];
  263.  
  264.     void defaults();
  265.     void add2XML(XMLwrapper *xml);
  266.         void getfromXML(XMLwrapper *xml);
  267.  
  268.     private:
  269.     void defaults(int n);//n is the nvoice
  270.  
  271.     void EnableVoice(int nvoice);        
  272.     void KillVoice(int nvoice);        
  273.     FFTwrapper *fft;    
  274.  
  275.     void add2XMLsection(XMLwrapper *xml,int n);
  276.         void getfromXMLsection(XMLwrapper *xml,int n);
  277. };
  278.  
  279. #endif
  280.