PADnote.h (3148B)
1 /* 2 ZynAddSubFX - a software synthesizer 3 4 PADnote.h - The "pad" synthesizer 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 #ifndef PAD_NOTE_H 14 #define PAD_NOTE_H 15 16 #include "SynthNote.h" 17 #include "../globals.h" 18 #include "Envelope.h" 19 #include "LFO.h" 20 21 namespace zyn { 22 23 /**The "pad" synthesizer*/ 24 class PADnote:public SynthNote 25 { 26 public: 27 PADnote(const PADnoteParameters *parameters, const SynthParams &pars, 28 const int &interpolation, WatchManager *wm=0, const char *prefix=0); 29 ~PADnote(); 30 31 SynthNote *cloneLegato(void); 32 void legatonote(const LegatoParams &pars); 33 34 int noteout(float *outl, float *outr); 35 bool finished() const; 36 void entomb(void); 37 38 VecWatchPoint watch_int,watch_punch, watch_amp_int, watch_legato; 39 40 void releasekey(); 41 private: 42 void setup(float velocity, Portamento *portamento, 43 float note_log2_freq, bool legato = false, WatchManager *wm=0, const char *prefix=0); 44 void fadein(float *smps); 45 void computecurrentparameters(); 46 bool finished_; 47 const PADnoteParameters &pars; 48 49 int poshi_l, poshi_r; 50 float poslo; 51 52 float note_log2_freq; 53 float BendAdjust; 54 float OffsetHz; 55 bool firsttime; 56 57 int nsample; 58 Portamento *portamento; 59 60 int Compute_Linear(float *outl, 61 float *outr, 62 int freqhi, 63 float freqlo); 64 int Compute_Cubic(float *outl, 65 float *outr, 66 int freqhi, 67 float freqlo); 68 69 70 struct { 71 /****************************************** 72 * FREQUENCY GLOBAL PARAMETERS * 73 ******************************************/ 74 float Detune; //cents 75 76 Envelope *FreqEnvelope; 77 LFO *FreqLfo; 78 79 /******************************************** 80 * AMPLITUDE GLOBAL PARAMETERS * 81 ********************************************/ 82 float Volume; // [ 0 .. 1 ] 83 84 float Panning; // [ 0 .. 1 ] 85 86 Envelope *AmpEnvelope; 87 LFO *AmpLfo; 88 89 float Fadein_adjustment; 90 struct { 91 int Enabled; 92 float initialvalue, dt, t; 93 } Punch; 94 95 /****************************************** 96 * FILTER GLOBAL PARAMETERS * 97 ******************************************/ 98 ModFilter *GlobalFilter; 99 Envelope *FilterEnvelope; 100 LFO *FilterLfo; 101 } NoteGlobalPar; 102 103 104 float globaloldamplitude, globalnewamplitude, velocity, realfreq; 105 const int& interpolation; 106 }; 107 108 } 109 110 #endif