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.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.audioeffect; 25 import godot.resource; 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 package(godot) 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 GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_cutoff") GodotMethod!(double) getCutoff; 44 @GodotName("get_db") GodotMethod!(AudioEffectFilter.FilterDB) getDb; 45 @GodotName("get_gain") GodotMethod!(double) getGain; 46 @GodotName("get_resonance") GodotMethod!(double) getResonance; 47 @GodotName("set_cutoff") GodotMethod!(void, double) setCutoff; 48 @GodotName("set_db") GodotMethod!(void, long) setDb; 49 @GodotName("set_gain") GodotMethod!(void, double) setGain; 50 @GodotName("set_resonance") GodotMethod!(void, double) setResonance; 51 } 52 /// 53 pragma(inline, true) bool opEquals(in AudioEffectFilter other) const 54 { return _godot_object.ptr is other._godot_object.ptr; } 55 /// 56 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 57 { _godot_object.ptr = n; return null; } 58 /// 59 pragma(inline, true) bool opEquals(typeof(null) n) const 60 { return _godot_object.ptr is n; } 61 /// 62 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 63 mixin baseCasts; 64 /// Construct a new instance of AudioEffectFilter. 65 /// Note: use `memnew!AudioEffectFilter` instead. 66 static AudioEffectFilter _new() 67 { 68 static godot_class_constructor constructor; 69 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectFilter"); 70 if(constructor is null) return typeof(this).init; 71 return cast(AudioEffectFilter)(constructor()); 72 } 73 @disable new(size_t s); 74 /// 75 enum FilterDB : int 76 { 77 /** 78 79 */ 80 filter6db = 0, 81 /** 82 83 */ 84 filter12db = 1, 85 /** 86 87 */ 88 filter18db = 2, 89 /** 90 91 */ 92 filter24db = 3, 93 } 94 /// 95 enum Constants : int 96 { 97 filter6db = 0, 98 filter12db = 1, 99 filter18db = 2, 100 filter24db = 3, 101 } 102 /** 103 104 */ 105 double getCutoff() const 106 { 107 checkClassBinding!(typeof(this))(); 108 return ptrcall!(double)(GDNativeClassBinding.getCutoff, _godot_object); 109 } 110 /** 111 112 */ 113 AudioEffectFilter.FilterDB getDb() const 114 { 115 checkClassBinding!(typeof(this))(); 116 return ptrcall!(AudioEffectFilter.FilterDB)(GDNativeClassBinding.getDb, _godot_object); 117 } 118 /** 119 120 */ 121 double getGain() const 122 { 123 checkClassBinding!(typeof(this))(); 124 return ptrcall!(double)(GDNativeClassBinding.getGain, _godot_object); 125 } 126 /** 127 128 */ 129 double getResonance() const 130 { 131 checkClassBinding!(typeof(this))(); 132 return ptrcall!(double)(GDNativeClassBinding.getResonance, _godot_object); 133 } 134 /** 135 136 */ 137 void setCutoff(in double freq) 138 { 139 checkClassBinding!(typeof(this))(); 140 ptrcall!(void)(GDNativeClassBinding.setCutoff, _godot_object, freq); 141 } 142 /** 143 144 */ 145 void setDb(in long amount) 146 { 147 checkClassBinding!(typeof(this))(); 148 ptrcall!(void)(GDNativeClassBinding.setDb, _godot_object, amount); 149 } 150 /** 151 152 */ 153 void setGain(in double amount) 154 { 155 checkClassBinding!(typeof(this))(); 156 ptrcall!(void)(GDNativeClassBinding.setGain, _godot_object, amount); 157 } 158 /** 159 160 */ 161 void setResonance(in double amount) 162 { 163 checkClassBinding!(typeof(this))(); 164 ptrcall!(void)(GDNativeClassBinding.setResonance, _godot_object, amount); 165 } 166 /** 167 Threshold frequency for the filter, in Hz. 168 */ 169 @property double cutoffHz() 170 { 171 return getCutoff(); 172 } 173 /// ditto 174 @property void cutoffHz(double v) 175 { 176 setCutoff(v); 177 } 178 /** 179 180 */ 181 @property AudioEffectFilter.FilterDB db() 182 { 183 return getDb(); 184 } 185 /// ditto 186 @property void db(long v) 187 { 188 setDb(v); 189 } 190 /** 191 Gain amount of the frequencies after the filter. 192 */ 193 @property double gain() 194 { 195 return getGain(); 196 } 197 /// ditto 198 @property void gain(double v) 199 { 200 setGain(v); 201 } 202 /** 203 Amount of boost in the frequency range near the cutoff frequency. 204 */ 205 @property double resonance() 206 { 207 return getResonance(); 208 } 209 /// ditto 210 @property void resonance(double v) 211 { 212 setResonance(v); 213 } 214 }