sfml.js 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/README.ja.md +10 -9
  2. package/README.ko.md +10 -9
  3. package/README.md +10 -9
  4. package/README.zh-CN.md +10 -9
  5. package/binding.gyp +23 -16
  6. package/dist/audio/effect-processor.js +9 -3
  7. package/dist/audio/input-sound-file.js +41 -15
  8. package/dist/audio/listener.js +33 -11
  9. package/dist/audio/music.js +41 -18
  10. package/dist/audio/output-sound-file.js +4 -2
  11. package/dist/audio/playback-device.js +11 -3
  12. package/dist/audio/sound-buffer-recorder.js +8 -5
  13. package/dist/audio/sound-buffer.js +40 -17
  14. package/dist/audio/sound-file-factory.js +21 -9
  15. package/dist/audio/sound-file-reader.js +21 -7
  16. package/dist/audio/sound-recorder.js +36 -15
  17. package/dist/audio/sound-source.js +117 -40
  18. package/dist/audio/sound-stream.js +14 -5
  19. package/dist/audio/sound.js +9 -4
  20. package/dist/audio/value.js +42 -16
  21. package/dist/graphics/blend-mode.js +2 -1
  22. package/dist/graphics/boolean-vector.d.ts +1 -2
  23. package/dist/graphics/boolean-vector.js +19 -9
  24. package/dist/graphics/color.js +2 -1
  25. package/dist/graphics/convex-shape.js +7 -3
  26. package/dist/graphics/font.js +52 -23
  27. package/dist/graphics/glsl-matrix.js +8 -3
  28. package/dist/graphics/glsl.js +47 -16
  29. package/dist/graphics/glyph.js +27 -10
  30. package/dist/graphics/image.js +30 -14
  31. package/dist/graphics/rect.js +15 -8
  32. package/dist/graphics/render-states.js +18 -9
  33. package/dist/graphics/render-target.js +49 -23
  34. package/dist/graphics/render-texture.js +24 -12
  35. package/dist/graphics/render-window.js +6 -3
  36. package/dist/graphics/shader.js +67 -32
  37. package/dist/graphics/shape.js +25 -13
  38. package/dist/graphics/sprite.js +19 -9
  39. package/dist/graphics/stencil-mode.js +10 -6
  40. package/dist/graphics/swap.js +2 -1
  41. package/dist/graphics/text.js +123 -48
  42. package/dist/graphics/texture.js +48 -24
  43. package/dist/graphics/transform.js +29 -13
  44. package/dist/graphics/transformable.js +2 -1
  45. package/dist/graphics/vertex-array.js +40 -18
  46. package/dist/graphics/vertex-buffer.js +39 -19
  47. package/dist/graphics/vertex.js +6 -3
  48. package/dist/graphics/view.js +30 -14
  49. package/dist/index.d.ts +4 -4
  50. package/dist/internal/audio-codec-registry.js +12 -6
  51. package/dist/internal/audio-input-stream.js +2 -1
  52. package/dist/internal/audio-music-pump.js +58 -24
  53. package/dist/internal/audio-recorder-session.js +17 -7
  54. package/dist/internal/audio-worker-session.js +28 -10
  55. package/dist/internal/audio-worker.js +40 -21
  56. package/dist/internal/glsl-value.d.ts +3 -1
  57. package/dist/internal/glsl-value.js +18 -8
  58. package/dist/internal/graphics-state.js +29 -15
  59. package/dist/internal/input-stream.d.ts +3 -1
  60. package/dist/internal/input-stream.js +16 -7
  61. package/dist/internal/numeric-properties.js +2 -1
  62. package/dist/internal/render-states.js +2 -1
  63. package/dist/internal/scalar.js +22 -13
  64. package/dist/internal/shaped-glyph.d.ts +3 -1
  65. package/dist/internal/shaped-glyph.js +12 -4
  66. package/dist/internal/struct-view.d.ts +3 -1
  67. package/dist/internal/struct-view.js +3 -1
  68. package/dist/internal/transformable.js +2 -1
  69. package/dist/network/common.js +23 -11
  70. package/dist/network/dns.js +25 -17
  71. package/dist/network/ftp.js +43 -18
  72. package/dist/network/http.js +126 -56
  73. package/dist/network/ip-address.js +50 -25
  74. package/dist/network/packet.js +63 -25
  75. package/dist/network/sftp.js +175 -74
  76. package/dist/network/socket-selector.js +28 -14
  77. package/dist/network/socket.js +71 -30
  78. package/dist/network/tcp-listener.js +42 -19
  79. package/dist/network/tcp-socket.js +111 -53
  80. package/dist/network/tls-material.js +2 -1
  81. package/dist/network/udp-socket.js +68 -33
  82. package/dist/system/angle.js +2 -1
  83. package/dist/system/clock.js +4 -2
  84. package/dist/system/err.js +5 -2
  85. package/dist/system/file-input-stream.js +8 -4
  86. package/dist/system/input-stream.js +6 -3
  87. package/dist/system/operators.d.ts +1 -1
  88. package/dist/system/operators.js +90 -50
  89. package/dist/system/sleep.js +4 -2
  90. package/dist/system/time.js +12 -6
  91. package/dist/system/vector2.js +6 -7
  92. package/dist/system/vector3.js +11 -6
  93. package/dist/window/clipboard.js +2 -1
  94. package/dist/window/context.js +10 -5
  95. package/dist/window/cursor.js +2 -1
  96. package/dist/window/event.js +9 -5
  97. package/dist/window/mouse.js +4 -2
  98. package/dist/window/video-mode.js +2 -1
  99. package/dist/window/window.js +19 -12
  100. package/native/addon.cc +25 -12
  101. package/native/audio-binding.cc +266 -126
  102. package/native/audio-codec-binding.cc +147 -77
  103. package/native/audio-device-binding.cc +76 -49
  104. package/native/audio-file-binding.cc +116 -67
  105. package/native/audio-recorder-binding.cc +147 -98
  106. package/native/audio-recorder.h +1 -1
  107. package/native/audio-state.h +53 -30
  108. package/native/audio-stream-binding.cc +148 -94
  109. package/native/audio-stream.h +5 -4
  110. package/native/audio-worker-binding.cc +163 -81
  111. package/native/audio-worker.h +35 -19
  112. package/native/batch-drawable.cc +29 -16
  113. package/native/batch-drawable.h +11 -8
  114. package/native/context-binding.cc +40 -27
  115. package/native/context-settings.h +15 -8
  116. package/native/deferred-delete.cc +9 -6
  117. package/native/deferred-delete.h +7 -8
  118. package/native/error-stream-binding.cc +42 -28
  119. package/native/font-binding.cc +89 -48
  120. package/native/graphics-binding.cc +122 -72
  121. package/native/graphics-state.h +50 -36
  122. package/native/image-binding.cc +38 -24
  123. package/native/image-state.h +26 -18
  124. package/native/input-binding.cc +42 -27
  125. package/native/render-window-binding.cc +38 -23
  126. package/native/shader-binding.cc +115 -50
  127. package/native/shape-binding.cc +94 -49
  128. package/native/shape-state.h +18 -9
  129. package/native/shaped-glyph-storage.h +9 -5
  130. package/native/stream-binding.cc +143 -117
  131. package/native/system-binding.cc +17 -12
  132. package/native/text-binding.cc +68 -35
  133. package/native/text-state.h +25 -18
  134. package/native/texture-binding.cc +42 -33
  135. package/native/texture-resource.h +20 -12
  136. package/native/time-value.h +3 -1
  137. package/native/transformable-binding.cc +12 -6
  138. package/native/transformable-state.h +6 -6
  139. package/native/value-binding.h +46 -28
  140. package/native/value-layout.h +10 -10
  141. package/native/values-binding.cc +29 -23
  142. package/native/vertex-binding.cc +18 -12
  143. package/native/vertex-buffer-binding.cc +38 -24
  144. package/native/vertex-storage.h +2 -2
  145. package/native/view-data.h +4 -3
  146. package/native/window-binding.cc +75 -45
  147. package/native/window-event.h +20 -11
  148. package/native/window-owner.h +15 -12
  149. package/package.json +40 -48
  150. package/src/audio/effect-processor.ts +9 -3
  151. package/src/audio/input-sound-file.ts +108 -36
  152. package/src/audio/listener.ts +39 -13
  153. package/src/audio/music.ts +112 -47
  154. package/src/audio/output-sound-file.ts +40 -11
  155. package/src/audio/playback-device.ts +23 -8
  156. package/src/audio/sound-buffer-recorder.ts +35 -13
  157. package/src/audio/sound-buffer.ts +166 -58
  158. package/src/audio/sound-file-factory.ts +127 -49
  159. package/src/audio/sound-file-reader.ts +49 -15
  160. package/src/audio/sound-recorder.ts +100 -34
  161. package/src/audio/sound-source.ts +142 -45
  162. package/src/audio/sound-stream.ts +15 -5
  163. package/src/audio/sound.ts +12 -4
  164. package/src/audio/value.ts +89 -26
  165. package/src/graphics/blend-mode.ts +3 -1
  166. package/src/graphics/boolean-vector.ts +56 -26
  167. package/src/graphics/color.ts +3 -1
  168. package/src/graphics/convex-shape.ts +10 -3
  169. package/src/graphics/font.ts +171 -50
  170. package/src/graphics/glsl-matrix.ts +9 -3
  171. package/src/graphics/glsl.ts +81 -35
  172. package/src/graphics/glyph.ts +67 -26
  173. package/src/graphics/image.ts +119 -45
  174. package/src/graphics/rect.ts +56 -24
  175. package/src/graphics/render-states.ts +31 -14
  176. package/src/graphics/render-target.ts +197 -81
  177. package/src/graphics/render-texture.ts +36 -12
  178. package/src/graphics/render-window.ts +9 -3
  179. package/src/graphics/shader.ts +186 -61
  180. package/src/graphics/shape.ts +93 -35
  181. package/src/graphics/sprite.ts +64 -25
  182. package/src/graphics/stencil-mode.ts +12 -6
  183. package/src/graphics/swap.ts +3 -2
  184. package/src/graphics/text.ts +229 -74
  185. package/src/graphics/texture.ts +180 -61
  186. package/src/graphics/transform.ts +132 -47
  187. package/src/graphics/transformable.ts +3 -1
  188. package/src/graphics/vertex-array.ts +87 -35
  189. package/src/graphics/vertex-buffer.ts +97 -33
  190. package/src/graphics/vertex.ts +9 -3
  191. package/src/graphics/view.ts +59 -21
  192. package/src/index.ts +101 -23
  193. package/src/internal/audio-codec-registry.ts +18 -6
  194. package/src/internal/audio-input-stream.ts +6 -2
  195. package/src/internal/audio-music-pump.ts +116 -41
  196. package/src/internal/audio-native.ts +249 -96
  197. package/src/internal/audio-recorder-session.ts +68 -24
  198. package/src/internal/audio-worker-session.ts +65 -21
  199. package/src/internal/audio-worker.ts +85 -41
  200. package/src/internal/glsl-value.ts +26 -11
  201. package/src/internal/graphics-state.ts +57 -20
  202. package/src/internal/input-stream.ts +23 -10
  203. package/src/internal/native.ts +252 -99
  204. package/src/internal/numeric-properties.ts +2 -1
  205. package/src/internal/render-states.ts +3 -1
  206. package/src/internal/scalar.ts +33 -14
  207. package/src/internal/shaped-glyph.ts +25 -12
  208. package/src/internal/struct-view.ts +40 -13
  209. package/src/internal/transformable.ts +3 -1
  210. package/src/network/common.ts +35 -11
  211. package/src/network/dns.ts +95 -38
  212. package/src/network/ftp.ts +129 -47
  213. package/src/network/http.ts +232 -77
  214. package/src/network/ip-address.ts +118 -48
  215. package/src/network/packet.ts +161 -54
  216. package/src/network/sftp.ts +498 -168
  217. package/src/network/socket-selector.ts +66 -26
  218. package/src/network/socket.ts +133 -46
  219. package/src/network/tcp-listener.ts +78 -29
  220. package/src/network/tcp-socket.ts +240 -95
  221. package/src/network/tls-material.ts +6 -2
  222. package/src/network/udp-socket.ts +147 -53
  223. package/src/system/angle.ts +3 -1
  224. package/src/system/clock.ts +12 -4
  225. package/src/system/err.ts +5 -2
  226. package/src/system/file-input-stream.ts +12 -4
  227. package/src/system/input-stream.ts +9 -3
  228. package/src/system/operators.ts +290 -115
  229. package/src/system/sleep.ts +6 -2
  230. package/src/system/time.ts +18 -6
  231. package/src/system/timeout-with-predicate.ts +19 -8
  232. package/src/system/vector2.ts +101 -49
  233. package/src/system/vector3.ts +85 -36
  234. package/src/window/clipboard.ts +3 -1
  235. package/src/window/context.ts +15 -5
  236. package/src/window/cursor.ts +3 -1
  237. package/src/window/event.ts +26 -12
  238. package/src/window/mouse.ts +6 -2
  239. package/src/window/video-mode.ts +3 -1
  240. package/src/window/window.ts +119 -37
  241. package/test/native/audio-probes.cc +74 -36
  242. package/test/native/deferred-delete-probes.cc +17 -11
  243. package/test/native/drawable-probes.cc +70 -36
  244. package/test/native/exception-probes.cc +14 -9
  245. package/test/native/image-probes.cc +20 -10
  246. package/test/native/matrix-probes.cc +8 -4
  247. package/test/native/network-oracle.cc +17 -11
  248. package/test/native/render-texture-probes.cc +33 -24
  249. package/test/native/shader-probes.cc +9 -9
  250. package/test/native/shape-probes.cc +37 -23
  251. package/test/native/sprite-probes.cc +41 -25
  252. package/test/native/system-probes.cc +58 -35
  253. package/test/native/text-probes.cc +77 -44
  254. package/test/native/texture-probes.cc +43 -26
  255. package/test/native/time-probes.cc +18 -12
  256. package/test/native/transform-probes.cc +15 -10
  257. package/test/native/transformable-probes.cc +23 -17
  258. package/test/native/value-oracle.h +9 -4
  259. package/test/native/value-probes.cc +31 -23
  260. package/test/native/vertex-array-probes.cc +22 -14
  261. package/test/native/vertex-buffer-probes.cc +28 -17
  262. package/test/native/view-probes.cc +29 -17
  263. package/test/native/window-probes.cc +66 -33
  264. package/tools/ensure-sfml.cjs +9 -0
  265. package/tools/generate-network-constants.cjs +11 -6
  266. package/tools/generate-window-constants.cjs +31 -12
  267. package/docs/README.ja.md +0 -30
  268. package/docs/README.ko.md +0 -30
  269. package/docs/README.md +0 -30
  270. package/docs/README.zh-CN.md +0 -30
  271. package/docs/api.ja.md +0 -84
  272. package/docs/api.ko.md +0 -84
  273. package/docs/api.md +0 -81
  274. package/docs/api.zh-CN.md +0 -81
  275. package/docs/audio.ja.md +0 -249
  276. package/docs/audio.ko.md +0 -251
  277. package/docs/audio.md +0 -252
  278. package/docs/audio.zh-CN.md +0 -252
  279. package/docs/concepts.ja.md +0 -130
  280. package/docs/concepts.ko.md +0 -130
  281. package/docs/concepts.md +0 -131
  282. package/docs/concepts.zh-CN.md +0 -131
  283. package/docs/development.ja.md +0 -144
  284. package/docs/development.ko.md +0 -144
  285. package/docs/development.md +0 -146
  286. package/docs/development.zh-CN.md +0 -146
  287. package/docs/getting-started.ja.md +0 -154
  288. package/docs/getting-started.ko.md +0 -154
  289. package/docs/getting-started.md +0 -156
  290. package/docs/getting-started.zh-CN.md +0 -156
  291. package/docs/graphics.ja.md +0 -256
  292. package/docs/graphics.ko.md +0 -254
  293. package/docs/graphics.md +0 -255
  294. package/docs/graphics.zh-CN.md +0 -257
  295. package/docs/network.ja.md +0 -214
  296. package/docs/network.ko.md +0 -216
  297. package/docs/network.md +0 -218
  298. package/docs/network.zh-CN.md +0 -218
  299. package/docs/system.ja.md +0 -169
  300. package/docs/system.ko.md +0 -171
  301. package/docs/system.md +0 -173
  302. package/docs/system.zh-CN.md +0 -173
  303. package/docs/window.ja.md +0 -138
  304. package/docs/window.ko.md +0 -140
  305. package/docs/window.md +0 -141
  306. package/docs/window.zh-CN.md +0 -141
  307. package/native/exception-boundary.h +0 -97
  308. package/native/numeric-fields.h +0 -96
  309. package/native/shared-handle.h +0 -107
  310. package/test/tsconfig.json +0 -8
  311. package/tools/configure-lsp.cjs +0 -23
  312. package/tools/lib_downloader.cjs +0 -92
  313. package/tools/lib_downloader_urls.cjs +0 -23
