/
AudioStreamPlayer3D.hx
302 lines (233 loc) · 9.31 KB
/
AudioStreamPlayer3D.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
// Automatically generated Godot externs: DO NOT EDIT
// MIT licensed, see LICENSE.md
package godot;
import cs.system.*;
/**
Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. For greater realism, a low-pass filter is automatically applied to distant sounds. This can be disabled by setting `godot.AudioStreamPlayer3D.attenuationFilterCutoffHz` to `20500`.
By default, audio is heard from the camera position. This can be changed by adding a `godot.Listener` node to the scene and enabling it by calling `godot.Listener.makeCurrent` on it.
See also `godot.AudioStreamPlayer` to play a sound non-positionally.
Note: Hiding an `godot.AudioStreamPlayer3D` node does not disable its audio output. To temporarily disable an `godot.AudioStreamPlayer3D`'s audio output, set `godot.AudioStreamPlayer3D.unitDb` to a very low value like `-100` (which isn't audible to human hearing).
**/
@:libType
@:csNative
@:native("Godot.AudioStreamPlayer3D")
@:autoBuild(godot.Godot.buildUserClass())
extern class AudioStreamPlayer3D extends godot.Spatial {
/**
`finished` signal.
**/
public var onFinished(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onFinished():Signal<Void->Void> {
return new Signal(this, "finished", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
Decides in which step the [https://en.wikipedia.org/wiki/Doppler_effect](Doppler effect) should be calculated.
Note: Only effective if the current `godot.Camera`'s `godot.Camera.dopplerTracking` property is set to a value other than `godot.Camera_DopplerTrackingEnum.disabled`.
**/
@:native("DopplerTracking")
public var dopplerTracking:godot.AudioStreamPlayer3D_DopplerTrackingEnum;
/**
Amount how much the filter affects the loudness, in decibels.
**/
@:native("AttenuationFilterDb")
public var attenuationFilterDb:Single;
/**
Dampens audio using a low-pass filter above this frequency, in Hz. To disable the dampening effect entirely, set this to `20500` as this frequency is above the human hearing limit.
**/
@:native("AttenuationFilterCutoffHz")
public var attenuationFilterCutoffHz:Single;
/**
Dampens audio if camera is outside of `godot.AudioStreamPlayer3D.emissionAngleDegrees` and `godot.AudioStreamPlayer3D.emissionAngleEnabled` is set by this factor, in decibels.
**/
@:native("EmissionAngleFilterAttenuationDb")
public var emissionAngleFilterAttenuationDb:Single;
/**
The angle in which the audio reaches cameras undampened.
**/
@:native("EmissionAngleDegrees")
public var emissionAngleDegrees:Single;
/**
If `true`, the audio should be dampened according to the direction of the sound.
**/
@:native("EmissionAngleEnabled")
public var emissionAngleEnabled:Bool;
/**
Determines which `godot.Area` layers affect the sound for reverb and audio bus effects. Areas can be used to redirect `godot.AudioStream`s so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater.
**/
@:native("AreaMask")
public var areaMask:UInt;
/**
The bus on which this audio is playing.
**/
@:native("Bus")
public var bus:std.String;
/**
Decides if audio should pause when source is outside of `godot.AudioStreamPlayer3D.maxDistance` range.
**/
@:native("OutOfRangeMode")
public var outOfRangeMode:godot.AudioStreamPlayer3D_OutOfRangeModeEnum;
/**
Sets the distance from which the `godot.AudioStreamPlayer3D.outOfRangeMode` takes effect. Has no effect if set to 0.
**/
@:native("MaxDistance")
public var maxDistance:Single;
/**
If `true`, the playback is paused. You can resume it by setting `godot.AudioStreamPlayer3D.streamPaused` to `false`.
**/
@:native("StreamPaused")
public var streamPaused:Bool;
/**
If `true`, audio plays when the AudioStreamPlayer3D node is added to scene tree.
**/
@:native("Autoplay")
public var autoplay:Bool;
/**
If `true`, audio is playing.
**/
@:native("Playing")
public var playing:Bool;
/**
The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate.
**/
@:native("PitchScale")
public var pitchScale:Single;
/**
Sets the absolute maximum of the soundlevel, in decibels.
**/
@:native("MaxDb")
public var maxDb:Single;
/**
The factor for the attenuation effect. Higher values make the sound audible over a larger distance.
**/
@:native("UnitSize")
public var unitSize:Single;
/**
The base sound level unaffected by dampening, in decibels.
**/
@:native("UnitDb")
public var unitDb:Single;
/**
Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or not be affected by distance, effectively disabling attenuation.
**/
@:native("AttenuationModel")
public var attenuationModel:godot.AudioStreamPlayer3D_AttenuationModelEnum;
/**
The `godot.AudioStream` resource to be played.
**/
@:native("Stream")
public var stream:godot.AudioStream;
@:native("new")
public function new():Void;
@:native("SetStream")
public function setStream(stream:godot.AudioStream):Void;
@:native("GetStream")
public function getStream():godot.AudioStream;
@:native("SetUnitDb")
public function setUnitDb(unitDb:Single):Void;
@:native("GetUnitDb")
public function getUnitDb():Single;
@:native("SetUnitSize")
public function setUnitSize(unitSize:Single):Void;
@:native("GetUnitSize")
public function getUnitSize():Single;
@:native("SetMaxDb")
public function setMaxDb(maxDb:Single):Void;
@:native("GetMaxDb")
public function getMaxDb():Single;
@:native("SetPitchScale")
public function setPitchScale(pitchScale:Single):Void;
@:native("GetPitchScale")
public function getPitchScale():Single;
#if doc_gen
/**
Plays the audio from the given position `from_position`, in seconds.
**/
@:native("Play")
public function play(?fromPosition:Single):Void;
#else
/**
Plays the audio from the given position `from_position`, in seconds.
**/
@:native("Play")
public overload function play():Void;
/**
Plays the audio from the given position `from_position`, in seconds.
**/
@:native("Play")
public overload function play(fromPosition:Single):Void;
#end
/**
Sets the position from which audio will be played, in seconds.
**/
@:native("Seek")
public function seek(toPosition:Single):Void;
/**
Stops the audio.
**/
@:native("Stop")
public function stop():Void;
@:native("IsPlaying")
public function isPlaying():Bool;
/**
Returns the position in the `godot.AudioStream`.
**/
@:native("GetPlaybackPosition")
public function getPlaybackPosition():Single;
@:native("SetBus")
public function setBus(bus:std.String):Void;
@:native("GetBus")
public function getBus():std.String;
@:native("SetAutoplay")
public function setAutoplay(enable:Bool):Void;
@:native("IsAutoplayEnabled")
public function isAutoplayEnabled():Bool;
@:native("SetMaxDistance")
public function setMaxDistance(metres:Single):Void;
@:native("GetMaxDistance")
public function getMaxDistance():Single;
@:native("SetAreaMask")
public function setAreaMask(mask:UInt):Void;
@:native("GetAreaMask")
public function getAreaMask():UInt;
@:native("SetEmissionAngle")
public function setEmissionAngle(degrees:Single):Void;
@:native("GetEmissionAngle")
public function getEmissionAngle():Single;
@:native("SetEmissionAngleEnabled")
public function setEmissionAngleEnabled(enabled:Bool):Void;
@:native("IsEmissionAngleEnabled")
public function isEmissionAngleEnabled():Bool;
@:native("SetEmissionAngleFilterAttenuationDb")
public function setEmissionAngleFilterAttenuationDb(db:Single):Void;
@:native("GetEmissionAngleFilterAttenuationDb")
public function getEmissionAngleFilterAttenuationDb():Single;
@:native("SetAttenuationFilterCutoffHz")
public function setAttenuationFilterCutoffHz(degrees:Single):Void;
@:native("GetAttenuationFilterCutoffHz")
public function getAttenuationFilterCutoffHz():Single;
@:native("SetAttenuationFilterDb")
public function setAttenuationFilterDb(db:Single):Void;
@:native("GetAttenuationFilterDb")
public function getAttenuationFilterDb():Single;
@:native("SetAttenuationModel")
public function setAttenuationModel(model:godot.AudioStreamPlayer3D_AttenuationModelEnum):Void;
@:native("GetAttenuationModel")
public function getAttenuationModel():godot.AudioStreamPlayer3D_AttenuationModelEnum;
@:native("SetOutOfRangeMode")
public function setOutOfRangeMode(mode:godot.AudioStreamPlayer3D_OutOfRangeModeEnum):Void;
@:native("GetOutOfRangeMode")
public function getOutOfRangeMode():godot.AudioStreamPlayer3D_OutOfRangeModeEnum;
@:native("SetDopplerTracking")
public function setDopplerTracking(mode:godot.AudioStreamPlayer3D_DopplerTrackingEnum):Void;
@:native("GetDopplerTracking")
public function getDopplerTracking():godot.AudioStreamPlayer3D_DopplerTrackingEnum;
@:native("SetStreamPaused")
public function setStreamPaused(pause:Bool):Void;
@:native("GetStreamPaused")
public function getStreamPaused():Bool;
/**
Returns the `godot.AudioStreamPlayback` object associated with this `godot.AudioStreamPlayer3D`.
**/
@:native("GetStreamPlayback")
public function getStreamPlayback():godot.AudioStreamPlayback;
}