SpectMorph

lib/smmorphlinearmodule.hh

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 #ifndef SPECTMORPH_MORPH_LINEAR_MODULE_HH
00019 #define SPECTMORPH_MORPH_LINEAR_MODULE_HH
00020 
00021 #include "smmorphplan.hh"
00022 #include "smmorphoutput.hh"
00023 #include "smmorphoperatormodule.hh"
00024 #include "smmorphlinear.hh"
00025 
00026 namespace SpectMorph
00027 {
00028 
00029 class MorphLinearModule : public MorphOperatorModule
00030 {
00031   MorphOperatorModule *left_mod;
00032   MorphOperatorModule *right_mod;
00033   MorphOperatorModule *control_mod;
00034   float                morphing;
00035   bool                 db_linear;
00036   bool                 use_lpc;
00037 
00038   MorphLinear::ControlType control_type;
00039 
00040   Audio                audio;
00041   AudioBlock           audio_block;
00042 
00043   int                  left_delay_blocks;
00044   int                  right_delay_blocks;
00045 
00046   struct MySource : public LiveDecoderSource
00047   {
00048     MorphLinearModule *module;
00049 
00050     void interp_mag_one (double interp, float *left, float *right);
00051     void retrigger (int channel, float freq, int midi_velocity, float mix_freq);
00052     Audio* audio();
00053     AudioBlock *audio_block (size_t index);
00054   } my_source;
00055 
00056 public:
00057   MorphLinearModule (MorphPlanVoice *voice);
00058   ~MorphLinearModule();
00059 
00060   void set_config (MorphOperator *op);
00061   LiveDecoderSource *source();
00062 };
00063 
00064 }
00065 
00066 #endif
 All Classes Functions Variables Enumerations Enumerator