Panda3D

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