Panda3D

filterProperties.h

00001 // Filename: filterProperties.h
00002 // Created by: jyelon (01Aug2007)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef FILTERPROPERTIES_H
00016 #define FILTERPROPERTIES_H
00017 
00018 #include "config_audio.h"
00019 #include "typedReferenceCount.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //       Class : FilterProperties
00023 // Description : Stores a configuration for a set of audio DSP filters.
00024 ////////////////////////////////////////////////////////////////////
00025 
00026 class EXPCL_PANDA_AUDIO FilterProperties : public TypedReferenceCount {
00027  PUBLISHED:
00028   FilterProperties();
00029   ~FilterProperties();
00030   INLINE void clear();
00031   INLINE void add_lowpass(float cutoff_freq, float resonance_q);
00032   INLINE void add_highpass(float cutoff_freq, float resonance_q);
00033   INLINE void add_echo(float drymix, float wetmix, float delay, float decayratio);
00034   INLINE void add_flange(float drymix, float wetmix, float depth, float rate);
00035   INLINE void add_distort(float level);
00036   INLINE void add_normalize(float fadetime, float threshold, float maxamp);
00037   INLINE void add_parameq(float center_freq, float bandwidth, float gain);
00038   INLINE void add_pitchshift(float pitch, float fftsize, float overlap);
00039   INLINE void add_chorus(float drymix, float wet1, float wet2, float wet3, float delay, float rate, float depth, float feedback);
00040   INLINE void add_reverb(float drymix, float wetmix, float roomsize, float damp, float width);
00041   INLINE void add_compress(float threshold, float attack, float release, float gainmakeup);
00042 
00043  public:
00044 
00045   enum FilterType {
00046     FT_lowpass,
00047     FT_highpass,
00048     FT_echo,
00049     FT_flange,
00050     FT_distort,
00051     FT_normalize,
00052     FT_parameq,
00053     FT_pitchshift,
00054     FT_chorus,
00055     FT_reverb,
00056     FT_compress,
00057   };
00058 
00059   struct FilterConfig {
00060     FilterType  _type;
00061     float       _a,_b,_c,_d;
00062     float       _e,_f,_g,_h;
00063   };
00064   
00065   typedef pvector<FilterConfig> ConfigVector;
00066   
00067  private:  
00068   void add_filter(FilterType t, float a=0, float b=0, float c=0, float d=0, float e=0, float f=0, float g=0, float h=0);
00069   ConfigVector _config;
00070   
00071  public:
00072   INLINE const ConfigVector &get_config();
00073 
00074  public:
00075   static TypeHandle get_class_type() {
00076     return _type_handle;
00077   }
00078   static void init_type() {
00079     TypedReferenceCount::init_type();
00080     register_type(_type_handle, "FilterProperties",
00081                   TypedReferenceCount::get_class_type());
00082   }
00083   virtual TypeHandle get_type() const {
00084     return get_class_type();
00085   }
00086   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00087 
00088  private:
00089   static TypeHandle _type_handle;
00090 };  
00091 
00092 #include "filterProperties.I"
00093 
00094 #endif // FILTERPROPERTIES_H
 All Classes Functions Variables Enumerations