@@ -1,13 +1,14 @@
1
- #include "audio-worker.h"
1
+ #include <ostream>
2
+
2
3
  #include "audio-stream.h"
4
+ #include "audio-worker.h"
3
5
  #include "time-value.h"
4
6
  #include <SFML/System/Err.hpp>
5
- #include <ostream>
6
7
 
7
8
  namespace sfmljs {
8
9
  SFMLJS_MEMBER(BufferRate, sf::SoundBuffer, unsigned, m_sampleRate);
9
10
  SFMLJS_MEMBER(BufferDuration, sf::SoundBuffer, sf::Time, m_duration);
10
- }
11
+ } // namespace sfmljs
11
12
 
12
13
  namespace sfmljs::audio {
13
14
 
@@ -20,7 +21,8 @@ void Source::CloseBeforeThreadExit() {
20
21
  if (sound) sound->stop();
21
22
  }
22
23
 
23
- void CopySourceSettings(sf::SoundSource& to, const sf::SoundSource& from) {
24
+ void CopySourceSettings(sf::SoundSource& to, // NOLINT(runtime/references)
25
+ const sf::SoundSource& from) {
24
26
  to.setPitch(from.getPitch());
25
27
  to.setPan(from.getPan());
26
28
  to.setVolume(from.getVolume());
@@ -43,26 +45,34 @@ void InstallSourceEffect(const std::shared_ptr<Source>& source) {
43
45
  if (!source->effect) return;
44
46
  auto state = source->effect;
45
47
  state->Seek(0);
46
- source->sound->setEffectProcessor(
47
- [state](const float* in, unsigned& inFrames, float* out,
48
- unsigned& outFrames, unsigned channels) {
49
- state->Effect(in, inFrames, out, outFrames, channels);
50
- });
48
+ source->sound->setEffectProcessor([state](const float* in,
49
+ unsigned& inFrames,
50
+ float* out,
51
+ unsigned& outFrames,
52
+ unsigned channels) {
53
+ state->Effect(in, inFrames, out, outFrames, channels);
54
+ });
51
55
  }
52
56
 
53
57
  v8::Local<v8::Object> MapBuffer(const std::shared_ptr<BufferData>& data) {
54
58
  data->Update();
55
59
  auto result = Nan::New<v8::Object>();
56
- Set(result, "info", NumericFields()
57
- .Add("sampleCount", data->count)
58
- .Add("channelCount", data->channels)
59
- .Add("sampleRate", Field<BufferRate>(data->buffer))
60
- .Add("duration", Field<BufferDuration>(data->buffer), "i64").Map(data));
61
- Set(result, "samples", data->count == 0
62
- ? v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 0)
63
- : MapShared(v8::Isolate::GetCurrent(), data,
64
- const_cast<std::int16_t*>(data->buffer.getSamples()),
65
- data->count * sizeof(std::int16_t)));
60
+ Set(result,
61
+ "info",
62
+ NumericFields()
63
+ .Add("sampleCount", data->count)
64
+ .Add("channelCount", data->channels)
65
+ .Add("sampleRate", Field<BufferRate>(data->buffer))
66
+ .Add("duration", Field<BufferDuration>(data->buffer), "i64")
67
+ .Map(data));
68
+ Set(result,
69
+ "samples",
70
+ data->count == 0
71
+ ? v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 0)
72
+ : MapShared(v8::Isolate::GetCurrent(),
73
+ data,
74
+ const_cast<std::int16_t*>(data->buffer.getSamples()),
75
+ data->count * sizeof(std::int16_t)));
66
76
  Set(result, "channelMap", MapChannels(data, data->buffer.getChannelMap()));
67
77
  return result;
68
78
  }
@@ -88,10 +98,14 @@ NAN_METHOD(CreateAudioBuffer) {
88
98
  unsigned rate, count;
89
99
  std::vector<sf::SoundChannel> channels;
90
100
  if (!ReadBytes(info[0], samples, true) || !Unsigned(info[1], rate) ||
91
- !Unsigned(info[2], count) || !Channels(info[3], channels)) return;
101
+ !Unsigned(info[2], count) || !Channels(info[3], channels))
102
+ return;
92
103
  if (!buffer->current->buffer.loadFromSamples(
93
- static_cast<std::int16_t*>(samples.data), samples.size / 2,
94
- count, rate, channels)) {
104
+ static_cast<std::int16_t*>(samples.data),
105
+ samples.size / 2,
106
+ count,
107
+ rate,
108
+ channels)) {
95
109
  return sfmljs::ThrowError("Failed to load sound buffer from samples");
96
110
  }
