Panda3D
filterProperties.h
1 // Filename: filterProperties.h
2 // Created by: jyelon (01Aug2007)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FILTERPROPERTIES_H
16 #define FILTERPROPERTIES_H
17 
18 #include "config_audio.h"
19 #include "typedReferenceCount.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : FilterProperties
23 // Description : Stores a configuration for a set of audio DSP filters.
24 ////////////////////////////////////////////////////////////////////
25 
26 class EXPCL_PANDA_AUDIO FilterProperties : public TypedReferenceCount {
27  PUBLISHED:
30  INLINE void clear();
31  INLINE void add_lowpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q);
32  INLINE void add_highpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q);
33  INLINE void add_echo(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat delay, PN_stdfloat decayratio);
34  INLINE void add_flange(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat depth, PN_stdfloat rate);
35  INLINE void add_distort(PN_stdfloat level);
36  INLINE void add_normalize(PN_stdfloat fadetime, PN_stdfloat threshold, PN_stdfloat maxamp);
37  INLINE void add_parameq(PN_stdfloat center_freq, PN_stdfloat bandwidth, PN_stdfloat gain);
38  INLINE void add_pitchshift(PN_stdfloat pitch, PN_stdfloat fftsize, PN_stdfloat overlap);
39  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);
40  INLINE void add_sfxreverb(PN_stdfloat drylevel=0, PN_stdfloat room=-10000, PN_stdfloat roomhf=0, PN_stdfloat decaytime=1,
41  PN_stdfloat decayhfratio=0.5, PN_stdfloat reflectionslevel=-10000, PN_stdfloat reflectionsdelay=0.02,
42  PN_stdfloat reverblevel=0, PN_stdfloat reverbdelay=0.04, PN_stdfloat diffusion=100,
43  PN_stdfloat density=100, PN_stdfloat hfreference=5000, PN_stdfloat roomlf=0, PN_stdfloat lfreference=250);
44  INLINE void add_compress(PN_stdfloat threshold, PN_stdfloat attack, PN_stdfloat release, PN_stdfloat gainmakeup);
45 
46  public:
47 
48  enum FilterType {
49  FT_lowpass,
50  FT_highpass,
51  FT_echo,
52  FT_flange,
53  FT_distort,
54  FT_normalize,
55  FT_parameq,
56  FT_pitchshift,
57  FT_chorus,
58  FT_sfxreverb,
59  FT_compress,
60  };
61 
62  struct FilterConfig {
63  FilterType _type;
64  PN_stdfloat _a,_b,_c,_d;
65  PN_stdfloat _e,_f,_g,_h;
66  PN_stdfloat _i,_j,_k,_l;
67  PN_stdfloat _m,_n;
68  };
69 
71 
72  private:
73  void add_filter(FilterType t, PN_stdfloat a=0, PN_stdfloat b=0, PN_stdfloat c=0, PN_stdfloat d=0,
74  PN_stdfloat e=0, PN_stdfloat f=0, PN_stdfloat g=0, PN_stdfloat h=0,
75  PN_stdfloat i=0, PN_stdfloat j=0, PN_stdfloat k=0, PN_stdfloat l=0,
76  PN_stdfloat m=0, PN_stdfloat n=0);
77  ConfigVector _config;
78 
79  public:
80  INLINE const ConfigVector &get_config();
81 
82  public:
83  static TypeHandle get_class_type() {
84  return _type_handle;
85  }
86  static void init_type() {
87  TypedReferenceCount::init_type();
88  register_type(_type_handle, "FilterProperties",
89  TypedReferenceCount::get_class_type());
90  }
91  virtual TypeHandle get_type() const {
92  return get_class_type();
93  }
94  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
95 
96  private:
97  static TypeHandle _type_handle;
98 };
99 
100 #include "filterProperties.I"
101 
102 #endif // FILTERPROPERTIES_H
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
Stores a configuration for a set of audio DSP filters.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85