zynaddsubfx

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

SUBnoteParameters.h (3689B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   SUBnoteParameters.h - Parameters for SUBnote (SUBsynth)
      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 SUB_NOTE_PARAMETERS_H
     15 #define SUB_NOTE_PARAMETERS_H
     16 
     17 #include <stdint.h>
     18 #include "../globals.h"
     19 #include "Presets.h"
     20 #include <cstdint>
     21 
     22 namespace zyn {
     23 
     24 class SUBnoteParameters:public Presets
     25 {
     26     public:
     27         SUBnoteParameters(const AbsTime *time_ = nullptr);
     28         ~SUBnoteParameters() override;
     29 
     30         //Identify active harmonic positions
     31         // - pos       : int[MAX_SUB_HARMONICS] offsets of active harmonics
     32         // - harmonics : number of active harmonics
     33         void activeHarmonics(int *pos, int &harmonics) const;
     34 
     35         static float convertBandwidth(int bw, int stages, float freq,
     36                 int scale, int relbw);
     37         static float convertHarmonicMag(int mag, int type);
     38 
     39         void add2XML(XMLwrapper& xml) override;
     40         void defaults();
     41         void getfromXML(XMLwrapper& xml);
     42         void updateFrequencyMultipliers(void);
     43         void paste(SUBnoteParameters &sub);
     44 
     45         //Parameters
     46         //AMPLITUDE PARAMETERS
     47         unsigned char   Pstereo; //0 for mono,1 for stereo
     48         float   Volume;
     49         unsigned char   PPanning;
     50         float   AmpVelocityScaleFunction;
     51         EnvelopeParams *AmpEnvelope;
     52 
     53         //Frequency Parameters
     54         unsigned short int PDetune;
     55         unsigned short int PCoarseDetune;
     56         unsigned char      PDetuneType;
     57         unsigned char      PFreqEnvelopeEnabled;
     58         EnvelopeParams    *FreqEnvelope;
     59         unsigned char      PBandWidthEnvelopeEnabled;
     60         EnvelopeParams    *BandWidthEnvelope;
     61         unsigned char     PBendAdjust;
     62         unsigned char     POffsetHz;
     63 
     64         //Filter Parameters (Global)
     65         unsigned char   PGlobalFilterEnabled;
     66         FilterParams   *GlobalFilter;
     67         unsigned char   PGlobalFilterVelocityScale;
     68         unsigned char   PGlobalFilterVelocityScaleFunction;
     69         EnvelopeParams *GlobalFilterEnvelope;
     70 
     71 
     72         //Other Parameters
     73 
     74         //If the base frequency is fixed to 440 Hz
     75         unsigned char Pfixedfreq;
     76 
     77         /* Equal temperate (this is used only if the Pfixedfreq is enabled)
     78            If this parameter is 0, the frequency is fixed (to 440 Hz);
     79            if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */
     80         unsigned char PfixedfreqET;
     81 
     82         // Overtone spread parameters
     83         struct {
     84             unsigned char type;
     85             unsigned char par1;
     86             unsigned char par2;
     87             unsigned char par3;
     88         } POvertoneSpread;
     89         float POvertoneFreqMult[MAX_SUB_HARMONICS];
     90 
     91         //how many times the filters are applied
     92         unsigned char Pnumstages;
     93 
     94         //bandwidth
     95         unsigned char Pbandwidth;
     96 
     97         //How the magnitudes are computed (0=linear,1=-60dB,2=-60dB)
     98         unsigned char Phmagtype;
     99 
    100         //Magnitudes
    101         unsigned char Phmag[MAX_SUB_HARMONICS];
    102 
    103         //Relative BandWidth ("64"=1.0f)
    104         unsigned char Phrelbw[MAX_SUB_HARMONICS];
    105 
    106         //how much the bandwidth is increased according to lower/higher frequency; 64-default
    107         unsigned char Pbwscale;
    108 
    109         //how the harmonics start("0"=0,"1"=random,"2"=1)
    110         unsigned char Pstart;
    111 
    112         const AbsTime *time;
    113         int64_t last_update_timestamp;
    114 
    115         static const rtosc::Ports &ports;
    116 };
    117 
    118 }
    119 
    120 #endif