1 /**
2 Audio effect used for recording sound from a microphone.
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.audioeffectrecord;
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 import godot.audiostreamsample;
27 /**
28 Audio effect used for recording sound from a microphone.
29 
30 Allows the user to record sound from a microphone. It sets and gets the format in which the audio file will be recorded (8-bit, 16-bit, or compressed). It checks whether or not the recording is active, and if it is, records the sound. It then returns the recorded sample.
31 */
32 @GodotBaseClass struct AudioEffectRecord
33 {
34 	package(godot) enum string _GODOT_internal_name = "AudioEffectRecord";
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_format") GodotMethod!(AudioStreamSample.Format) getFormat;
45 		@GodotName("get_recording") GodotMethod!(AudioStreamSample) getRecording;
46 		@GodotName("is_recording_active") GodotMethod!(bool) isRecordingActive;
47 		@GodotName("set_format") GodotMethod!(void, long) setFormat;
48 		@GodotName("set_recording_active") GodotMethod!(void, bool) setRecordingActive;
49 	}
50 	/// 
51 	pragma(inline, true) bool opEquals(in AudioEffectRecord other) const
52 	{ return _godot_object.ptr is other._godot_object.ptr; }
53 	/// 
54 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
55 	{ _godot_object.ptr = n; return null; }
56 	/// 
57 	pragma(inline, true) bool opEquals(typeof(null) n) const
58 	{ return _godot_object.ptr is n; }
59 	/// 
60 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
61 	mixin baseCasts;
62 	/// Construct a new instance of AudioEffectRecord.
63 	/// Note: use `memnew!AudioEffectRecord` instead.
64 	static AudioEffectRecord _new()
65 	{
66 		static godot_class_constructor constructor;
67 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioEffectRecord");
68 		if(constructor is null) return typeof(this).init;
69 		return cast(AudioEffectRecord)(constructor());
70 	}
71 	@disable new(size_t s);
72 	/**
73 	
74 	*/
75 	AudioStreamSample.Format getFormat() const
76 	{
77 		checkClassBinding!(typeof(this))();
78 		return ptrcall!(AudioStreamSample.Format)(GDNativeClassBinding.getFormat, _godot_object);
79 	}
80 	/**
81 	Returns the recorded sample.
82 	*/
83 	Ref!AudioStreamSample getRecording() const
84 	{
85 		checkClassBinding!(typeof(this))();
86 		return ptrcall!(AudioStreamSample)(GDNativeClassBinding.getRecording, _godot_object);
87 	}
88 	/**
89 	Returns whether the recording is active or not.
90 	*/
91 	bool isRecordingActive() const
92 	{
93 		checkClassBinding!(typeof(this))();
94 		return ptrcall!(bool)(GDNativeClassBinding.isRecordingActive, _godot_object);
95 	}
96 	/**
97 	
98 	*/
99 	void setFormat(in long format)
100 	{
101 		checkClassBinding!(typeof(this))();
102 		ptrcall!(void)(GDNativeClassBinding.setFormat, _godot_object, format);
103 	}
104 	/**
105 	If `true`, the sound will be recorded. Note that restarting the recording will remove the previously recorded sample.
106 	*/
107 	void setRecordingActive(in bool record)
108 	{
109 		checkClassBinding!(typeof(this))();
110 		ptrcall!(void)(GDNativeClassBinding.setRecordingActive, _godot_object, record);
111 	}
112 	/**
113 	Specifies the format in which the sample will be recorded. See $(D AudioStreamSample.format) for available formats.
114 	*/
115 	@property AudioStreamSample.Format format()
116 	{
117 		return getFormat();
118 	}
119 	/// ditto
120 	@property void format(long v)
121 	{
122 		setFormat(v);
123 	}
124 }