Panda3D
|
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(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q); 00032 INLINE void add_highpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q); 00033 INLINE void add_echo(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat delay, PN_stdfloat decayratio); 00034 INLINE void add_flange(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat depth, PN_stdfloat rate); 00035 INLINE void add_distort(PN_stdfloat level); 00036 INLINE void add_normalize(PN_stdfloat fadetime, PN_stdfloat threshold, PN_stdfloat maxamp); 00037 INLINE void add_parameq(PN_stdfloat center_freq, PN_stdfloat bandwidth, PN_stdfloat gain); 00038 INLINE void add_pitchshift(PN_stdfloat pitch, PN_stdfloat fftsize, PN_stdfloat overlap); 00039 INLINE void add_chorus(PN_stdfloat drymix, PN_stdfloat wet1, PN_stdfloat wet2, PN_stdfloat wet3, PN_stdfloat delay, PN_stdfloat rate, PN_stdfloat depth, PN_stdfloat feedback); 00040 INLINE void add_reverb(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat roomsize, PN_stdfloat damp, PN_stdfloat width); 00041 INLINE void add_compress(PN_stdfloat threshold, PN_stdfloat attack, PN_stdfloat release, PN_stdfloat 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 PN_stdfloat _a,_b,_c,_d; 00062 PN_stdfloat _e,_f,_g,_h; 00063 }; 00064 00065 typedef pvector<FilterConfig> ConfigVector; 00066 00067 private: 00068 void add_filter(FilterType t, PN_stdfloat a=0, PN_stdfloat b=0, PN_stdfloat c=0, PN_stdfloat d=0, PN_stdfloat e=0, PN_stdfloat f=0, PN_stdfloat g=0, PN_stdfloat 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