1 /**
2 Adds a soft-clip limiter audio effect to an 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.audioeffectlimiter;
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 soft-clip limiter audio effect to an Audio bus.
28 
29 A limiter is similar to a compressor, but it's less flexible and designed to disallow sound going over a given dB threshold. Adding one in the Master bus is always recommended to reduce the effects of clipping.
30 Soft clipping starts to reduce the peaks a little below the threshold level and progressively increases its effect as the input level increases such that the threshold is never exceeded.
31 */
32 @GodotBaseClass struct AudioEffectLimiter
33 {
34 	package(godot) enum string _GODOT_internal_name = "AudioEffectLimiter";
35 public:
36 @nogc nothrow:
37 	union { /** */ godot_object _godot_object; /** */ AudioEffect _GODOT_base; }
38 	alias _GODOT_base this;
39 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
40 	package(godot) __gshared bool _classBindingInitialized = false;
41 	package(godot) static struct GDNativeClassBinding
42 	{
43 		__gshared:
44 		@GodotName("get_ceiling_db") GodotMethod!(double) getCeilingDb;
45 		@GodotName("get_soft_clip_db") GodotMethod!(double) getSoftClipDb;
46 		@GodotName("get_soft_clip_ratio") GodotMethod!(double) getSoftClipRatio;
47 		@GodotName("get_threshold_db") GodotMethod!(double) getThresholdDb;
48 		@GodotName("set_ceiling_db") GodotMethod!(void, double) setCeilingDb;
49 		@GodotName("set_soft_clip_db") GodotMethod!(void, double) setSoftClipDb;
50 		@GodotName("set_soft_clip_ratio") GodotMethod!(void, double) setSoftClipRatio;
51 		@GodotName("set_threshold_db") GodotMethod!(void, double) setThresholdDb;
52 	}
53 	/// 
54 	pragma(inline, true) bool opEquals(in AudioEffectLimiter other) const
55 	{ return _godot_object.ptr is other._godot_object.ptr; }
56 	/// 
57 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
58 	{ _godot_object.ptr = n; return null; }
59 	/// 
60 	pragma(inline, true) bool opEquals(typeof(null) n) const
61 	{ return _godot_object.ptr is n; }
62 	/// 
63 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
64 	mixin baseCasts;
65 	/// Construct a new instance of AudioEffectLimiter.
66 	/// Note: use `memnew!AudioEffectLimiter` instead.
67 	static AudioEffectLimiter _new()
68 	{
69 		static godot_class_constructor constructor;
70 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectLimiter");
71 		if(constructor is null) return typeof(this).init;
72 		return cast(AudioEffectLimiter)(constructor());
73 	}
74 	@disable new(size_t s);
75 	/**
76 	
77 	*/
78 	double getCeilingDb() const
79 	{
80 		checkClassBinding!(typeof(this))();
81 		return ptrcall!(double)(GDNativeClassBinding.getCeilingDb, _godot_object);
82 	}
83 	/**
84 	
85 	*/
86 	double getSoftClipDb() const
87 	{
88 		checkClassBinding!(typeof(this))();
89 		return ptrcall!(double)(GDNativeClassBinding.getSoftClipDb, _godot_object);
90 	}
91 	/**
92 	
93 	*/
94 	double getSoftClipRatio() const
95 	{
96 		checkClassBinding!(typeof(this))();
97 		return ptrcall!(double)(GDNativeClassBinding.getSoftClipRatio, _godot_object);
98 	}
99 	/**
100 	
101 	*/
102 	double getThresholdDb() const
103 	{
104 		checkClassBinding!(typeof(this))();
105 		return ptrcall!(double)(GDNativeClassBinding.getThresholdDb, _godot_object);
106 	}
107 	/**
108 	
109 	*/
110 	void setCeilingDb(in double ceiling)
111 	{
112 		checkClassBinding!(typeof(this))();
113 		ptrcall!(void)(GDNativeClassBinding.setCeilingDb, _godot_object, ceiling);
114 	}
115 	/**
116 	
117 	*/
118 	void setSoftClipDb(in double soft_clip)
119 	{
120 		checkClassBinding!(typeof(this))();
121 		ptrcall!(void)(GDNativeClassBinding.setSoftClipDb, _godot_object, soft_clip);
122 	}
123 	/**
124 	
125 	*/
126 	void setSoftClipRatio(in double soft_clip)
127 	{
128 		checkClassBinding!(typeof(this))();
129 		ptrcall!(void)(GDNativeClassBinding.setSoftClipRatio, _godot_object, soft_clip);
130 	}
131 	/**
132 	
133 	*/
134 	void setThresholdDb(in double threshold)
135 	{
136 		checkClassBinding!(typeof(this))();
137 		ptrcall!(void)(GDNativeClassBinding.setThresholdDb, _godot_object, threshold);
138 	}
139 	/**
140 	The waveform's maximum allowed value, in decibels. Value can range from -20 to -0.1.
141 	*/
142 	@property double ceilingDb()
143 	{
144 		return getCeilingDb();
145 	}
146 	/// ditto
147 	@property void ceilingDb(double v)
148 	{
149 		setCeilingDb(v);
150 	}
151 	/**
152 	Applies a gain to the limited waves, in decibels. Value can range from 0 to 6.
153 	*/
154 	@property double softClipDb()
155 	{
156 		return getSoftClipDb();
157 	}
158 	/// ditto
159 	@property void softClipDb(double v)
160 	{
161 		setSoftClipDb(v);
162 	}
163 	/**
164 	
165 	*/
166 	@property double softClipRatio()
167 	{
168 		return getSoftClipRatio();
169 	}
170 	/// ditto
171 	@property void softClipRatio(double v)
172 	{
173 		setSoftClipRatio(v);
174 	}
175 	/**
176 	Threshold from which the limiter begins to be active, in decibels. Value can range from -30 to 0.
177 	*/
178 	@property double thresholdDb()
179 	{
180 		return getThresholdDb();
181 	}
182 	/// ditto
183 	@property void thresholdDb(double v)
184 	{
185 		setThresholdDb(v);
186 	}
187 }