SpectMorph

lib/smmorphoperatormodule.hh

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_OPERATOR_MODULE_HH
00019 #define SPECTMORPH_MORPH_OPERATOR_MODULE_HH
00020 
00021 #include "smmorphoperator.hh"
00022 #include "smlivedecodersource.hh"
00023 
00024 #include <string>
00025 
00026 namespace SpectMorph
00027 {
00028 
00029 class MorphPlanVoice;
00030 
00031 class MorphModuleSharedState
00032 {
00033 public:
00034   MorphModuleSharedState();
00035   virtual ~MorphModuleSharedState();
00036 };
00037 
00038 class MorphOperatorModule
00039 {
00040 protected:
00041   MorphPlanVoice                     *morph_plan_voice;
00042   std::vector<MorphOperatorModule *>  m_dependencies;
00043   int                                 m_update_value_tag;
00044 
00045   void update_dependency (size_t i, MorphOperatorModule *dep_mod);
00046 public:
00047   MorphOperatorModule (MorphPlanVoice *voice, size_t n_dependencies);
00048   virtual ~MorphOperatorModule();
00049 
00050   virtual float latency_ms();
00051   virtual void set_latency_ms (float latency_ms);
00052   virtual void set_config (MorphOperator *op) = 0;
00053   virtual LiveDecoderSource *source();
00054   virtual float value();
00055   virtual void reset_value();
00056   virtual void update_value (double time_ms);
00057   virtual void update_shared_state (double time_ms);
00058 
00059   const std::vector<MorphOperatorModule *>& dependencies() const;
00060   int& update_value_tag();
00061 
00062   static MorphOperatorModule *create (MorphOperator *op, MorphPlanVoice *voice);
00063 };
00064 
00065 }
00066 
00067 #endif
 All Classes Functions Variables Enumerations Enumerator