Change ALSA device default to 'default' from hw:0
[zynaddsubfx-code.git] / src / Params / Controller.h
blob34d2367ba396261b153d869e3f072cd1ca04f87d
1 /*
2 ZynAddSubFX - a software synthesizer
4 Controller.h - (Midi) Controllers implementation
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
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.
15 #ifndef CONTROLLER_H
16 #define CONTROLLER_H
18 #include <stdint.h>
19 #include "../globals.h"
21 namespace zyn {
23 /**(Midi) Controllers implementation*/
24 class Controller
26 public:
27 Controller(const SYNTH_T &synth, const AbsTime *time = nullptr);
29 void resetall();
31 void add2XML(XMLwrapper& xml);
32 void defaults();
33 void getfromXML(XMLwrapper& xml);
35 //Controllers functions
36 void setpitchwheel(int value);
37 void setpitchwheel(void);
38 void setexpression(int value);
39 void setexpression(void);
40 void setpanning(int value);
41 void setpanning(void);
42 void setfiltercutoff(int value);
43 void setfiltercutoff(void);
44 void setfilterq(int value);
45 void setfilterq(void);
46 void setbandwidth(int value);
47 void setbandwidth(void);
48 void setmodwheel(int value);
49 void setmodwheel(void);
50 void setfmamp(int value);
51 void setfmamp(void);
52 void setvolume(int value);
53 void setvolume(void);
54 void setsustain(int value);
55 void setsustain(void);
56 /**Enable or disable portamento
57 * @param value 0-127 MIDI value (greater than 64 enables)*/
58 void setportamento(int value);
59 void setresonancecenter(int value);
60 void setresonancecenter(void);
61 void setresonancebw(int value);
62 void setresonancebw(void);
65 void setparameternumber(unsigned int type, int value); //used for RPN and NRPN's
66 int getnrpn(int *parhi, int *parlo, int *valhi, int *vallo);
68 // Controllers values
69 struct { //Pitch Wheel
70 int data;
71 bool is_split; //Up and down bends may be different
72 short int bendrange; //bendrange is in cents
73 short int bendrange_down;
74 float relfreq; //the relative frequency (default is 1.0f)
75 } pitchwheel;
77 struct { //Expression
78 int data;
79 float relvolume;
80 unsigned char receive;
81 } expression;
83 struct { //Panning
84 int data;
85 float pan;
86 unsigned char depth;
87 } panning;
90 struct { //Filter cutoff
91 int data;
92 float relfreq;
93 unsigned char depth;
94 } filtercutoff;
96 struct { //Filter Q
97 int data;
98 float relq;
99 unsigned char depth;
100 } filterq;
102 struct { //Bandwidth
103 int data;
104 float relbw;
105 unsigned char depth;
106 unsigned char exponential;
107 } bandwidth;
109 struct { //Modulation Wheel
110 int data;
111 float relmod;
112 unsigned char depth;
113 unsigned char exponential;
114 } modwheel;
116 struct { //FM amplitude
117 int data;
118 float relamp;
119 unsigned char receive;
120 } fmamp;
122 struct { //Volume
123 int data;
124 float volume;
125 unsigned char receive;
126 } volume;
128 struct { //Sustain
129 int data, sustain;
130 unsigned char receive;
131 } sustain;
133 struct { /**<Portamento*/
134 //parameters
135 int data;
136 unsigned char portamento;
137 /**Whether the portamento midi events are received or not*/
138 unsigned char receive;
139 /**Whether legato playing is needed to get portamento*/
140 unsigned char automode;
141 /** The time that it takes for the portamento to complete
143 * Translates in an expontal fashion to 0 Seconds to 1.93f Seconds
144 * of completion time*/
145 unsigned char time;
146 /**If the portamento is proportinal to the distance spanned
148 * 0 - constant time(default)
149 * 1 - proportional*/
150 unsigned char proportional;
151 /**Rate of proportinal portamento*/
152 unsigned char propRate;
153 /**Depth of proportinal portamento*/
154 unsigned char propDepth;
155 /**pitchthresh is the threshold of enabling protamento*/
156 unsigned char pitchthresh;
157 /**enable the portamento only below(0)/above(1) the threshold*/
158 unsigned char pitchthreshtype;
160 /**this value represent how the portamento time is reduced
161 * 0 - for down portamento
162 * 1-63 - the up portamento's time is smaller than the down portamento
163 * 64 - the portamento time is always the same
164 * 64-126 - the down portamento's time is smaller than the up portamento
165 * 127 - for upper portamento
166 * 'up portamento' means when the frequency is rising
167 * (eg: the portamento is from 200Hz to 300 Hz)
168 * 'down portamento' means when the frequency is lowering
169 * (eg: the portamento is from 300Hz to 200 Hz)
171 unsigned char updowntimestretch;
172 } portamento;
174 struct { //Resonance Center Frequency
175 int data;
176 float relcenter;
177 unsigned char depth;
178 } resonancecenter;
180 struct { //Resonance Bandwidth
181 int data;
182 float relbw;
183 unsigned char depth;
184 } resonancebandwidth;
187 /** RPN and NPRPN */
188 struct { //nrpn
189 int parhi, parlo;
190 int valhi, vallo;
191 unsigned char receive; //this is saved to disk by Master
192 } NRPN;
195 const AbsTime *time;
196 int64_t last_update_timestamp;
198 static const rtosc::Ports ports;
199 private:
200 const SYNTH_T &synth;
205 #endif