1 /*
2   rakarrack - a guitar effects software
3 
4   PitchShifter.h  -  Shifterr definitions
5   Copyright (C) 2008-2010 Josep Andreu
6   Author: Josep Andreu
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
18  (version2)  along with this program; if not, write to the Free Software
19  Foundation,
20  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 
22 */
23 
24 #ifndef SHIFTER_H
25 #define SHIFTER_H
26 
27 #include "global.h"
28 #include "smbPitchShift.h"
29 #include "Resample.h"
30 
31 
32 #define IDLE 0
33 #define UP   1
34 #define WAIT 2
35 #define DOWN 3
36 
37 
38 
39 class Shifter
40 {
41 
42 public:
43     Shifter (float *efxoutl_, float *efxoutr_, long int Quality, int DS, int uq, int dq, double sample_rate, uint32_t intermediate_bufsize);
44     ~Shifter ();
45     void out (float *smpsl, float *smpsr, uint32_t period);
46     void setpreset (int npreset);
47     void changepar (int npar, int value);
48     int getpar (int npar);
49     void cleanup ();
50     void applyfilters (float * efxoutl);
51     void adjust(int DS, double sample_rate);
52 
53     int Ppreset;
54     long int hq;
55     float outvolume;
56 
57     float *efxoutl;
58     float *efxoutr;
59     float *outi;
60     float *outo;
61 
62 
63 private:
64 
65     void setvolume (int Pvolume);
66     void setpanning (int Ppan);
67     void setinterval (int Pinterval);
68     void setgain (int Pgain);
69 
70     int Pvolume;
71     int Pgain;
72     int Ppan;
73     int Pinterval;
74     int Pupdown;
75     int Pmode;
76     int Pattack;
77     int Pdecay;
78     int Pthreshold;
79     int Pwhammy;
80     int state;
81     int DS_state;
82     int nPERIOD;
83     int nSAMPLE_RATE;
84     float nRATIO;
85     long window;
86 
87     double u_up;
88     double u_down;
89     float nfSAMPLE_RATE;
90     float env, t_level, td_level, tz_level;
91     float a_rate,d_rate,tune, range, whammy;
92     float panning;
93     float gain;
94     float interval;
95     float *templ, *tempr;
96 
97     Resample *U_Resample;
98     Resample *D_Resample;
99 
100 
101     PitchShifter *PS;
102 
103     class FPreset *Fpre;
104 };
105 
106 #endif
107