1 /**
2 Adds a filter to the Audio Bus.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.audioeffectfilter;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.meta;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.object;
22 import godot.classdb;
23 import godot.audioeffect;
24 import godot.resource;
25 import godot.reference;
26 /**
27 Adds a filter to the Audio Bus.
28 
29 Allows frequencies other than the $(D cutoffHz) to pass.
30 */
31 @GodotBaseClass struct AudioEffectFilter
32 {
33 	enum string _GODOT_internal_name = "AudioEffectFilter";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; AudioEffect _GODOT_base; }
37 	alias _GODOT_base this;
38 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
39 	package(godot) __gshared bool _classBindingInitialized = false;
40 	package(godot) static struct _classBinding
41 	{
42 		__gshared:
43 		@GodotName("set_cutoff") GodotMethod!(void, double) setCutoff;
44 		@GodotName("get_cutoff") GodotMethod!(double) getCutoff;
45 		@GodotName("set_resonance") GodotMethod!(void, double) setResonance;
46 		@GodotName("get_resonance") GodotMethod!(double) getResonance;
47 		@GodotName("set_gain") GodotMethod!(void, double) setGain;
48 		@GodotName("get_gain") GodotMethod!(double) getGain;
49 		@GodotName("set_db") GodotMethod!(void, long) setDb;
50 		@GodotName("get_db") GodotMethod!(AudioEffectFilter.FilterDB) getDb;
51 	}
52 	bool opEquals(in AudioEffectFilter other) const { return _godot_object.ptr is other._godot_object.ptr; }
53 	AudioEffectFilter opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
54 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
55 	mixin baseCasts;
56 	static AudioEffectFilter _new()
57 	{
58 		static godot_class_constructor constructor;
59 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectFilter");
60 		if(constructor is null) return typeof(this).init;
61 		return cast(AudioEffectFilter)(constructor());
62 	}
63 	@disable new(size_t s);
64 	/// 
65 	enum FilterDB : int
66 	{
67 		/**
68 		
69 		*/
70 		filter6db = 0,
71 		/**
72 		
73 		*/
74 		filter12db = 1,
75 		/**
76 		
77 		*/
78 		filter18db = 2,
79 		/**
80 		
81 		*/
82 		filter24db = 3,
83 	}
84 	/// 
85 	enum Constants : int
86 	{
87 		filter6db = 0,
88 		filter12db = 1,
89 		filter18db = 2,
90 		filter24db = 3,
91 	}
92 	/**
93 	
94 	*/
95 	void setCutoff(in double freq)
96 	{
97 		checkClassBinding!(typeof(this))();
98 		ptrcall!(void)(_classBinding.setCutoff, _godot_object, freq);
99 	}
100 	/**
101 	
102 	*/
103 	double getCutoff() const
104 	{
105 		checkClassBinding!(typeof(this))();
106 		return ptrcall!(double)(_classBinding.getCutoff, _godot_object);
107 	}
108 	/**
109 	
110 	*/
111 	void setResonance(in double amount)
112 	{
113 		checkClassBinding!(typeof(this))();
114 		ptrcall!(void)(_classBinding.setResonance, _godot_object, amount);
115 	}
116 	/**
117 	
118 	*/
119 	double getResonance() const
120 	{
121 		checkClassBinding!(typeof(this))();
122 		return ptrcall!(double)(_classBinding.getResonance, _godot_object);
123 	}
124 	/**
125 	
126 	*/
127 	void setGain(in double amount)
128 	{
129 		checkClassBinding!(typeof(this))();
130 		ptrcall!(void)(_classBinding.setGain, _godot_object, amount);
131 	}
132 	/**
133 	
134 	*/
135 	double getGain() const
136 	{
137 		checkClassBinding!(typeof(this))();
138 		return ptrcall!(double)(_classBinding.getGain, _godot_object);
139 	}
140 	/**
141 	
142 	*/
143 	void setDb(in long amount)
144 	{
145 		checkClassBinding!(typeof(this))();
146 		ptrcall!(void)(_classBinding.setDb, _godot_object, amount);
147 	}
148 	/**
149 	
150 	*/
151 	AudioEffectFilter.FilterDB getDb() const
152 	{
153 		checkClassBinding!(typeof(this))();
154 		return ptrcall!(AudioEffectFilter.FilterDB)(_classBinding.getDb, _godot_object);
155 	}
156 	/**
157 	Threshold frequency for the filter.
158 	*/
159 	@property double cutoffHz()
160 	{
161 		return getCutoff();
162 	}
163 	/// ditto
164 	@property void cutoffHz(double v)
165 	{
166 		setCutoff(v);
167 	}
168 	/**
169 	Amount of boost in the overtones near the cutoff frequency.
170 	*/
171 	@property double resonance()
172 	{
173 		return getResonance();
174 	}
175 	/// ditto
176 	@property void resonance(double v)
177 	{
178 		setResonance(v);
179 	}
180 	/**
181 	Gain amount of the frequencies after the filter.
182 	*/
183 	@property double gain()
184 	{
185 		return getGain();
186 	}
187 	/// ditto
188 	@property void gain(double v)
189 	{
190 		setGain(v);
191 	}
192 	/**
193 	
194 	*/
195 	@property AudioEffectFilter.FilterDB db()
196 	{
197 		return getDb();
198 	}
199 	/// ditto
200 	@property void db(long v)
201 	{
202 		setDb(v);
203 	}
204 }