/* Copyright (C) 2010-2012 Florian Jung This file is part of flo's FM synth. flo's FM synth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. flo's FM synth 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 for more details. You should have received a copy of the GNU General Public License along with flo's FM synth. If not, see . */ #include #include #include "parser.h" #include "programs.h" #include "util.h" #include "../synth/defines.h" #include "../synth/fixed.h" void init_oscs(int n_osc, oscillator_t *osc) { for (int i=0;i=0) && (ind=0) && (ind2=N_LFOS)) throw string("invalid value for tremolo_lfo"); } break; case VIBRATO: osc[ind].vibrato_depth=val; break; case VIB_LFO: if (strval=="snh") osc[ind].vibrato_lfo= SNH_LFO; else { osc[ind].vibrato_lfo= int(val); if ((val<0) || (val>=N_LFOS)) throw string("invalid value for vibrato_lfo"); } break; case ATTACK: env[ind].attack=val; break; case DECAY: env[ind].decay=val; break; case SUSTAIN: env[ind].sustain=val; break; case RELEASE: env[ind].release=val; break; case HOLD: env[ind].hold=(val!=0); break; case KSR: osc[ind].ksr=val; break; case KSL: osc[ind].ksl=val; break; case SYNC: osc[ind].sync=(val!=0); break; case FILTER_ENABLED: filter.enabled=(val!=0); break; case FILTER_ENV_AMOUNT: filter.env_amount=val; break; case FILTER_ATTACK: filter.env_settings.attack=val; break; case FILTER_DECAY: filter.env_settings.decay=val; break; case FILTER_SUSTAIN: filter.env_settings.sustain=val; break; case FILTER_RELEASE: filter.env_settings.release=val; break; case FILTER_HOLD: filter.env_settings.hold=(val!=0); break; case FILTER_OFFSET: filter.freqfactor_offset=val; break; case FILTER_RESONANCE: filter.resonance=val; break; case FILTER_TREMOLO: filter.trem_strength=int(val); break; case FILTER_TREM_LFO: if (strval=="snh") filter.trem_lfo=SNH_LFO; else { filter.trem_lfo=int(val); if ((val<0) || (val>=N_LFOS)) throw string("invalid value for filter_trem_lfo"); } break; case SYNC_FACTOR: sync_factor=val*ONE; break; default: throw string("unknown variable ('"+array+"')"); } break; case 5: //read which params shall be variable, even if //there are currently no controllers which change them case 4: //read velocity-influence over certain params case 2: //read how controllers influence parameters p=param_to_enum(array); ind=extract_array_index(var,1); if ( param_needs_index(p) && (!((ind>=0) && (ind=0) && (ind2100)) //TODO FINDMICH besseres kriterium? env[i].enabled=false; if ( ((filter.env_settings.attack==0) && (filter.env_settings.sustain==1.0) && (filter.env_settings.release>100)) //TODO FINDMICH siehe oben || ((filter.env_amount==0) && (filter.env_amount_const==true)) ) filter.env_settings.enabled=false; bool use_sync=false; for (int i=0;i