SpectMorph
|
00001 /* 00002 * Copyright (C) 2010-2011 Stefan Westerfeld 00003 * 00004 * This library is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License as published by the 00006 * Free Software Foundation; either version 3 of the License, or (at your 00007 * option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00012 * for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #include "smmorphoperatormodule.hh" 00019 #include "smmorphlfo.hh" 00020 #include "smwavset.hh" 00021 00022 namespace SpectMorph 00023 { 00024 00025 class MorphLFOModule : public MorphOperatorModule 00026 { 00027 MorphLFO::WaveType wave_type; 00028 00029 float frequency; 00030 float depth; 00031 float center; 00032 float start_phase; 00033 bool sync_voices; 00034 00035 double phase; 00036 double m_value; 00037 00038 struct SharedState : public MorphModuleSharedState 00039 { 00040 double phase; 00041 double value; 00042 }; 00043 SharedState *shared_state; 00044 00045 double compute_value (double phase); 00046 public: 00047 MorphLFOModule (MorphPlanVoice *voice); 00048 ~MorphLFOModule(); 00049 00050 void set_config (MorphOperator *op); 00051 float value(); 00052 void reset_value(); 00053 void update_value (double time_ms); 00054 void update_shared_state (double time_ms); 00055 }; 00056 }