1 /**
2 Adds a distortion audio effect to an Audio bus.
3 Modify the sound to make it distorted.
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.traits;
18 import godot.core;
19 import godot.c;
20 import godot.d.bind;
21 import godot.d.reference;
22 import godot.globalenums;
23 import godot.object;
24 import godot.classdb;
25 import godot.audioeffect;
26 import godot.resource;
27 /**
28 Adds a distortion audio effect to an Audio bus.
29 Modify the sound to make it distorted.
30 
31 Different types are available: clip, tan, lo-fi (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 	package(godot) 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 GDNativeClassBinding
44 	{
45 		__gshared:
46 		@GodotName("get_drive") GodotMethod!(double) getDrive;
47 		@GodotName("get_keep_hf_hz") GodotMethod!(double) getKeepHfHz;
48 		@GodotName("get_mode") GodotMethod!(AudioEffectDistortion.Mode) getMode;
49 		@GodotName("get_post_gain") GodotMethod!(double) getPostGain;
50 		@GodotName("get_pre_gain") GodotMethod!(double) getPreGain;
51 		@GodotName("set_drive") GodotMethod!(void, double) setDrive;
52 		@GodotName("set_keep_hf_hz") GodotMethod!(void, double) setKeepHfHz;
53 		@GodotName("set_mode") GodotMethod!(void, long) setMode;
54 		@GodotName("set_post_gain") GodotMethod!(void, double) setPostGain;
55 		@GodotName("set_pre_gain") GodotMethod!(void, double) setPreGain;
56 	}
57 	/// 
58 	pragma(inline, true) bool opEquals(in AudioEffectDistortion other) const
59 	{ return _godot_object.ptr is other._godot_object.ptr; }
60 	/// 
61 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
62 	{ _godot_object.ptr = n; return null; }
63 	/// 
64 	pragma(inline, true) bool opEquals(typeof(null) n) const
65 	{ return _godot_object.ptr is n; }
66 	/// 
67 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
68 	mixin baseCasts;
69 	/// Construct a new instance of AudioEffectDistortion.
70 	/// Note: use `memnew!AudioEffectDistortion` instead.
71 	static AudioEffectDistortion _new()
72 	{
73 		static godot_class_constructor constructor;
74 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectDistortion");
75 		if(constructor is null) return typeof(this).init;
76 		return cast(AudioEffectDistortion)(constructor());
77 	}
78 	@disable new(size_t s);
79 	/// 
80 	enum Mode : int
81 	{
82 		/**
83 		Digital distortion effect which cuts off peaks at the top and bottom of the waveform.
84 		*/
85 		modeClip = 0,
86 		/**
87 		
88 		*/
89 		modeAtan = 1,
90 		/**
91 		Low-resolution digital distortion effect. You can use it to emulate the sound of early digital audio devices.
92 		*/
93 		modeLofi = 2,
94 		/**
95 		Emulates the warm distortion produced by a field effect transistor, which is commonly used in solid-state musical instrument amplifiers.
96 		*/
97 		modeOverdrive = 3,
98 		/**
99 		Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive sound.
100 		*/
101 		modeWaveshape = 4,
102 	}
103 	/// 
104 	enum Constants : int
105 	{
106 		modeClip = 0,
107 		modeAtan = 1,
108 		modeLofi = 2,
109 		modeOverdrive = 3,
110 		modeWaveshape = 4,
111 	}
112 	/**
113 	
114 	*/
115 	double getDrive() const
116 	{
117 		checkClassBinding!(typeof(this))();
118 		return ptrcall!(double)(GDNativeClassBinding.getDrive, _godot_object);
119 	}
120 	/**
121 	
122 	*/
123 	double getKeepHfHz() const
124 	{
125 		checkClassBinding!(typeof(this))();
126 		return ptrcall!(double)(GDNativeClassBinding.getKeepHfHz, _godot_object);
127 	}
128 	/**
129 	
130 	*/
131 	AudioEffectDistortion.Mode getMode() const
132 	{
133 		checkClassBinding!(typeof(this))();
134 		return ptrcall!(AudioEffectDistortion.Mode)(GDNativeClassBinding.getMode, _godot_object);
135 	}
136 	/**
137 	
138 	*/
139 	double getPostGain() const
140 	{
141 		checkClassBinding!(typeof(this))();
142 		return ptrcall!(double)(GDNativeClassBinding.getPostGain, _godot_object);
143 	}
144 	/**
145 	
146 	*/
147 	double getPreGain() const
148 	{
149 		checkClassBinding!(typeof(this))();
150 		return ptrcall!(double)(GDNativeClassBinding.getPreGain, _godot_object);
151 	}
152 	/**
153 	
154 	*/
155 	void setDrive(in double drive)
156 	{
157 		checkClassBinding!(typeof(this))();
158 		ptrcall!(void)(GDNativeClassBinding.setDrive, _godot_object, drive);
159 	}
160 	/**
161 	
162 	*/
163 	void setKeepHfHz(in double keep_hf_hz)
164 	{
165 		checkClassBinding!(typeof(this))();
166 		ptrcall!(void)(GDNativeClassBinding.setKeepHfHz, _godot_object, keep_hf_hz);
167 	}
168 	/**
169 	
170 	*/
171 	void setMode(in long mode)
172 	{
173 		checkClassBinding!(typeof(this))();
174 		ptrcall!(void)(GDNativeClassBinding.setMode, _godot_object, mode);
175 	}
176 	/**
177 	
178 	*/
179 	void setPostGain(in double post_gain)
180 	{
181 		checkClassBinding!(typeof(this))();
182 		ptrcall!(void)(GDNativeClassBinding.setPostGain, _godot_object, post_gain);
183 	}
184 	/**
185 	
186 	*/
187 	void setPreGain(in double pre_gain)
188 	{
189 		checkClassBinding!(typeof(this))();
190 		ptrcall!(void)(GDNativeClassBinding.setPreGain, _godot_object, pre_gain);
191 	}
192 	/**
193 	Distortion power. Value can range from 0 to 1.
194 	*/
195 	@property double drive()
196 	{
197 		return getDrive();
198 	}
199 	/// ditto
200 	@property void drive(double v)
201 	{
202 		setDrive(v);
203 	}
204 	/**
205 	High-pass filter, in Hz. Frequencies higher than this value will not be affected by the distortion. Value can range from 1 to 20000.
206 	*/
207 	@property double keepHfHz()
208 	{
209 		return getKeepHfHz();
210 	}
211 	/// ditto
212 	@property void keepHfHz(double v)
213 	{
214 		setKeepHfHz(v);
215 	}
216 	/**
217 	Distortion type.
218 	*/
219 	@property AudioEffectDistortion.Mode mode()
220 	{
221 		return getMode();
222 	}
223 	/// ditto
224 	@property void mode(long v)
225 	{
226 		setMode(v);
227 	}
228 	/**
229 	Increases or decreases the volume after the effect. Value can range from -80 to 24.
230 	*/
231 	@property double postGain()
232 	{
233 		return getPostGain();
234 	}
235 	/// ditto
236 	@property void postGain(double v)
237 	{
238 		setPostGain(v);
239 	}
240 	/**
241 	Increases or decreases the volume before the effect. Value can range from -60 to 60.
242 	*/
243 	@property double preGain()
244 	{
245 		return getPreGain();
246 	}
247 	/// ditto
248 	@property void preGain(double v)
249 	{
250 		setPreGain(v);
251 	}
252 }