/* ZynAddSubFX - a software synthesizer Controller.h - (Midi) Controllers implementation Copyright (C) 2002-2005 Nasca Octavian Paul Author: Nasca Octavian Paul This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (version 2 or later) for more details. You should have received a copy of the GNU General Public License (version 2) along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CONTROLLER_H #define CONTROLLER_H #include "../globals.h" #include "../Misc/XMLwrapper.h" /**(Midi) Controllers implementation*/ class Controller { public: Controller(); ~Controller(); void resetall(); void add2XML(XMLwrapper *xml); void defaults(); void getfromXML(XMLwrapper *xml); //Controllers functions void setpitchwheel(int value); void setpitchwheelbendrange(unsigned short int value); void setexpression(int value); void setpanning(int value); void setfiltercutoff(int value); void setfilterq(int value); void setbandwidth(int value); void setmodwheel(int value); void setfmamp(int value); void setvolume(int value); void setsustain(int value); /**Enable or disable portamento * @param value 0-127 MIDI value (greater than 64 enables)*/ void setportamento(int value); void setresonancecenter(int value); void setresonancebw(int value); void setparameternumber(unsigned int type, int value); //used for RPN and NRPN's int getnrpn(int *parhi, int *parlo, int *valhi, int *vallo); /** * Initialize a portamento * * @param oldfreq Starting frequency of the portamento (Hz) * @param newfreq Ending frequency of the portamento (Hz) * @param legatoflag true when legato is in progress, false otherwise * @returns 1 if properly initialized, 0 otherwise*/ int initportamento(REALTYPE oldfreq, REALTYPE newfreq, bool legatoflag); /**Update portamento's freqrap to next value based upon dx*/ void updateportamento(); // Controllers values struct { //Pitch Wheel int data; short int bendrange; //bendrange is in cents REALTYPE relfreq; //the relative frequency (default is 1.0) } pitchwheel; struct { //Expression int data; REALTYPE relvolume; unsigned char receive; } expression; struct { //Panning int data; REALTYPE pan; unsigned char depth; } panning; struct { //Filter cutoff int data; REALTYPE relfreq; unsigned char depth; } filtercutoff; struct { //Filter Q int data; REALTYPE relq; unsigned char depth; } filterq; struct { //Bandwidth int data; REALTYPE relbw; unsigned char depth; unsigned char exponential; } bandwidth; struct { //Modulation Wheel int data; REALTYPE relmod; unsigned char depth; unsigned char exponential; } modwheel; struct { //FM amplitude int data; REALTYPE relamp; unsigned char receive; } fmamp; struct { //Volume int data; REALTYPE volume; unsigned char receive; } volume; struct { //Sustain int data, sustain; unsigned char receive; } sustain; struct { /**