Panda3D

Loading...
Searching...
No Matches
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::add_lowpass
void add_lowpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q)
Add a lowpass filter to the end of the DSP chain.
Definition filterProperties.I:26
FilterProperties::add_distort
void add_distort(PN_stdfloat level)
Add a distort filter to the end of the DSP chain.
Definition filterProperties.I:58
FilterProperties::add_normalize
void add_normalize(PN_stdfloat fadetime, PN_stdfloat threshold, PN_stdfloat maxamp)
Add a normalize filter to the end of the DSP chain.
Definition filterProperties.I:66
FilterProperties::add_highpass
void add_highpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q)
Add a highpass filter to the end of the DSP chain.
Definition filterProperties.I:34
FilterProperties::add_compress
void add_compress(PN_stdfloat threshold, PN_stdfloat attack, PN_stdfloat release, PN_stdfloat gainmakeup)
Add a compress filter to the end of the DSP chain.
Definition filterProperties.I:110
FilterProperties::add_echo
void add_echo(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat delay, PN_stdfloat decayratio)
Add a echo filter to the end of the DSP chain.
Definition filterProperties.I:42
FilterProperties::clear
void clear()
Removes all DSP postprocessing.
Definition filterProperties.I:18
FilterProperties::add_flange
void add_flange(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat depth, PN_stdfloat rate)
Add a flange filter to the end of the DSP chain.
Definition filterProperties.I:50
FilterProperties::get_config
const ConfigVector & get_config()
Intended for use by AudioManager and AudioSound implementations: allows access to the config vector.
Definition filterProperties.I:119
FilterProperties::add_sfxreverb
void add_sfxreverb(PN_stdfloat drylevel=0, PN_stdfloat room=-10000, PN_stdfloat roomhf=0, PN_stdfloat decaytime=1, PN_stdfloat decayhfratio=0.5, PN_stdfloat reflectionslevel=-10000, PN_stdfloat reflectionsdelay=0.02, PN_stdfloat reverblevel=0, PN_stdfloat reverbdelay=0.04, PN_stdfloat diffusion=100, PN_stdfloat density=100, PN_stdfloat hfreference=5000, PN_stdfloat roomlf=0, PN_stdfloat lfreference=250)
Add a reverb filter to the end of the DSP chain.
Definition filterProperties.I:98
FilterProperties::add_pitchshift
void add_pitchshift(PN_stdfloat pitch, PN_stdfloat fftsize, PN_stdfloat overlap)
Add a pitchshift filter to the end of the DSP chain.
Definition filterProperties.I:82
FilterProperties::add_chorus
void add_chorus(PN_stdfloat drymix, PN_stdfloat wet1, PN_stdfloat wet2, PN_stdfloat wet3, PN_stdfloat delay, PN_stdfloat rate, PN_stdfloat depth)
Add a chorus filter to the end of the DSP chain.
Definition filterProperties.I:90
FilterProperties::add_parameq
void add_parameq(PN_stdfloat center_freq, PN_stdfloat bandwidth, PN_stdfloat gain)
Add a parameq filter to the end of the DSP chain.
Definition filterProperties.I:74
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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.