1 /**
2 MP3 audio stream driver.
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.audiostreammp3;
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.audiostream;
25 import godot.resource;
26 /**
27 MP3 audio stream driver.
28 
29 
30 */
31 @GodotBaseClass struct AudioStreamMP3
32 {
33 	package(godot) enum string _GODOT_internal_name = "AudioStreamMP3";
34 public:
35 @nogc nothrow:
36 	union { /** */ godot_object _godot_object; /** */ AudioStream _GODOT_base; }
37 	alias _GODOT_base this;
38 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
39 	package(godot) __gshared bool _classBindingInitialized = false;
40 	package(godot) static struct GDNativeClassBinding
41 	{
42 		__gshared:
43 		@GodotName("get_data") GodotMethod!(PoolByteArray) getData;
44 		@GodotName("get_loop_offset") GodotMethod!(double) getLoopOffset;
45 		@GodotName("has_loop") GodotMethod!(bool) hasLoop;
46 		@GodotName("set_data") GodotMethod!(void, PoolByteArray) setData;
47 		@GodotName("set_loop") GodotMethod!(void, bool) setLoop;
48 		@GodotName("set_loop_offset") GodotMethod!(void, double) setLoopOffset;
49 	}
50 	/// 
51 	pragma(inline, true) bool opEquals(in AudioStreamMP3 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 AudioStreamMP3.
63 	/// Note: use `memnew!AudioStreamMP3` instead.
64 	static AudioStreamMP3 _new()
65 	{
66 		static godot_class_constructor constructor;
67 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AudioStreamMP3");
68 		if(constructor is null) return typeof(this).init;
69 		return cast(AudioStreamMP3)(constructor());
70 	}
71 	@disable new(size_t s);
72 	/**
73 	
74 	*/
75 	PoolByteArray getData() const
76 	{
77 		checkClassBinding!(typeof(this))();
78 		return ptrcall!(PoolByteArray)(GDNativeClassBinding.getData, _godot_object);
79 	}
80 	/**
81 	
82 	*/
83 	double getLoopOffset() const
84 	{
85 		checkClassBinding!(typeof(this))();
86 		return ptrcall!(double)(GDNativeClassBinding.getLoopOffset, _godot_object);
87 	}
88 	/**
89 	
90 	*/
91 	bool hasLoop() const
92 	{
93 		checkClassBinding!(typeof(this))();
94 		return ptrcall!(bool)(GDNativeClassBinding.hasLoop, _godot_object);
95 	}
96 	/**
97 	
98 	*/
99 	void setData(in PoolByteArray data)
100 	{
101 		checkClassBinding!(typeof(this))();
102 		ptrcall!(void)(GDNativeClassBinding.setData, _godot_object, data);
103 	}
104 	/**
105 	
106 	*/
107 	void setLoop(in bool enable)
108 	{
109 		checkClassBinding!(typeof(this))();
110 		ptrcall!(void)(GDNativeClassBinding.setLoop, _godot_object, enable);
111 	}
112 	/**
113 	
114 	*/
115 	void setLoopOffset(in double seconds)
116 	{
117 		checkClassBinding!(typeof(this))();
118 		ptrcall!(void)(GDNativeClassBinding.setLoopOffset, _godot_object, seconds);
119 	}
120 	/**
121 	Contains the audio data in bytes.
122 	*/
123 	@property PoolByteArray data()
124 	{
125 		return getData();
126 	}
127 	/// ditto
128 	@property void data(PoolByteArray v)
129 	{
130 		setData(v);
131 	}
132 	/**
133 	If `true`, the stream will automatically loop when it reaches the end.
134 	*/
135 	@property bool loop()
136 	{
137 		return hasLoop();
138 	}
139 	/// ditto
140 	@property void loop(bool v)
141 	{
142 		setLoop(v);
143 	}
144 	/**
145 	Time in seconds at which the stream starts after being looped.
146 	*/
147 	@property double loopOffset()
148 	{
149 		return getLoopOffset();
150 	}
151 	/// ditto
152 	@property void loopOffset(double v)
153 	{
154 		setLoopOffset(v);
155 	}
156 }