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.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 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 	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 _classBinding
42 	{
43 		__gshared:
44 		@GodotName("set_ceiling_db") GodotMethod!(void, double) setCeilingDb;
45 		@GodotName("get_ceiling_db") GodotMethod!(double) getCeilingDb;
46 		@GodotName("set_threshold_db") GodotMethod!(void, double) setThresholdDb;
47 		@GodotName("get_threshold_db") GodotMethod!(double) getThresholdDb;
48 		@GodotName("set_soft_clip_db") GodotMethod!(void, double) setSoftClipDb;
49 		@GodotName("get_soft_clip_db") GodotMethod!(double) getSoftClipDb;
50 		@GodotName("set_soft_clip_ratio") GodotMethod!(void, double) setSoftClipRatio;
51 		@GodotName("get_soft_clip_ratio") GodotMethod!(double) getSoftClipRatio;
52 	}
53 	bool opEquals(in AudioEffectLimiter other) const { return _godot_object.ptr is other._godot_object.ptr; }
54 	AudioEffectLimiter opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
55 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
56 	mixin baseCasts;
57 	static AudioEffectLimiter _new()
58 	{
59 		static godot_class_constructor constructor;
60 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectLimiter");
61 		if(constructor is null) return typeof(this).init;
62 		return cast(AudioEffectLimiter)(constructor());
63 	}
64 	@disable new(size_t s);
65 	/**
66 	
67 	*/
68 	void setCeilingDb(in double ceiling)
69 	{
70 		checkClassBinding!(typeof(this))();
71 		ptrcall!(void)(_classBinding.setCeilingDb, _godot_object, ceiling);
72 	}
73 	/**
74 	
75 	*/
76 	double getCeilingDb() const
77 	{
78 		checkClassBinding!(typeof(this))();
79 		return ptrcall!(double)(_classBinding.getCeilingDb, _godot_object);
80 	}
81 	/**
82 	
83 	*/
84 	void setThresholdDb(in double threshold)
85 	{
86 		checkClassBinding!(typeof(this))();
87 		ptrcall!(void)(_classBinding.setThresholdDb, _godot_object, threshold);
88 	}
89 	/**
90 	
91 	*/
92 	double getThresholdDb() const
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(double)(_classBinding.getThresholdDb, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	void setSoftClipDb(in double soft_clip)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(_classBinding.setSoftClipDb, _godot_object, soft_clip);
104 	}
105 	/**
106 	
107 	*/
108 	double getSoftClipDb() const
109 	{
110 		checkClassBinding!(typeof(this))();
111 		return ptrcall!(double)(_classBinding.getSoftClipDb, _godot_object);
112 	}
113 	/**
114 	
115 	*/
116 	void setSoftClipRatio(in double soft_clip)
117 	{
118 		checkClassBinding!(typeof(this))();
119 		ptrcall!(void)(_classBinding.setSoftClipRatio, _godot_object, soft_clip);
120 	}
121 	/**
122 	
123 	*/
124 	double getSoftClipRatio() const
125 	{
126 		checkClassBinding!(typeof(this))();
127 		return ptrcall!(double)(_classBinding.getSoftClipRatio, _godot_object);
128 	}
129 	/**
130 	The waveform's maximum allowed value. Value can range from -20 to -0.1. Default value: `-0.1dB`.
131 	*/
132 	@property double ceilingDb()
133 	{
134 		return getCeilingDb();
135 	}
136 	/// ditto
137 	@property void ceilingDb(double v)
138 	{
139 		setCeilingDb(v);
140 	}
141 	/**
142 	Threshold from which the limiter begins to be active. Value can range from -30 to 0. Default value: `0dB`.
143 	*/
144 	@property double thresholdDb()
145 	{
146 		return getThresholdDb();
147 	}
148 	/// ditto
149 	@property void thresholdDb(double v)
150 	{
151 		setThresholdDb(v);
152 	}
153 	/**
154 	Applies a gain to the limited waves. Value can range from 0 to 6. Default value: `2dB`.
155 	*/
156 	@property double softClipDb()
157 	{
158 		return getSoftClipDb();
159 	}
160 	/// ditto
161 	@property void softClipDb(double v)
162 	{
163 		setSoftClipDb(v);
164 	}
165 	/**
166 	
167 	*/
168 	@property double softClipRatio()
169 	{
170 		return getSoftClipRatio();
171 	}
172 	/// ditto
173 	@property void softClipRatio(double v)
174 	{
175 		setSoftClipRatio(v);
176 	}
177 }