Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/root/src/subsynth/syn/Module/AdsrEnvModule.h

Go to the documentation of this file.
00001 
00002 /****************** <SYN heading BEGIN do not edit this line> *****************
00003  *
00004  * subsynth - modular audio synthesizer
00005  * subsynth is (C) Copyright 2001-2002 by Kevin Meinert
00006  *
00007  * Original Author: Kevin Meinert
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00022  * Boston, MA 02111-1307, USA.
00023  *
00024  * -----------------------------------------------------------------
00025  * File:          $RCSfile: AdsrEnvModule.h,v $
00026  * Date modified: $Date: 2002/04/15 07:28:46 $
00027  * Version:       $Revision: 1.9 $
00028  * -----------------------------------------------------------------
00029  *
00030  ****************** <SYN heading END do not edit this line> ******************/
00031 
00032 #ifndef SUBSYNTH_ADSR_OSC_MODULE_H
00033 #define SUBSYNTH_ADSR_OSC_MODULE_H
00034 
00035 #include "syn/Util/Generator.h"
00036 #include "syn/Module/OscModule.h"
00037 
00038 namespace syn
00039 {
00044    class AdsrEnvModule : public OscModule<AdsrEnvOsc>
00045    {
00046    public:
00048       AdsrEnvModule() : OscModule<AdsrEnvOsc>()
00049       {
00050       }
00051    
00053       virtual ~AdsrEnvModule()
00054       {
00055       }
00056 
00057       void trigger()
00058       {
00059          this->osc().trigger();
00060       }
00061 
00062       void trigger( float durationSecs )
00063       {
00064          this->osc().trigger( durationSecs );
00065       }
00066 
00067       void release()
00068       {
00069          this->osc().release();
00070       }
00071       
00072       void setAttackTime( float a )
00073       {
00074          this->osc().setAttackTime( a );
00075       }
00076       
00077       void setDecayTime( float a )
00078       {
00079          this->osc().setDecayTime( a );
00080       }
00081       
00082       void setSustainLevel( float a )
00083       {
00084          this->osc().setSustainLevel( a );
00085       }
00086       
00087       void setReleaseTime( float a )
00088       {
00089          this->osc().setReleaseTime( a );
00090       }
00091       
00092       
00093       float getAttackTime()
00094       {
00095          return this->osc().getAttackTime();
00096       }
00097       
00098       float getDecayTime()
00099       {
00100          return this->osc().getDecayTime();
00101       }
00102       
00103       float getSustainLevel()
00104       {
00105          return this->osc().getSustainLevel();
00106       }
00107       
00108       float getReleaseTime()
00109       {
00110          return this->osc().getReleaseTime();
00111       }
00112       
00116       virtual void getParam( const std::string& key, MultivariateType& value )
00117       {
00118          if (key == "attackTime")
00119             value.setValue<float>( this->getAttackTime() );
00120          else if (key == "decayTime")
00121             value.setValue<float>( this->getDecayTime() );
00122          else if (key == "sustainLevel")
00123             value.setValue<float>( this->getSustainLevel() );
00124          else if (key == "releaseTime")
00125             value.setValue<float>( this->getReleaseTime() );
00126       }
00127 
00129       virtual void setParam( const std::string& key, const MultivariateType& value )
00130       {
00131          if (key == "attackTime")
00132             this->setAttackTime( value.getValue<float>() );
00133          else if (key == "decayTime")
00134             this->setDecayTime( value.getValue<float>() );
00135          else if (key == "sustainLevel")
00136             this->setSustainLevel( value.getValue<float>() );
00137          else if (key == "releaseTime")
00138             this->setReleaseTime( value.getValue<float>() );
00139       }
00141    };
00142 }
00143 #endif

Generated at Mon Apr 15 09:26:07 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001