97
111
  } else if (!info[0]->IsUndefined()) {
@@ -131,18 +145,22 @@ NAN_METHOD(LoadAudioBuffer) {
131
145
  if (!String(info[0], path)) return;
132
146
  } else if (auto* handle = StreamClientHandle::TryFrom(info[0])) {
133
147
  stream = handle->owner();
134
- } else if (!ReadBytes(info[0], bytes)) return;
148
+ } else if (!ReadBytes(info[0], bytes)) {
149
+ return;
150
+ }
135
151
  auto work = [data, ok, path, bytes, stream] {
136
- *ok = stream ? data->buffer.loadFromStream(*stream) : bytes.backing
137
- ? data->buffer.loadFromMemory(bytes.data, bytes.size)
138
- : data->buffer.loadFromFile(Path(path));
152
+ *ok = stream ? data->buffer.loadFromStream(*stream)
153
+ : bytes.backing ? data->buffer.loadFromMemory(bytes.data, bytes.size)
154
+ : data->buffer.loadFromFile(Path(path));
139
155
  };
140
156
  auto result = [data, ok]() -> v8::Local<v8::Value> {
141
157
  return *ok ? v8::Local<v8::Value>(BufferDataHandle::Create(data))
142
158
  : v8::Local<v8::Value>(Nan::Undefined());
143
159
  };
