1 /** 2 Adds a Distortion audio effect to an Audio bus. 3 Modify the sound to make it dirty. 4 5 Copyright: 6 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 7 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 8 Copyright (c) 2017-2018 Godot-D contributors 9 10 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 11 12 13 */ 14 module godot.audioeffectdistortion; 15 import std.meta : AliasSeq, staticIndexOf; 16 import std.traits : Unqual; 17 import godot.d.meta; 18 import godot.core; 19 import godot.c; 20 import godot.d.bind; 21 import godot.d.reference; 22 import godot.object; 23 import godot.classdb; 24 import godot.audioeffect; 25 import godot.resource; 26 import godot.reference; 27 /** 28 Adds a Distortion audio effect to an Audio bus. 29 Modify the sound to make it dirty. 30 31 Modify the sound and make it dirty. Different types are available : clip, tan, lofi (bit crushing), overdrive, or waveshape. 32 By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently. 33 */ 34 @GodotBaseClass struct AudioEffectDistortion 35 { 36 enum string _GODOT_internal_name = "AudioEffectDistortion"; 37 public: 38 @nogc nothrow: 39 union { godot_object _godot_object; AudioEffect _GODOT_base; } 40 alias _GODOT_base this; 41 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 42 package(godot) __gshared bool _classBindingInitialized = false; 43 package(godot) static struct _classBinding 44 { 45 __gshared: 46 @GodotName("set_mode") GodotMethod!(void, long) setMode; 47 @GodotName("get_mode") GodotMethod!(AudioEffectDistortion.Mode) getMode; 48 @GodotName("set_pre_gain") GodotMethod!(void, double) setPreGain; 49 @GodotName("get_pre_gain") GodotMethod!(double) getPreGain; 50 @GodotName("set_keep_hf_hz") GodotMethod!(void, double) setKeepHfHz; 51 @GodotName("get_keep_hf_hz") GodotMethod!(double) getKeepHfHz; 52 @GodotName("set_drive") GodotMethod!(void, double) setDrive; 53 @GodotName("get_drive") GodotMethod!(double) getDrive; 54 @GodotName("set_post_gain") GodotMethod!(void, double) setPostGain; 55 @GodotName("get_post_gain") GodotMethod!(double) getPostGain; 56 } 57 bool opEquals(in AudioEffectDistortion other) const { return _godot_object.ptr is other._godot_object.ptr; } 58 AudioEffectDistortion opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 59 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 60 mixin baseCasts; 61 static AudioEffectDistortion _new() 62 { 63 static godot_class_constructor constructor; 64 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectDistortion"); 65 if(constructor is null) return typeof(this).init; 66 return cast(AudioEffectDistortion)(constructor()); 67 } 68 @disable new(size_t s); 69 /// 70 enum Mode : int 71 { 72 /** 73 Digital distortion effect which cuts off peaks at the top and bottom of the waveform. 74 */ 75 modeClip = 0, 76 /** 77 78 */ 79 modeAtan = 1, 80 /** 81 Low-resolution digital distortion effect. You can use it to emulate the sound of early digital audio devices. 82 */ 83 modeLofi = 2, 84 /** 85 Emulates the warm distortion produced by a field effect transistor, which is commonly used in solid-state musical instrument amplifiers. 86 */ 87 modeOverdrive = 3, 88 /** 89 Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive sound. 90 */ 91 modeWaveshape = 4, 92 } 93 /// 94 enum Constants : int 95 { 96 modeClip = 0, 97 modeAtan = 1, 98 modeLofi = 2, 99 modeOverdrive = 3, 100 modeWaveshape = 4, 101 } 102 /** 103 104 */ 105 void setMode(in long mode) 106 { 107 checkClassBinding!(typeof(this))(); 108 ptrcall!(void)(_classBinding.setMode, _godot_object, mode); 109 } 110 /** 111 112 */ 113 AudioEffectDistortion.Mode getMode() const 114 { 115 checkClassBinding!(typeof(this))(); 116 return ptrcall!(AudioEffectDistortion.Mode)(_classBinding.getMode, _godot_object); 117 } 118 /** 119 120 */ 121 void setPreGain(in double pre_gain) 122 { 123 checkClassBinding!(typeof(this))(); 124 ptrcall!(void)(_classBinding.setPreGain, _godot_object, pre_gain); 125 } 126 /** 127 128 */ 129 double getPreGain() const 130 { 131 checkClassBinding!(typeof(this))(); 132 return ptrcall!(double)(_classBinding.getPreGain, _godot_object); 133 } 134 /** 135 136 */ 137 void setKeepHfHz(in double keep_hf_hz) 138 { 139 checkClassBinding!(typeof(this))(); 140 ptrcall!(void)(_classBinding.setKeepHfHz, _godot_object, keep_hf_hz); 141 } 142 /** 143 144 */ 145 double getKeepHfHz() const 146 { 147 checkClassBinding!(typeof(this))(); 148 return ptrcall!(double)(_classBinding.getKeepHfHz, _godot_object); 149 } 150 /** 151 152 */ 153 void setDrive(in double drive) 154 { 155 checkClassBinding!(typeof(this))(); 156 ptrcall!(void)(_classBinding.setDrive, _godot_object, drive); 157 } 158 /** 159 160 */ 161 double getDrive() const 162 { 163 checkClassBinding!(typeof(this))(); 164 return ptrcall!(double)(_classBinding.getDrive, _godot_object); 165 } 166 /** 167 168 */ 169 void setPostGain(in double post_gain) 170 { 171 checkClassBinding!(typeof(this))(); 172 ptrcall!(void)(_classBinding.setPostGain, _godot_object, post_gain); 173 } 174 /** 175 176 */ 177 double getPostGain() const 178 { 179 checkClassBinding!(typeof(this))(); 180 return ptrcall!(double)(_classBinding.getPostGain, _godot_object); 181 } 182 /** 183 Distortion type. Default value: `MODE_CLIP`. 184 */ 185 @property AudioEffectDistortion.Mode mode() 186 { 187 return getMode(); 188 } 189 /// ditto 190 @property void mode(long v) 191 { 192 setMode(v); 193 } 194 /** 195 Increases or decreases the volume before the effect. Value can range from -60 to 60. Default value: `0`. 196 */ 197 @property double preGain() 198 { 199 return getPreGain(); 200 } 201 /// ditto 202 @property void preGain(double v) 203 { 204 setPreGain(v); 205 } 206 /** 207 High-pass filter. Frequencies higher than this value will not be affected by the distortion. Value can range from 1 to 20000. Default value: `16000`. 208 */ 209 @property double keepHfHz() 210 { 211 return getKeepHfHz(); 212 } 213 /// ditto 214 @property void keepHfHz(double v) 215 { 216 setKeepHfHz(v); 217 } 218 /** 219 Distortion power. Value can range from 0 to 1. Default value: `0`. 220 */ 221 @property double drive() 222 { 223 return getDrive(); 224 } 225 /// ditto 226 @property void drive(double v) 227 { 228 setDrive(v); 229 } 230 /** 231 Increases or decreases the volume after the effect. Value can range from -80 to 24. Default value: `0`. 232 */ 233 @property double postGain() 234 { 235 return getPostGain(); 236 } 237 /// ditto 238 @property void postGain(double v) 239 { 240 setPostGain(v); 241 } 242 }