/* 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" /**(Midi) Controllers implementation*/ class Controller { public: Controller(const SYNTH_T &synth); Controller&operator=(const Controller &c); ~Controller(); void resetall(); void add2XML(XMLwrapper *xml); void defaults(); void getfromXML(XMLwrapper *xml); //Controllers functions void setpitchwheel(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(float oldfreq, float newfreq, bool legatoflag); /**Update portamento's freqrap to next value based upon dx*/ void updateportamento(); // Controllers values struct { //Pitch Wheel int data; bool is_split; //Up and down bends may be different short int bendrange; //bendrange is in cents short int bendrange_down; float relfreq; //the relative frequency (default is 1.0f) } pitchwheel; struct { //Expression int data; float relvolume; unsigned char receive; } expression; struct { //Panning int data; float pan; unsigned char depth; } panning; struct { //Filter cutoff int data; float relfreq; unsigned char depth; } filtercutoff; struct { //Filter Q int data; float relq; unsigned char depth; } filterq; struct { //Bandwidth int data; float relbw; unsigned char depth; unsigned char exponential; } bandwidth; struct { //Modulation Wheel int data; float relmod; unsigned char depth; unsigned char exponential; } modwheel; struct { //FM amplitude int data; float relamp; unsigned char receive; } fmamp; struct { //Volume int data; float volume; unsigned char receive; } volume; struct { //Sustain int data, sustain; unsigned char receive; } sustain; struct { /**