1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_MORPH_PLAN_VOICE_HH
4 #define SPECTMORPH_MORPH_PLAN_VOICE_HH
5 
6 #include "smmorphplan.hh"
7 #include "smmorphoperatormodule.hh"
8 
9 namespace SpectMorph {
10 
11 class MorphOutputModule;
12 class MorphPlanSynth;
13 
14 class MorphPlanVoice {
15 protected:
16   struct OpModule {
17     MorphOperatorModule *module;
18     MorphOperator       *op;
19   };
20   std::vector<OpModule> modules;
21 
22   std::vector<double>           m_control_input;
23   MorphOutputModule            *m_output;
24   float                         m_mix_freq;
25   MorphPlanSynth               *m_morph_plan_synth;
26 
27   void clear_modules();
28   void create_modules (MorphPlanPtr plan);
29   void configure_modules();
30 
31 public:
32   MorphPlanVoice (float mix_freq, MorphPlanSynth *synth);
33   ~MorphPlanVoice();
34 
35   void cheap_update (std::map<std::string, MorphOperator *>& op_map);
36   void full_update (MorphPlanPtr plan);
37 
38   MorphOperatorModule *module (MorphOperator *op);
39 
40   double control_input (double value, MorphOperator::ControlType ctype, MorphOperatorModule *module);
41   void   set_control_input (int i, double value);
42 
43   float mix_freq() const;
44 
45   MorphOutputModule *output();
46   MorphPlanSynth *morph_plan_synth() const;
47 
48   void update_shared_state (const TimeInfo& time_info);
49 };
50 
51 }
52 
53 
54 #endif
55