SpectMorph
|
00001 /* 00002 * Copyright (C) 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 #ifndef SPECTMORPH_MORPH_PLAN_VOICE_HH 00019 #define SPECTMORPH_MORPH_PLAN_VOICE_HH 00020 00021 #include "smmorphplan.hh" 00022 #include "smmorphoperatormodule.hh" 00023 00024 namespace SpectMorph { 00025 00026 class MorphOutputModule; 00027 class MorphPlanSynth; 00028 00029 class MorphPlanVoice { 00030 protected: 00031 struct OpModule { 00032 MorphOperatorModule *module; 00033 MorphOperator *op; 00034 }; 00035 std::vector<OpModule> modules; 00036 00037 std::vector<double> m_control_input; 00038 MorphOutputModule *m_output; 00039 float m_mix_freq; 00040 MorphPlanSynth *m_morph_plan_synth; 00041 00042 void clear_modules(); 00043 void create_modules (MorphPlanPtr plan); 00044 void configure_modules(); 00045 00046 public: 00047 MorphPlanVoice (float mix_freq, MorphPlanSynth *synth); 00048 ~MorphPlanVoice(); 00049 00050 void cheap_update (std::map<std::string, MorphOperator *>& op_map); 00051 void full_update (MorphPlanPtr plan); 00052 00053 MorphOperatorModule *module (MorphOperator *op); 00054 00055 double control_input (int i); 00056 void set_control_input (int i, double value); 00057 00058 float mix_freq() const; 00059 00060 MorphOutputModule *output(); 00061 MorphPlanSynth *morph_plan_synth() const; 00062 00063 void update_shared_state (double time_ms); 00064 }; 00065 00066 } 00067 00068 00069 #endif