144
- if (stream) QueueThread(info[1], work, result, [stream] { stream->Cancel(); });
145
- else Queue(info[1], work, result);
160
+ if (stream)
161
+ QueueThread(info[1], work, result, [stream] { stream->Cancel(); });
162
+ else
163
+ Queue(info[1], work, result);
146
164
  }
147
165
 
148
166
  NAN_METHOD(AudioBufferSamples) {
@@ -150,10 +168,14 @@ NAN_METHOD(AudioBufferSamples) {
150
168
  unsigned rate, count;
151
169
  std::vector<sf::SoundChannel> channels;
152
170
  if (!ReadBytes(info[0], samples, true) || !Unsigned(info[1], rate) ||
153
- !Unsigned(info[2], count) || !Channels(info[3], channels)) return;
171
+ !Unsigned(info[2], count) || !Channels(info[3], channels))
172
+ return;
154
173
  auto data = MakeThreadOwned<BufferData>();
155
174
  if (data->buffer.loadFromSamples(static_cast<std::int16_t*>(samples.data),
156
- samples.size / 2, count, rate, channels)) {
175
+ samples.size / 2,
176
+ count,
177
+ rate,
178
+ channels)) {
157
179
  info.GetReturnValue().Set(BufferDataHandle::Create(data));
158
180
  }
159
181
  }
@@ -172,7 +194,9 @@ NAN_METHOD(SaveAudioBuffer) {
172
194
  if (!buffer || !String(info[1], path)) return;
173
195
  auto data = buffer->owner()->current;
174
196
  auto ok = std::make_shared<bool>();
175
- Queue(info[2], [data, ok, path] { *ok = data->buffer.saveToFile(Path(path)); },
197
+ Queue(
198
+ info[2],
199
+ [data, ok, path] { *ok = data->buffer.saveToFile(Path(path)); },
176
200
  [ok]() -> v8::Local<v8::Value> { return Nan::New(*ok); });
177
201
  }
178
202
 
@@ -221,7 +245,8 @@ NAN_METHOD(AssignAudioSource) {
221
245
  auto* targetHandle = SourceHandle::From(info[0]);
222
246
  auto* sourceHandle = SourceHandle::From(info[1]);
223
247
  if (!targetHandle || !sourceHandle) return;
224
- if (!info[2]->IsBoolean()) return Nan::ThrowTypeError("Expected a Sound assignment flag");
248
+ if (!info[2]->IsBoolean())
249
+ return Nan::ThrowTypeError("Expected a Sound assignment flag");
225
250
  auto target = targetHandle->owner();
226
251
  auto source = sourceHandle->owner();
227
252
  const bool fullSound = info[2]->IsTrue();
@@ -258,44 +283,78 @@ NAN_METHOD(AudioSourceField) {
258
283
  auto* handle = SourceHandle::From(info[0]);
259
284
  unsigned field;
260
285
  if (!handle || !Unsigned(info[1], field)) return;
261
- if (!info[2]->IsBoolean()) return Nan::ThrowTypeError("Expected a write flag");
286
+ if (!info[2]->IsBoolean())
287
+ return Nan::ThrowTypeError("Expected a write flag");
262
288
  const bool write = info[2]->IsTrue();
263
289
  auto& source = *handle->owner();
264
290
  auto& sound = *source.sound;
265
291
  auto& f = source.values;
266
- auto vector = [&](unsigned i) { return sf::Vector3f{f[i], f[i+1], f[i+2]}; };
267
- auto store = [&](unsigned i, sf::Vector3f v) { f[i]=v.x; f[i+1]=v.y; f[i+2]=v.z; };
268
- #define SFMLJS_AUDIO_SCALAR(Id, Set, Get) \
269
- case Id: if (write) sound.Set(f[Id]); else f[Id] = sound.Get(); break
292
+ auto vector = [&](unsigned i) {
293
+ return sf::Vector3f{f[i], f[i + 1], f[i + 2]};
294
+ };
295
+ auto store = [&](unsigned i, sf::Vector3f v) {
296
+ f[i] = v.x;
297
+ f[i + 1] = v.y;
298
+ f[i + 2] = v.z;
299
+ };
300
+ #define SFMLJS_AUDIO_SCALAR(Id, Set, Get) \
301
+ case Id: \
302
+ if (write) \
303
+ sound.Set(f[Id]); \
304
+ else \
305
+ f[Id] = sound.Get(); \
306
+ break
270
307
  switch (field) {
271
308
  SFMLJS_AUDIO_SCALAR(0, setPitch, getPitch);
272
309
  SFMLJS_AUDIO_SCALAR(1, setPan, getPan);
273
310
  SFMLJS_AUDIO_SCALAR(2, setVolume, getVolume);
274
311
  SFMLJS_AUDIO_SCALAR(3, setSpatializationEnabled, isSpatializationEnabled);
275
- case 4: if (write) sound.setPosition(vector(4)); else store(4, sound.getPosition()); break;
276
- case 7: if (write) sound.setDirection(vector(7)); else store(7, sound.getDirection()); break;
312
+ case 4:
313
+ if (write)
314
+ sound.setPosition(vector(4));
315
+ else
316
+ store(4, sound.getPosition());
317
+ break;
318
+ case 7:
319
+ if (write)
320
+ sound.setDirection(vector(7));
321
+ else
322
+ store(7, sound.getDirection());
323
+ break;
277
324
  case 10:
278
- if (write) sound.setCone({sf::radians(f[10]), sf::radians(f[11]), f[12]});
279
- else {
325
+ if (write) {
326
+ sound.setCone({sf::radians(f[10]), sf::radians(f[11]), f[12]});
327
+ } else {
280
328
  const auto cone = sound.getCone();
281
- f[10]=cone.innerAngle.asRadians(); f[11]=cone.outerAngle.asRadians(); f[12]=cone.outerGain;
329
+ f[10] = cone.innerAngle.asRadians();
330
+ f[11] = cone.outerAngle.asRadians();
331
+ f[12] = cone.outerGain;
282
332
  }
283
333
  break;
284
- case 13: if (write) sound.setVelocity(vector(13)); else store(13, sound.getVelocity()); break;
285
- SFMLJS_AUDIO_SCALAR(16, setDopplerFactor, getDopplerFactor);
286
- SFMLJS_AUDIO_SCALAR(17, setDirectionalAttenuationFactor, getDirectionalAttenuationFactor);
287
- SFMLJS_AUDIO_SCALAR(18, setRelativeToListener, isRelativeToListener);
288
- SFMLJS_AUDIO_SCALAR(19, setMinDistance, getMinDistance);
289
- SFMLJS_AUDIO_SCALAR(20, setMaxDistance, getMaxDistance);
290
- SFMLJS_AUDIO_SCALAR(21, setMinGain, getMinGain);
291
- SFMLJS_AUDIO_SCALAR(22, setMaxGain, getMaxGain);
292
- SFMLJS_AUDIO_SCALAR(23, setAttenuation, getAttenuation);
334
+ case 13:
335
+ if (write)
336
+ sound.setVelocity(vector(13));
337
+ else
338
+ store(13, sound.getVelocity());
339
+ break;
340
+ SFMLJS_AUDIO_SCALAR(16, setDopplerFactor, getDopplerFactor);
341
+ SFMLJS_AUDIO_SCALAR(
342
+ 17, setDirectionalAttenuationFactor, getDirectionalAttenuationFactor);
343
+ SFMLJS_AUDIO_SCALAR(18, setRelativeToListener, isRelativeToListener);
344
+ SFMLJS_AUDIO_SCALAR(19, setMinDistance, getMinDistance);
345
+ SFMLJS_AUDIO_SCALAR(20, setMaxDistance, getMaxDistance);
346
+ SFMLJS_AUDIO_SCALAR(21, setMinGain, getMinGain);
347
+ SFMLJS_AUDIO_SCALAR(22, setMaxGain, getMaxGain);
348
+ SFMLJS_AUDIO_SCALAR(23, setAttenuation, getAttenuation);
293
349
  case 24:
294
350
  if (write && source.stream) {
295
351
  source.stream->looping.store(f[24] != 0, std::memory_order_release);
296
352
  }
297
353
  if (auto* value = source.AsSound()) {
298
- if (write) value->setLooping(f[24] != 0); else f[24] = value->isLooping();
354
+ if (write)
355
+ value->setLooping(f[24] != 0);
356
+ else
357
+ f[24] = value->isLooping();
299
358
  } else if (auto* value = source.AsStream()) {
300
359
  if (write) {
301
360
  const bool changed = value->isLooping() != (f[24] != 0);
@@ -305,7 +364,9 @@ NAN_METHOD(AudioSourceField) {
305
364
  if (changed && source.kind == 3) {
306
365
  value->setPlayingOffset(value->getPlayingOffset());
307
366
  }
308
- } else f[24] = value->isLooping();
367
+ } else {
368
+ f[24] = value->isLooping();
369
+ }
309
370
  }
310
371
  break;
311
372
  case 25:
@@ -316,10 +377,12 @@ NAN_METHOD(AudioSourceField) {
316
377
  case 27:
317
378
  if (write) return Nan::ThrowTypeError("Stream metadata is read-only");
318
379
  if (auto* stream = source.AsStream()) {
319
- f[26] = stream->getSampleRate(); f[27] = stream->getChannelCount();
380
+ f[26] = stream->getSampleRate();
381
+ f[27] = stream->getChannelCount();
320
382
  }
321
383
  break;
322
- default: return Nan::ThrowRangeError("Unknown audio field");
384
+ default:
385
+ return Nan::ThrowRangeError("Unknown audio field");
323
386
  }
324
387
  #undef SFMLJS_AUDIO_SCALAR
325
388
  }
@@ -330,22 +393,34 @@ NAN_METHOD(AudioSourceCommand) {
330
393
  if (!handle || !Unsigned(info[1], command)) return;
331
394
  auto& source = *handle->owner();
332
395
  auto& sound = *source.sound;
333
- if (source.effect && (command == 2 || command == 3 ||
334
- (command == 0 && sound.getStatus() != sf::SoundSource::Status::Paused))) {
396
+ if (source.effect &&
397
+ (command == 2 || command == 3 ||
398
+ (command == 0 &&
399
+ sound.getStatus() != sf::SoundSource::Status::Paused))) {
335
400
  source.effect->Seek(0);
336
401
  }
337
402
  switch (command) {
338
- case 0: sound.play(); break;
339
- case 1: sound.pause(); break;
340
- case 2: sound.stop(); break;
403
+ case 0:
404
+ sound.play();
405
+ break;
406
+ case 1:
407
+ sound.pause();
408
+ break;
409
+ case 2:
410
+ sound.stop();
411
+ break;
341
412
  case 3:
342
413
  case 4:
343
414
  if (auto* value = source.AsSound()) {
344
- if (command == 3) value->setPlayingOffset(sf::microseconds(source.times[0]));
345
- else source.times[0] = value->getPlayingOffset().asMicroseconds();
415
+ if (command == 3)
416
+ value->setPlayingOffset(sf::microseconds(source.times[0]));
417
+ else
418
+ source.times[0] = value->getPlayingOffset().asMicroseconds();
346
419
  } else if (auto* value = source.AsStream()) {
347
- if (command == 3) value->setPlayingOffset(sf::microseconds(source.times[0]));
348
- else source.times[0] = value->getPlayingOffset().asMicroseconds();
420
+ if (command == 3)
421
+ value->setPlayingOffset(sf::microseconds(source.times[0]));
422
+ else
423
+ source.times[0] = value->getPlayingOffset().asMicroseconds();
349
424
  }
350
425
  break;
351
426
  case 5:
@@ -355,10 +430,14 @@ NAN_METHOD(AudioSourceCommand) {
355
430
  auto& state = *source.stream;
356
431
  auto* stream = source.AsStream();
357
432
  auto toSamples = [&](std::int64_t time) {
358
- return (static_cast<std::uint64_t>(time) * state.rate * state.channels + 500000) / 1000000;
433
+ return (static_cast<std::uint64_t>(time) * state.rate *
434
+ state.channels +
435
+ 500000) /
436
+ 1000000;
359
437
  };
360
438
  auto toTime = [&](std::uint64_t samples) {
361
- return static_cast<std::int64_t>(samples * 1000000 / (state.channels * state.rate));
439
+ return static_cast<std::int64_t>(samples * 1000000 /
440
+ (state.channels * state.rate));
362
441
  };
363
442
  if (command == 5) {
364
443
  auto offset = toSamples(source.times[2]);
@@ -368,7 +447,8 @@ NAN_METHOD(AudioSourceCommand) {
368
447
  length += state.channels - 1;
369
448
  length -= length % state.channels;
370
449
  if (!state.sampleCount || offset >= state.sampleCount || !length) {
371
- sf::err() << "Music loop points are outside the valid sample range.\n";
450
+ sf::err()
451
+ << "Music loop points are outside the valid sample range.\n";
372
452
  } else {
373
453
  length = std::min(length, state.sampleCount - offset);
374
454
  if (offset != state.loopOffset || length != state.loopLength) {
@@ -377,28 +457,33 @@ NAN_METHOD(AudioSourceCommand) {
377
457
  stream->stop();
378
458
  state.loopOffset = offset;
379
459
  state.loopLength = length;
380
- if (position != sf::Time::Zero) stream->setPlayingOffset(position);
460
+ if (position != sf::Time::Zero)
461
+ stream->setPlayingOffset(position);
381
462
  if (status == sf::SoundSource::Status::Playing) stream->play();
382
463
  }
383
464
  }
384
465
  }
385
466
  source.times[1] = sf::seconds(static_cast<float>(state.sampleCount) /
386
- static_cast<float>(state.channels) / static_cast<float>(state.rate)).asMicroseconds();
467
+ static_cast<float>(state.channels) /
468
+ static_cast<float>(state.rate))
469
+ .asMicroseconds();
387
470
  source.times[2] = toTime(state.loopOffset);
388
471
  source.times[3] = toTime(state.loopLength);
389
472
  break;
390
473
  }
391
474
  auto* music = source.AsMusic();
392
475
  if (!music) return Nan::ThrowTypeError("Expected a Music");
393
- if (command == 5) music->setLoopPoints({sf::microseconds(source.times[2]),
394
- sf::microseconds(source.times[3])});
476
+ if (command == 5)
477
+ music->setLoopPoints({sf::microseconds(source.times[2]),
478
+ sf::microseconds(source.times[3])});
395
479
  const auto span = music->getLoopPoints();
396
480
  source.times[1] = music->getDuration().asMicroseconds();
397
481
  source.times[2] = span.offset.asMicroseconds();
398
482
  source.times[3] = span.length.asMicroseconds();
399
483
  break;
400
484
  }
401
- default: return Nan::ThrowRangeError("Unknown audio command");
485
+ default:
486
+ return Nan::ThrowRangeError("Unknown audio command");
402
487
  }
403
488
  }
404
489
 
@@ -414,26 +499,31 @@ NAN_METHOD(OpenAudioMusic) {
414
499
  std::string path;
415
500
  if (info[1]->IsString()) {
416
501
  if (!String(info[1], path)) return;
417
- } else if (!ReadBytes(info[1], next->encoded)) return;
502
+ } else if (!ReadBytes(info[1], next->encoded)) {
503
+ return;
504
+ }
418
505
  auto ok = std::make_shared<bool>();
419
- Queue(info[2], [next, path, ok] {
420
- auto& music = static_cast<sf::Music&>(*next->sound);
421
- *ok = next->encoded.backing
422
- ? music.openFromMemory(next->encoded.data, next->encoded.size)
423
- : music.openFromFile(Path(path));
424
- }, [source, next, ok]() -> v8::Local<v8::Value> {
425
- if (*ok) {
426
- CopySourceSettings(*next->sound, *source->sound);
427
- next->AsMusic()->setLooping(source->AsStream()->isLooping());
428
- source->sound->stop();
429
- source->sound.swap(next->sound);
430
- std::swap(source->encoded, next->encoded);
431
- source->kind = 1;
432
- source->stream.reset();
433
- InstallSourceEffect(source);
434
- }
435
- return Nan::New(*ok);
436
- });
506
+ Queue(
507
+ info[2],
508
+ [next, path, ok] {
509
+ auto& music = static_cast<sf::Music&>(*next->sound);
510
+ *ok = next->encoded.backing
511
+ ? music.openFromMemory(next->encoded.data, next->encoded.size)
512
+ : music.openFromFile(Path(path));
513
+ },
514
+ [source, next, ok]() -> v8::Local<v8::Value> {
515
+ if (*ok) {
516
+ CopySourceSettings(*next->sound, *source->sound);
517
+ next->AsMusic()->setLooping(source->AsStream()->isLooping());
518
+ source->sound->stop();
519
+ source->sound.swap(next->sound);
520
+ std::swap(source->encoded, next->encoded);
521
+ source->kind = 1;
522
+ source->stream.reset();
523
+ InstallSourceEffect(source);
524
+ }
525
+ return Nan::New(*ok);
526
+ });
437
527
  }
438
528
 
439
529
  NAN_METHOD(CloseAudioMusic) {
@@ -462,7 +552,8 @@ NAN_METHOD(AudioSourceChannels) {
462
552
  if (!stream) return Nan::ThrowTypeError("Expected a SoundStream");
463
553
  // Channels may be replaced by initialize/open. Each returned view owns a
464
554
  // snapshot so old views cannot dangle while a stream is reopened.
465
- auto channels = std::make_shared<std::vector<sf::SoundChannel>>(stream->getChannelMap());
555
+ auto channels =
556
+ std::make_shared<std::vector<sf::SoundChannel>>(stream->getChannelMap());
466
557
  info.GetReturnValue().Set(MapChannels(channels, *channels));
467
558
  }
468
559
 
@@ -471,7 +562,9 @@ NAN_METHOD(CreateAudioListener) {
471
562
  auto data = std::make_shared<ListenerData>();
472
563
  auto result = Nan::New<v8::Object>();
473
564
  Set(result, "handle", SharedHandle<ListenerData>::Create(data));
474
- Set(result, "buffer", MapShared(info.GetIsolate(), data, data->data(), sizeof(*data)));
565
+ Set(result,
566
+ "buffer",
567
+ MapShared(info.GetIsolate(), data, data->data(), sizeof(*data)));
475
568
  info.GetReturnValue().Set(result);
476
569
  }
477
570
 
@@ -481,11 +574,13 @@ NAN_METHOD(CreateAudioValue) {
481
574
  if (kind == 0) {
482
575
  static_assert(sizeof(sf::SoundSource::Cone) == 12);
483
576
  auto value = std::make_shared<sf::SoundSource::Cone>();
484
- info.GetReturnValue().Set(MapShared(info.GetIsolate(), value, value.get(), sizeof(*value)));
577
+ info.GetReturnValue().Set(
578
+ MapShared(info.GetIsolate(), value, value.get(), sizeof(*value)));
485
579
  } else if (kind == 1) {
486
580
  static_assert(sizeof(sf::Music::TimeSpan) == 16);
487
581
  auto value = std::make_shared<sf::Music::TimeSpan>();
488
- info.GetReturnValue().Set(MapShared(info.GetIsolate(), value, value.get(), sizeof(*value)));
582
+ info.GetReturnValue().Set(
583
+ MapShared(info.GetIsolate(), value, value.get(), sizeof(*value)));
489
584
  } else {
490
585
  return Nan::ThrowRangeError("Unknown audio value");
491
586
  }
@@ -495,49 +590,94 @@ NAN_METHOD(AudioListenerField) {
495
590
  auto* handle = SharedHandle<ListenerData>::From(info[0]);
496
591
  unsigned field;
497
592
  if (!handle || !Unsigned(info[1], field)) return;
498
- if (!info[2]->IsBoolean()) return Nan::ThrowTypeError("Expected a write flag");
593
+ if (!info[2]->IsBoolean())
594
+ return Nan::ThrowTypeError("Expected a write flag");
499
595
  const bool write = info[2]->IsTrue();
500
596
  auto& f = *handle->owner();
501
- auto vector = [&](unsigned i) { return sf::Vector3f{f[i], f[i+1], f[i+2]}; };
502
- auto store = [&](unsigned i, sf::Vector3f v) { f[i]=v.x; f[i+1]=v.y; f[i+2]=v.z; };
597
+ auto vector = [&](unsigned i) {
598
+ return sf::Vector3f{f[i], f[i + 1], f[i + 2]};
599
+ };
600
+ auto store = [&](unsigned i, sf::Vector3f v) {
601
+ f[i] = v.x;
602
+ f[i + 1] = v.y;
603
+ f[i + 2] = v.z;
604
+ };
503
605
  switch (field) {
504
606
  case 0:
505
- if (write) sf::Listener::setGlobalVolume(f[0]); else f[0] = sf::Listener::getGlobalVolume();
607
+ if (write)
608
+ sf::Listener::setGlobalVolume(f[0]);
609
+ else
610
+ f[0] = sf::Listener::getGlobalVolume();
611
+ break;
612
+ case 1:
613
+ if (write)
614
+ sf::Listener::setPosition(vector(1));
615
+ else
616
+ store(1, sf::Listener::getPosition());
617
+ break;
618
+ case 4:
619
+ if (write)
620
+ sf::Listener::setDirection(vector(4));
621
+ else
622
+ store(4, sf::Listener::getDirection());
623
+ break;
624
+ case 7:
625
+ if (write)
626
+ sf::Listener::setVelocity(vector(7));
627
+ else
628
+ store(7, sf::Listener::getVelocity());
629
+ break;
630
+ case 10:
631
+ if (write)
632
+ sf::Listener::setUpVector(vector(10));
633
+ else
634
+ store(10, sf::Listener::getUpVector());
506
635
  break;
507
- case 1: if (write) sf::Listener::setPosition(vector(1)); else store(1, sf::Listener::getPosition()); break;
508
- case 4: if (write) sf::Listener::setDirection(vector(4)); else store(4, sf::Listener::getDirection()); break;
509
- case 7: if (write) sf::Listener::setVelocity(vector(7)); else store(7, sf::Listener::getVelocity()); break;
510
- case 10: if (write) sf::Listener::setUpVector(vector(10)); else store(10, sf::Listener::getUpVector()); break;
511
636
  case 13:
512
- if (write) sf::Listener::setCone({sf::radians(f[13]), sf::radians(f[14]), f[15]});
513
- else {
637
+ if (write) {
638
+ sf::Listener::setCone({sf::radians(f[13]), sf::radians(f[14]), f[15]});
639
+ } else {
514
640
  const auto cone = sf::Listener::getCone();
515
- f[13]=cone.innerAngle.asRadians(); f[14]=cone.outerAngle.asRadians(); f[15]=cone.outerGain;
641
+ f[13] = cone.innerAngle.asRadians();
642
+ f[14] = cone.outerAngle.asRadians();
643
+ f[15] = cone.outerGain;
516
644
  }
517
645
  break;
518
- default: return Nan::ThrowRangeError("Unknown listener field");
646
+ default:
647
+ return Nan::ThrowRangeError("Unknown listener field");
519
648
  }
520
649
  }
521
650
 
522
- } // namespace sfmljs::audio
651
+ } // namespace sfmljs::audio
523
652
 
524
653
  NAN_MODULE_INIT(InitializeAudio) {
525
- using namespace sfmljs::audio;
526
- sfmljs::SetMethod<CreateAudioBuffer>(target, "createAudioBuffer");
527
- sfmljs::SetMethod<AssignAudioBuffer>(target, "assignAudioBuffer");
528
- sfmljs::SetMethod<LoadAudioBuffer>(target, "loadAudioBuffer");
529
- sfmljs::SetMethod<AudioBufferSamples>(target, "audioBufferSamples");
530
- sfmljs::SetMethod<CommitAudioBuffer>(target, "commitAudioBuffer");
531
- sfmljs::SetMethod<SaveAudioBuffer>(target, "saveAudioBuffer");
532
- sfmljs::SetMethod<CreateAudioSource>(target, "createAudioSource");
533
- sfmljs::SetMethod<SetAudioBuffer>(target, "setAudioBuffer");
534
- sfmljs::SetMethod<AssignAudioSource>(target, "assignAudioSource");
535
- sfmljs::SetMethod<AudioSourceField>(target, "audioSourceField");
536
- sfmljs::SetMethod<AudioSourceCommand>(target, "audioSourceCommand");
537
- sfmljs::SetMethod<OpenAudioMusic>(target, "openAudioMusic");
538
- sfmljs::SetMethod<CloseAudioMusic>(target, "closeAudioMusic");
539
- sfmljs::SetMethod<AudioSourceChannels>(target, "audioSourceChannels");
540
- sfmljs::SetMethod<CreateAudioListener>(target, "createAudioListener");
541
- sfmljs::SetMethod<CreateAudioValue>(target, "createAudioValue");
542
- sfmljs::SetMethod<AudioListenerField>(target, "audioListenerField");
654
+ sfmljs::SetMethod<sfmljs::audio::CreateAudioBuffer>(target,
655
+ "createAudioBuffer");
656
+ sfmljs::SetMethod<sfmljs::audio::AssignAudioBuffer>(target,
657
+ "assignAudioBuffer");
658
+ sfmljs::SetMethod<sfmljs::audio::LoadAudioBuffer>(target, "loadAudioBuffer");
659
+ sfmljs::SetMethod<sfmljs::audio::AudioBufferSamples>(target,
660
+ "audioBufferSamples");
661
+ sfmljs::SetMethod<sfmljs::audio::CommitAudioBuffer>(target,
662
+ "commitAudioBuffer");
663
+ sfmljs::SetMethod<sfmljs::audio::SaveAudioBuffer>(target, "saveAudioBuffer");
664
+ sfmljs::SetMethod<sfmljs::audio::CreateAudioSource>(target,
665
+ "createAudioSource");
666
+ sfmljs::SetMethod<sfmljs::audio::SetAudioBuffer>(target, "setAudioBuffer");
667
+ sfmljs::SetMethod<sfmljs::audio::AssignAudioSource>(target,
668
+ "assignAudioSource");
669
+ sfmljs::SetMethod<sfmljs::audio::AudioSourceField>(target,
670
+ "audioSourceField");
671
+ sfmljs::SetMethod<sfmljs::audio::AudioSourceCommand>(target,
672
+ "audioSourceCommand");
673
+ sfmljs::SetMethod<sfmljs::audio::OpenAudioMusic>(target, "openAudioMusic");
674
+ sfmljs::SetMethod<sfmljs::audio::CloseAudioMusic>(target, "closeAudioMusic");
675
+ sfmljs::SetMethod<sfmljs::audio::AudioSourceChannels>(target,
676
+ "audioSourceChannels");
677
+ sfmljs::SetMethod<sfmljs::audio::CreateAudioListener>(target,
678
+ "createAudioListener");
679
+ sfmljs::SetMethod<sfmljs::audio::CreateAudioValue>(target,
680
+ "createAudioValue");
681
+ sfmljs::SetMethod<sfmljs::audio::AudioListenerField>(target,
682
+ "audioListenerField");
543
683
  }