sfml.js 1.0.0-rc.1 → 1.0.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.
- package/README.ja.md +177 -0
- package/README.ko.md +177 -0
- package/README.md +119 -14
- package/README.zh-CN.md +177 -0
- package/assets/branding/sfml-js-symbol-pentagon.svg +24 -0
- package/assets/branding/sfml-js-wordmark-dark.svg +20 -0
- package/assets/branding/sfml-js-wordmark.svg +19 -0
- package/assets/breakout.png +0 -0
- package/dist/audio/effect-processor.d.ts +53 -8
- package/dist/audio/effect-processor.js +35 -5
- package/dist/audio/input-sound-file.d.ts +101 -15
- package/dist/audio/input-sound-file.js +101 -15
- package/dist/audio/listener.d.ts +74 -12
- package/dist/audio/listener.js +74 -12
- package/dist/audio/music.d.ts +172 -22
- package/dist/audio/music.js +185 -24
- package/dist/audio/output-sound-file.d.ts +36 -4
- package/dist/audio/output-sound-file.js +36 -4
- package/dist/audio/playback-device.d.ts +103 -17
- package/dist/audio/playback-device.js +97 -16
- package/dist/audio/sound-buffer-recorder.d.ts +89 -9
- package/dist/audio/sound-buffer-recorder.js +89 -9
- package/dist/audio/sound-buffer.d.ts +121 -16
- package/dist/audio/sound-buffer.js +98 -13
- package/dist/audio/sound-file-factory.d.ts +84 -11
- package/dist/audio/sound-file-factory.js +84 -11
- package/dist/audio/sound-file-reader.d.ts +155 -24
- package/dist/audio/sound-file-reader.js +84 -13
- package/dist/audio/sound-file-writer.d.ts +49 -7
- package/dist/audio/sound-file-writer.js +13 -2
- package/dist/audio/sound-recorder.d.ts +143 -19
- package/dist/audio/sound-recorder.js +142 -18
- package/dist/audio/sound-source.d.ts +273 -45
- package/dist/audio/sound-source.js +273 -45
- package/dist/audio/sound-stream.d.ts +57 -9
- package/dist/audio/sound-stream.js +43 -7
- package/dist/audio/sound.d.ts +32 -5
- package/dist/audio/sound.js +32 -5
- package/dist/audio/value.d.ts +291 -48
- package/dist/audio/value.js +235 -39
- package/dist/audio/worker.d.ts +256 -38
- package/dist/graphics/blend-mode.d.ts +199 -33
- package/dist/graphics/blend-mode.js +163 -27
- package/dist/graphics/boolean-vector.d.ts +102 -16
- package/dist/graphics/boolean-vector.js +102 -16
- package/dist/graphics/circle-shape.d.ts +68 -11
- package/dist/graphics/circle-shape.js +37 -6
- package/dist/graphics/color.d.ts +227 -42
- package/dist/graphics/color.js +177 -32
- package/dist/graphics/convex-shape.d.ts +45 -7
- package/dist/graphics/convex-shape.js +31 -5
- package/dist/graphics/drawable.d.ts +15 -2
- package/dist/graphics/drawable.js +6 -1
- package/dist/graphics/font.d.ts +153 -24
- package/dist/graphics/font.js +116 -18
- package/dist/graphics/glsl-matrix.d.ts +44 -7
- package/dist/graphics/glsl-matrix.js +44 -7
- package/dist/graphics/glsl.d.ts +129 -21
- package/dist/graphics/glsl.js +123 -20
- package/dist/graphics/glyph.d.ts +106 -17
- package/dist/graphics/glyph.js +76 -12
- package/dist/graphics/image.d.ts +159 -24
- package/dist/graphics/image.js +122 -18
- package/dist/graphics/primitive-type.d.ts +42 -7
- package/dist/graphics/primitive-type.js +42 -7
- package/dist/graphics/rect.d.ts +162 -26
- package/dist/graphics/rect.js +101 -16
- package/dist/graphics/rectangle-shape.d.ts +44 -7
- package/dist/graphics/rectangle-shape.js +31 -5
- package/dist/graphics/render-states.d.ts +153 -25
- package/dist/graphics/render-states.js +49 -8
- package/dist/graphics/render-target.d.ts +145 -22
- package/dist/graphics/render-target.js +110 -17
- package/dist/graphics/render-texture.d.ts +100 -16
- package/dist/graphics/render-texture.js +80 -13
- package/dist/graphics/render-window.d.ts +106 -17
- package/dist/graphics/render-window.js +57 -9
- package/dist/graphics/shader.d.ts +153 -24
- package/dist/graphics/shader.js +126 -20
- package/dist/graphics/shape.d.ts +133 -21
- package/dist/graphics/shape.js +115 -18
- package/dist/graphics/sprite.d.ts +71 -11
- package/dist/graphics/sprite.js +57 -9
- package/dist/graphics/stencil-mode.d.ts +193 -32
- package/dist/graphics/stencil-mode.js +121 -20
- package/dist/graphics/swap.d.ts +13 -2
- package/dist/graphics/text.d.ts +624 -103
- package/dist/graphics/text.js +443 -73
- package/dist/graphics/texture.d.ts +209 -32
- package/dist/graphics/texture.js +137 -21
- package/dist/graphics/transform.d.ts +93 -14
- package/dist/graphics/transform.js +93 -14
- package/dist/graphics/transformable.d.ts +13 -2
- package/dist/graphics/transformable.js +13 -2
- package/dist/graphics/vertex-array.d.ts +83 -14
- package/dist/graphics/vertex-array.js +70 -12
- package/dist/graphics/vertex-buffer.d.ts +162 -26
- package/dist/graphics/vertex-buffer.js +106 -17
- package/dist/graphics/vertex.d.ts +83 -14
- package/dist/graphics/vertex.js +43 -7
- package/dist/graphics/view.d.ts +140 -22
- package/dist/graphics/view.js +103 -16
- package/dist/internal/glsl-value.d.ts +30 -5
- package/dist/internal/glsl-value.js +30 -5
- package/dist/internal/scalar.d.ts +9 -1
- package/dist/internal/transformable.d.ts +84 -13
- package/dist/internal/value-storage.d.ts +8 -1
- package/dist/network/common.d.ts +6 -1
- package/dist/network/common.js +6 -1
- package/dist/network/dns.d.ts +103 -14
- package/dist/network/dns.js +55 -6
- package/dist/network/ftp.d.ts +217 -33
- package/dist/network/ftp.js +217 -33
- package/dist/network/gen/constants.d.ts +750 -124
- package/dist/network/gen/constants.js +750 -124
- package/dist/network/http.d.ts +365 -57
- package/dist/network/http.js +365 -57
- package/dist/network/ip-address.d.ts +179 -26
- package/dist/network/ip-address.js +164 -24
- package/dist/network/packet.d.ts +200 -29
- package/dist/network/packet.js +101 -13
- package/dist/network/sftp.d.ts +525 -84
- package/dist/network/sftp.js +322 -53
- package/dist/network/socket-selector.d.ts +109 -15
- package/dist/network/socket-selector.js +103 -14
- package/dist/network/socket.d.ts +245 -33
- package/dist/network/socket.js +205 -28
- package/dist/network/tcp-listener.d.ts +91 -13
- package/dist/network/tcp-listener.js +85 -12
- package/dist/network/tcp-socket.d.ts +232 -33
- package/dist/network/tcp-socket.js +153 -22
- package/dist/network/tls-material.d.ts +18 -2
- package/dist/network/tls-material.js +18 -2
- package/dist/network/udp-socket.d.ts +137 -19
- package/dist/network/udp-socket.js +101 -13
- package/dist/system/angle.d.ts +60 -10
- package/dist/system/angle.js +60 -10
- package/dist/system/clock.d.ts +51 -8
- package/dist/system/clock.js +51 -8
- package/dist/system/err.d.ts +14 -2
- package/dist/system/err.js +14 -2
- package/dist/system/error.d.ts +12 -2
- package/dist/system/error.js +12 -2
- package/dist/system/file-input-stream.d.ts +54 -7
- package/dist/system/file-input-stream.js +54 -7
- package/dist/system/input-stream.d.ts +97 -13
- package/dist/system/input-stream.js +60 -8
- package/dist/system/operators.d.ts +146 -19
- package/dist/system/operators.js +118 -15
- package/dist/system/sleep.d.ts +6 -1
- package/dist/system/sleep.js +6 -1
- package/dist/system/suspend-aware-clock.d.ts +18 -3
- package/dist/system/suspend-aware-clock.js +18 -3
- package/dist/system/time.d.ts +81 -12
- package/dist/system/time.js +63 -9
- package/dist/system/timeout-with-predicate.d.ts +48 -7
- package/dist/system/timeout-with-predicate.js +20 -3
- package/dist/system/unicode.d.ts +42 -6
- package/dist/system/unicode.js +42 -6
- package/dist/system/vector2.d.ts +240 -36
- package/dist/system/vector2.js +105 -16
- package/dist/system/vector3.d.ts +197 -31
- package/dist/system/vector3.js +104 -16
- package/dist/system/version.d.ts +43 -7
- package/dist/system/version.js +7 -1
- package/dist/window/clipboard.d.ts +12 -2
- package/dist/window/clipboard.js +12 -2
- package/dist/window/context-settings.d.ts +78 -13
- package/dist/window/context-settings.js +30 -5
- package/dist/window/context.d.ts +70 -10
- package/dist/window/context.js +52 -7
- package/dist/window/cursor.d.ts +44 -6
- package/dist/window/cursor.js +28 -4
- package/dist/window/event.d.ts +423 -70
- package/dist/window/event.js +36 -6
- package/dist/window/gen/constants.d.ts +1890 -314
- package/dist/window/gen/constants.js +1890 -314
- package/dist/window/joystick.d.ts +67 -11
- package/dist/window/joystick.js +43 -7
- package/dist/window/keyboard.d.ts +42 -6
- package/dist/window/keyboard.js +26 -4
- package/dist/window/mouse.d.ts +24 -3
- package/dist/window/mouse.js +24 -3
- package/dist/window/sensor.d.ts +20 -3
- package/dist/window/sensor.js +20 -3
- package/dist/window/touch.d.ts +19 -4
- package/dist/window/touch.js +19 -4
- package/dist/window/video-mode.d.ts +61 -10
- package/dist/window/video-mode.js +36 -6
- package/dist/window/vulkan.d.ts +26 -3
- package/dist/window/vulkan.js +26 -3
- package/dist/window/window.d.ts +296 -44
- package/dist/window/window.js +241 -34
- package/docs/README.ja.md +30 -0
- package/docs/README.ko.md +30 -0
- package/docs/README.md +30 -0
- package/docs/README.zh-CN.md +30 -0
- package/docs/api.ja.md +84 -0
- package/docs/api.ko.md +84 -0
- package/docs/api.md +48 -1080
- package/docs/api.zh-CN.md +81 -0
- package/docs/audio.ja.md +249 -0
- package/docs/audio.ko.md +251 -0
- package/docs/audio.md +132 -92
- package/docs/audio.zh-CN.md +252 -0
- package/docs/concepts.ja.md +130 -0
- package/docs/concepts.ko.md +130 -0
- package/docs/concepts.md +131 -0
- package/docs/concepts.zh-CN.md +131 -0
- package/docs/development.ja.md +144 -0
- package/docs/development.ko.md +144 -0
- package/docs/development.md +112 -43
- package/docs/development.zh-CN.md +146 -0
- package/docs/getting-started.ja.md +154 -0
- package/docs/getting-started.ko.md +154 -0
- package/docs/getting-started.md +156 -0
- package/docs/getting-started.zh-CN.md +156 -0
- package/docs/graphics.ja.md +256 -0
- package/docs/graphics.ko.md +254 -0
- package/docs/graphics.md +255 -0
- package/docs/graphics.zh-CN.md +257 -0
- package/docs/network.ja.md +214 -0
- package/docs/network.ko.md +216 -0
- package/docs/network.md +133 -84
- package/docs/network.zh-CN.md +218 -0
- package/docs/system.ja.md +169 -0
- package/docs/system.ko.md +171 -0
- package/docs/system.md +173 -0
- package/docs/system.zh-CN.md +173 -0
- package/docs/window.ja.md +138 -0
- package/docs/window.ko.md +140 -0
- package/docs/window.md +141 -0
- package/docs/window.zh-CN.md +141 -0
- package/native/shared-handle.h +41 -3
- package/package.json +17 -6
- package/src/audio/effect-processor.ts +53 -8
- package/src/audio/input-sound-file.ts +101 -15
- package/src/audio/listener.ts +74 -12
- package/src/audio/music.ts +191 -25
- package/src/audio/output-sound-file.ts +36 -4
- package/src/audio/playback-device.ts +103 -17
- package/src/audio/sound-buffer-recorder.ts +89 -9
- package/src/audio/sound-buffer.ts +121 -16
- package/src/audio/sound-file-factory.ts +84 -11
- package/src/audio/sound-file-reader.ts +155 -24
- package/src/audio/sound-file-writer.ts +49 -7
- package/src/audio/sound-recorder.ts +155 -20
- package/src/audio/sound-source.ts +273 -45
- package/src/audio/sound-stream.ts +57 -9
- package/src/audio/sound.ts +32 -5
- package/src/audio/value.ts +291 -48
- package/src/audio/worker.ts +256 -38
- package/src/graphics/blend-mode.ts +199 -33
- package/src/graphics/boolean-vector.ts +102 -16
- package/src/graphics/circle-shape.ts +68 -11
- package/src/graphics/color.ts +227 -42
- package/src/graphics/convex-shape.ts +45 -7
- package/src/graphics/drawable.ts +15 -2
- package/src/graphics/font.ts +153 -24
- package/src/graphics/glsl-matrix.ts +44 -7
- package/src/graphics/glsl.ts +129 -21
- package/src/graphics/glyph.ts +106 -17
- package/src/graphics/image.ts +159 -24
- package/src/graphics/primitive-type.ts +42 -7
- package/src/graphics/rect.ts +162 -26
- package/src/graphics/rectangle-shape.ts +44 -7
- package/src/graphics/render-states.ts +153 -25
- package/src/graphics/render-target.ts +145 -22
- package/src/graphics/render-texture.ts +100 -16
- package/src/graphics/render-window.ts +113 -18
- package/src/graphics/shader.ts +153 -24
- package/src/graphics/shape.ts +133 -21
- package/src/graphics/sprite.ts +71 -11
- package/src/graphics/stencil-mode.ts +193 -32
- package/src/graphics/swap.ts +13 -2
- package/src/graphics/text.ts +624 -103
- package/src/graphics/texture.ts +209 -32
- package/src/graphics/transform.ts +93 -14
- package/src/graphics/transformable.ts +13 -2
- package/src/graphics/vertex-array.ts +83 -14
- package/src/graphics/vertex-buffer.ts +162 -26
- package/src/graphics/vertex.ts +83 -14
- package/src/graphics/view.ts +140 -22
- package/src/internal/glsl-value.ts +30 -5
- package/src/internal/scalar.ts +9 -1
- package/src/internal/transformable.ts +84 -13
- package/src/internal/value-storage.ts +8 -1
- package/src/network/common.ts +6 -1
- package/src/network/dns.ts +103 -14
- package/src/network/ftp.ts +217 -33
- package/src/network/gen/constants.ts +750 -124
- package/src/network/http.ts +365 -57
- package/src/network/ip-address.ts +179 -26
- package/src/network/packet.ts +200 -29
- package/src/network/sftp.ts +525 -84
- package/src/network/socket-selector.ts +109 -15
- package/src/network/socket.ts +245 -33
- package/src/network/tcp-listener.ts +91 -13
- package/src/network/tcp-socket.ts +232 -33
- package/src/network/tls-material.ts +18 -2
- package/src/network/udp-socket.ts +137 -19
- package/src/system/angle.ts +60 -10
- package/src/system/clock.ts +51 -8
- package/src/system/err.ts +14 -2
- package/src/system/error.ts +12 -2
- package/src/system/file-input-stream.ts +54 -7
- package/src/system/input-stream.ts +97 -13
- package/src/system/operators.ts +146 -19
- package/src/system/sleep.ts +6 -1
- package/src/system/suspend-aware-clock.ts +18 -3
- package/src/system/time.ts +81 -12
- package/src/system/timeout-with-predicate.ts +48 -7
- package/src/system/unicode.ts +42 -6
- package/src/system/vector2.ts +240 -36
- package/src/system/vector3.ts +197 -31
- package/src/system/version.ts +43 -7
- package/src/window/clipboard.ts +12 -2
- package/src/window/context-settings.ts +78 -13
- package/src/window/context.ts +70 -10
- package/src/window/cursor.ts +44 -6
- package/src/window/event.ts +423 -70
- package/src/window/gen/constants.ts +1890 -314
- package/src/window/joystick.ts +67 -11
- package/src/window/keyboard.ts +42 -6
- package/src/window/mouse.ts +24 -3
- package/src/window/sensor.ts +20 -3
- package/src/window/touch.ts +19 -4
- package/src/window/video-mode.ts +61 -10
- package/src/window/vulkan.ts +26 -3
- package/src/window/window.ts +314 -46
- package/tools/constant-docs.cjs +109 -0
- package/tools/constant-docs.json +1318 -0
- package/tools/generate-network-constants.cjs +21 -9
- package/tools/generate-window-constants.cjs +26 -12
|
@@ -2,20 +2,55 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setNotificationCallback = exports.isDefaultDevice = exports.getDeviceSampleRate = exports.getDevice = exports.setDeviceToNull = exports.setDeviceToDefault = exports.setDevice = exports.getDefaultDevice = exports.getAvailableDevices = exports.Notification = void 0;
|
|
4
4
|
const audio_native_1 = require("../internal/audio-native");
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Lifecycle notifications for the audio playback device.
|
|
7
|
+
* @zh 音频播放设备的生命周期通知。
|
|
8
|
+
* @ja 音声再生デバイスのライフサイクル通知。
|
|
9
|
+
* @ko 오디오 재생 장치의 수명 주기 알림입니다.
|
|
10
|
+
*/
|
|
6
11
|
var Notification;
|
|
7
12
|
(function (Notification) {
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The device started.
|
|
15
|
+
* @zh 设备开始运行。
|
|
16
|
+
* @ja デバイスが動作を開始しました。
|
|
17
|
+
* @ko 장치가 작동을 시작했습니다.
|
|
18
|
+
*/
|
|
9
19
|
Notification[Notification["DeviceStarted"] = 0] = "DeviceStarted";
|
|
10
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The device stopped.
|
|
22
|
+
* @zh 设备停止运行。
|
|
23
|
+
* @ja デバイスが停止しました。
|
|
24
|
+
* @ko 장치가 작동을 중지했습니다.
|
|
25
|
+
*/
|
|
11
26
|
Notification[Notification["DeviceStopped"] = 1] = "DeviceStopped";
|
|
12
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The audio output route changed.
|
|
29
|
+
* @zh 音频输出路由发生变化。
|
|
30
|
+
* @ja 音声出力の経路が変わりました。
|
|
31
|
+
* @ko 오디오 출력 경로가 변경되었습니다.
|
|
32
|
+
*/
|
|
13
33
|
Notification[Notification["DeviceRerouted"] = 2] = "DeviceRerouted";
|
|
14
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* A system interruption began.
|
|
36
|
+
* @zh 系统中断开始。
|
|
37
|
+
* @ja システムによる割り込みが始まりました。
|
|
38
|
+
* @ko 시스템 인터럽트가 시작되었습니다.
|
|
39
|
+
*/
|
|
15
40
|
Notification[Notification["DeviceInterruptionBegan"] = 3] = "DeviceInterruptionBegan";
|
|
16
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* A system interruption ended.
|
|
43
|
+
* @zh 系统中断结束。
|
|
44
|
+
* @ja システムによる割り込みが終了しました。
|
|
45
|
+
* @ko 시스템 인터럽트가 끝났습니다.
|
|
46
|
+
*/
|
|
17
47
|
Notification[Notification["DeviceInterruptionEnded"] = 4] = "DeviceInterruptionEnded";
|
|
18
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The device was unlocked.
|
|
50
|
+
* @zh 设备解除锁定。
|
|
51
|
+
* @ja デバイスのロックが解除されました。
|
|
52
|
+
* @ko 장치 잠금이 해제되었습니다.
|
|
53
|
+
*/
|
|
19
54
|
Notification[Notification["DeviceUnlocked"] = 5] = "DeviceUnlocked";
|
|
20
55
|
})(Notification = exports.Notification || (exports.Notification = {}));
|
|
21
56
|
let state;
|
|
@@ -27,44 +62,90 @@ function command(id, name) {
|
|
|
27
62
|
}
|
|
28
63
|
return audio_native_1.audioNative.audioDevice(state.handle, id, name);
|
|
29
64
|
}
|
|
30
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Return the names of available playback devices.
|
|
67
|
+
* @zh 返回可用播放设备名称。
|
|
68
|
+
* @ja 利用可能な再生デバイスの名前を返します。
|
|
69
|
+
* @ko 사용 가능한 재생 장치 이름을 반환합니다.
|
|
70
|
+
*/
|
|
31
71
|
function getAvailableDevices() { return command(0); }
|
|
32
72
|
exports.getAvailableDevices = getAvailableDevices;
|
|
33
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Return the system's default playback device name,
|
|
75
|
+
* or undefined if unavailable.
|
|
76
|
+
* @zh 返回系统默认播放设备名称;不可用时为 undefined。
|
|
77
|
+
* @ja システムの既定の再生デバイス名を返します。利用不可なら undefined。
|
|
78
|
+
* @ko 시스템 기본 재생 장치 이름을 반환합니다. 사용할 수 없으면 undefined입니다.
|
|
79
|
+
*/
|
|
34
80
|
function getDefaultDevice() {
|
|
35
81
|
return command(1);
|
|
36
82
|
}
|
|
37
83
|
exports.getDefaultDevice = getDefaultDevice;
|
|
38
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Switch to the named playback device and return whether it succeeded.
|
|
86
|
+
* @zh 切换到指定名称的播放设备,返回是否成功。
|
|
87
|
+
* @ja 指定名の再生デバイスに切り替え、成功したかどうかを返します。
|
|
88
|
+
* @ko 지정한 이름의 재생 장치로 전환하고 성공 여부를 반환합니다.
|
|
89
|
+
*/
|
|
39
90
|
function setDevice(name) {
|
|
40
91
|
command(2, name);
|
|
41
92
|
return values[3] !== 0;
|
|
42
93
|
}
|
|
43
94
|
exports.setDevice = setDevice;
|
|
44
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Switch to the system's default playback device and report success.
|
|
97
|
+
* @zh 切换到系统默认播放设备,返回是否成功。
|
|
98
|
+
* @ja システムの既定の再生デバイスに切り替え、成功したかどうかを返します。
|
|
99
|
+
* @ko 시스템 기본 재생 장치로 전환하고 성공 여부를 반환합니다.
|
|
100
|
+
*/
|
|
45
101
|
function setDeviceToDefault() {
|
|
46
102
|
command(3);
|
|
47
103
|
return values[3] !== 0;
|
|
48
104
|
}
|
|
49
105
|
exports.setDeviceToDefault = setDeviceToDefault;
|
|
50
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Switch to a null device with no sound output and return whether it succeeded.
|
|
108
|
+
* @zh 切换到不输出声音的空设备,返回是否成功。
|
|
109
|
+
* @ja 音を出力しないヌルデバイスに切り替え、成功したかどうかを返します。
|
|
110
|
+
* @ko 소리를 출력하지 않는 널 장치로 전환하고 성공 여부를 반환합니다.
|
|
111
|
+
*/
|
|
51
112
|
function setDeviceToNull() { command(4); return values[3] !== 0; }
|
|
52
113
|
exports.setDeviceToNull = setDeviceToNull;
|
|
53
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Return the current playback device name, or undefined if unavailable.
|
|
116
|
+
* @zh 返回当前播放设备名称;不可用时为 undefined。
|
|
117
|
+
* @ja 現在の再生デバイス名を返します。利用不可なら undefined。
|
|
118
|
+
* @ko 현재 재생 장치 이름을 반환합니다. 사용할 수 없으면 undefined입니다.
|
|
119
|
+
*/
|
|
54
120
|
function getDevice() {
|
|
55
121
|
return command(5);
|
|
56
122
|
}
|
|
57
123
|
exports.getDevice = getDevice;
|
|
58
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Return the current device sample rate in Hz, or undefined if unavailable.
|
|
126
|
+
* @zh 返回当前设备采样率(Hz);不可用时为 undefined。
|
|
127
|
+
* @ja 現在のデバイスのサンプルレートを Hz で返します。利用不可なら undefined。
|
|
128
|
+
* @ko 현재 장치의 샘플 레이트를 Hz로 반환합니다. 사용할 수 없으면 undefined입니다.
|
|
129
|
+
*/
|
|
59
130
|
function getDeviceSampleRate() {
|
|
60
131
|
command(6);
|
|
61
132
|
return values[1] ? values[0] : undefined;
|
|
62
133
|
}
|
|
63
134
|
exports.getDeviceSampleRate = getDeviceSampleRate;
|
|
64
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Return whether the current device follows the system default.
|
|
137
|
+
* @zh 返回当前设备是否跟随系统默认设备。
|
|
138
|
+
* @ja 現在のデバイスがシステムの既定デバイスに追従するかどうかを返します。
|
|
139
|
+
* @ko 현재 장치가 시스템 기본 장치를 따르는지 반환합니다.
|
|
140
|
+
*/
|
|
65
141
|
function isDefaultDevice() { command(7); return values[2] !== 0; }
|
|
66
142
|
exports.isDefaultDevice = isDefaultDevice;
|
|
67
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Set the device notification callback; undefined or null removes it.
|
|
145
|
+
* @zh 设置设备通知回调;undefined 或 null 移除回调。
|
|
146
|
+
* @ja デバイス通知のコールバックを設定します。undefined または null で解除します。
|
|
147
|
+
* @ko 장치 알림 콜백을 설정합니다. undefined 또는 null은 콜백을 제거합니다.
|
|
148
|
+
*/
|
|
68
149
|
function setNotificationCallback(callback) {
|
|
69
150
|
audio_native_1.audioNative.audioDeviceNotifications(callback);
|
|
70
151
|
}
|
|
@@ -2,33 +2,113 @@ import { type AudioHandle } from '../internal/audio-native';
|
|
|
2
2
|
import { type AudioRecorderCallbacks } from '../internal/audio-recorder-session';
|
|
3
3
|
import { SoundRecorder } from './sound-recorder';
|
|
4
4
|
import { type ReadonlySoundBuffer } from './sound-buffer';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Recorder that saves captured PCM in a SoundBuffer.
|
|
7
|
+
* @zh 将采集的 PCM 保存在 SoundBuffer 中的录音器。
|
|
8
|
+
* @ja キャプチャした PCM を SoundBuffer に保存する録音器。
|
|
9
|
+
* @ko 캡처한 PCM을 SoundBuffer에 저장하는 녹음기입니다.
|
|
10
|
+
*/
|
|
6
11
|
export declare class SoundBufferRecorder extends SoundRecorder {
|
|
7
12
|
private buffer;
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Create a recorder; call start to begin capture.
|
|
15
|
+
* @zh 创建录音器,调用 start 开始采集。
|
|
16
|
+
* @ja 録音器を作成します。start を呼ぶとキャプチャを開始します。
|
|
17
|
+
* @ko 녹음기를 생성합니다. start를 호출하면 캡처를 시작합니다.
|
|
18
|
+
*/
|
|
9
19
|
constructor();
|
|
10
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Return the most recently completed recording buffer;
|
|
22
|
+
* retrieve new results after await stop().
|
|
23
|
+
* @zh 返回最近完成的录音缓冲区;应在 await stop() 后取得新结果。
|
|
24
|
+
* @ja 最後に完成した録音バッファーを返します。
|
|
25
|
+
* 新しい結果は await stop() の後で取得してください。
|
|
26
|
+
* @ko 가장 최근 완성된 녹음 버퍼를 반환합니다.
|
|
27
|
+
* 새 결과는 await stop() 후에 가져와야 합니다.
|
|
28
|
+
*/
|
|
11
29
|
getBuffer(): ReadonlySoundBuffer;
|
|
12
30
|
/**
|
|
13
|
-
*
|
|
31
|
+
* Called on the object's owning JS thread before capture begins; supports
|
|
32
|
+
* synchronous or asynchronous returns, with false rejecting capture.
|
|
33
|
+
* By default, clears this session's native PCM accumulator and recording
|
|
34
|
+
* buffer without accessing the microphone.
|
|
35
|
+
* @zh 在对象所属 JS 线程开始采集前调用;支持同步或异步返回,false 拒绝采集。
|
|
14
36
|
* 默认清空本次 Native PCM 聚合和录音缓冲区,不访问麦克风。
|
|
37
|
+
* @ja キャプチャ開始前にオブジェクトの所属 JS スレッドで呼ばれます。
|
|
38
|
+
* 同期・非同期の戻り値に対応し、false はキャプチャを拒否します。
|
|
39
|
+
* 既定では今回の Native PCM 蓄積領域と録音バッファーをクリアし、
|
|
40
|
+
* マイクにはアクセスしません。
|
|
41
|
+
* @ko 캡처 시작 전 객체가 속한 JS 스레드에서 호출됩니다.
|
|
42
|
+
* 동기 또는 비동기 반환을 지원하며 false는 캡처를 거부합니다.
|
|
43
|
+
* 기본적으로 이번 세션의 Native PCM 누적 영역과 녹음 버퍼를 비우며
|
|
44
|
+
* 마이크에 접근하지 않습니다.
|
|
15
45
|
*/
|
|
16
46
|
protected onStart(): boolean | Promise<boolean>;
|
|
17
47
|
/**
|
|
18
|
-
*
|
|
48
|
+
* Serially process interleaved 16-bit PCM on the object's owning JS thread;
|
|
49
|
+
* lengths count samples, not frames. Native views are valid only until this
|
|
50
|
+
* synchronous or asynchronous callback ends; false stops capture
|
|
51
|
+
* asynchronously. By default, appends incoming samples to the native
|
|
52
|
+
* accumulator. You may modify samples before calling super; without super,
|
|
53
|
+
* samples are not saved.
|
|
54
|
+
* @zh 在对象所属 JS 线程串行处理交错的 16 位 PCM,长度单位为样本而非帧。
|
|
19
55
|
* Native 视图仅在本次同步或异步回调结束前有效;false 异步停止采集。
|
|
20
56
|
* 默认将传入样本追加到 Native 聚合器;可修改后调用 super,不调用则不保存。
|
|
57
|
+
* @ja オブジェクトの所属 JS スレッドで 16 ビットインターリーブ PCM を直列処理します。
|
|
58
|
+
* 長さはフレームではなくサンプル数です。Native ビューは今回の同期・非同期
|
|
59
|
+
* コールバック終了までのみ有効で、false はキャプチャを非同期で停止します。
|
|
60
|
+
* 既定では受け取ったサンプルを Native 蓄積領域に追加します。
|
|
61
|
+
* 変更後に super を呼ぶこともでき、呼ばない場合は保存しません。
|
|
62
|
+
* @ko 객체가 속한 JS 스레드에서 16비트 인터리브 PCM을 직렬로 처리합니다.
|
|
63
|
+
* 길이 단위는 프레임이 아닌 샘플입니다. Native 뷰는 이번 동기 또는 비동기
|
|
64
|
+
* 콜백이 끝날 때까지만 유효하며 false는 캡처를 비동기로 중지합니다.
|
|
65
|
+
* 기본적으로 입력 샘플을 Native 누적기에 추가합니다.
|
|
66
|
+
* 수정 후 super를 호출할 수 있으며, 호출하지 않으면 저장되지 않습니다.
|
|
21
67
|
*/
|
|
22
68
|
protected onProcessSamples(samples: Int16Array): boolean | Promise<boolean>;
|
|
23
69
|
/**
|
|
24
|
-
*
|
|
70
|
+
* Called once on the object's owning JS thread after the device stops and
|
|
71
|
+
* delivered callbacks finish; supports asynchronous completion.
|
|
72
|
+
* Rejection, cancellation, and errors also trigger it. By default, finalizes
|
|
73
|
+
* PCM appended through super into a SoundBuffer.
|
|
74
|
+
* @zh 在设备停止且已交付回调结束后,于对象所属 JS 线程调用一次,支持异步完成。
|
|
25
75
|
* 拒绝、取消和异常同样触发;默认将已通过 super 追加的 PCM 完成为 SoundBuffer。
|
|
76
|
+
* @ja デバイス停止と配信済みコールバックの完了後、オブジェクトの所属 JS スレッドで
|
|
77
|
+
* 一度呼ばれます。非同期完了に対応します。拒否・キャンセル・例外時も呼ばれます。
|
|
78
|
+
* 既定では super で追加された PCM を SoundBuffer として完成させます。
|
|
79
|
+
* @ko 장치가 중지되고 전달된 콜백이 끝난 후 객체가 속한 JS 스레드에서
|
|
80
|
+
* 한 번 호출되며 비동기 완료를 지원합니다. 거부, 취소, 오류 시에도 호출됩니다.
|
|
81
|
+
* 기본적으로 super를 통해 추가한 PCM을 SoundBuffer로 완성합니다.
|
|
26
82
|
*/
|
|
27
83
|
protected onStop(): void | Promise<void>;
|
|
28
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Enable the queue only for subclasses overriding callbacks;
|
|
86
|
+
* ordinary instances retain the native fast path.
|
|
87
|
+
* @zh 只有覆写回调的子类启用队列,普通实例保持 Native 快路径。
|
|
88
|
+
* @ja コールバックをオーバーライドするサブクラスのみキューを有効にし、
|
|
89
|
+
* 通常のインスタンスでは Native 高速経路を維持します。
|
|
90
|
+
* @ko 콜백을 재정의한 하위 클래스만 큐를 활성화하며,
|
|
91
|
+
* 일반 인스턴스는 Native 고속 경로를 유지합니다.
|
|
92
|
+
*/
|
|
29
93
|
protected recorderCallbacks(): AudioRecorderCallbacks | undefined;
|
|
30
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Create weak-reference dispatchers outside instance scope so idle sessions
|
|
96
|
+
* do not keep wrappers alive.
|
|
97
|
+
* @zh 在实例作用域外创建弱引用派发器,避免空闲会话保活包装对象。
|
|
98
|
+
* @ja インスタンスのスコープ外で弱参照ディスパッチャーを作成し、
|
|
99
|
+
* アイドル中のセッションがラッパーの生存を維持しないようにします。
|
|
100
|
+
* @ko 인스턴스 범위 밖에서 약한 참조 디스패처를 생성하여
|
|
101
|
+
* 유휴 세션이 래퍼 객체를 계속 유지하지 않도록 합니다.
|
|
102
|
+
*/
|
|
31
103
|
private static callbacks;
|
|
32
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Receive an independent native buffer; later recordings do not modify a
|
|
106
|
+
* previously returned SoundBuffer.
|
|
107
|
+
* @zh 接收独立 Native 缓冲区;后续录音不会修改已返回的 SoundBuffer。
|
|
108
|
+
* @ja 独立した Native バッファーを受け取ります。
|
|
109
|
+
* 後の録音で返却済みの SoundBuffer が変更されることはありません。
|
|
110
|
+
* @ko 독립적인 Native 버퍼를 받습니다.
|
|
111
|
+
* 이후 녹음은 이미 반환한 SoundBuffer를 수정하지 않습니다.
|
|
112
|
+
*/
|
|
33
113
|
protected onBuffer(buffer: AudioHandle<'bufferData'>): void;
|
|
34
114
|
}
|
|
@@ -5,40 +5,104 @@ const audio_native_1 = require("../internal/audio-native");
|
|
|
5
5
|
const audio_recorder_session_1 = require("../internal/audio-recorder-session");
|
|
6
6
|
const sound_recorder_1 = require("./sound-recorder");
|
|
7
7
|
const sound_buffer_1 = require("./sound-buffer");
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Recorder that saves captured PCM in a SoundBuffer.
|
|
10
|
+
* @zh 将采集的 PCM 保存在 SoundBuffer 中的录音器。
|
|
11
|
+
* @ja キャプチャした PCM を SoundBuffer に保存する録音器。
|
|
12
|
+
* @ko 캡처한 PCM을 SoundBuffer에 저장하는 녹음기입니다.
|
|
13
|
+
*/
|
|
9
14
|
class SoundBufferRecorder extends sound_recorder_1.SoundRecorder {
|
|
10
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Create a recorder; call start to begin capture.
|
|
17
|
+
* @zh 创建录音器,调用 start 开始采集。
|
|
18
|
+
* @ja 録音器を作成します。start を呼ぶとキャプチャを開始します。
|
|
19
|
+
* @ko 녹음기를 생성합니다. start를 호출하면 캡처를 시작합니다.
|
|
20
|
+
*/
|
|
11
21
|
constructor() {
|
|
12
22
|
super(undefined, true);
|
|
13
23
|
this.buffer = new sound_buffer_1.SoundBuffer();
|
|
14
24
|
}
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Return the most recently completed recording buffer;
|
|
27
|
+
* retrieve new results after await stop().
|
|
28
|
+
* @zh 返回最近完成的录音缓冲区;应在 await stop() 后取得新结果。
|
|
29
|
+
* @ja 最後に完成した録音バッファーを返します。
|
|
30
|
+
* 新しい結果は await stop() の後で取得してください。
|
|
31
|
+
* @ko 가장 최근 완성된 녹음 버퍼를 반환합니다.
|
|
32
|
+
* 새 결과는 await stop() 후에 가져와야 합니다.
|
|
33
|
+
*/
|
|
16
34
|
getBuffer() { return this.buffer; }
|
|
17
35
|
/**
|
|
18
|
-
*
|
|
36
|
+
* Called on the object's owning JS thread before capture begins; supports
|
|
37
|
+
* synchronous or asynchronous returns, with false rejecting capture.
|
|
38
|
+
* By default, clears this session's native PCM accumulator and recording
|
|
39
|
+
* buffer without accessing the microphone.
|
|
40
|
+
* @zh 在对象所属 JS 线程开始采集前调用;支持同步或异步返回,false 拒绝采集。
|
|
19
41
|
* 默认清空本次 Native PCM 聚合和录音缓冲区,不访问麦克风。
|
|
42
|
+
* @ja キャプチャ開始前にオブジェクトの所属 JS スレッドで呼ばれます。
|
|
43
|
+
* 同期・非同期の戻り値に対応し、false はキャプチャを拒否します。
|
|
44
|
+
* 既定では今回の Native PCM 蓄積領域と録音バッファーをクリアし、
|
|
45
|
+
* マイクにはアクセスしません。
|
|
46
|
+
* @ko 캡처 시작 전 객체가 속한 JS 스레드에서 호출됩니다.
|
|
47
|
+
* 동기 또는 비동기 반환을 지원하며 false는 캡처를 거부합니다.
|
|
48
|
+
* 기본적으로 이번 세션의 Native PCM 누적 영역과 녹음 버퍼를 비우며
|
|
49
|
+
* 마이크에 접근하지 않습니다.
|
|
20
50
|
*/
|
|
21
51
|
onStart() {
|
|
22
52
|
this.onBuffer((0, audio_recorder_session_1.recorderCallbackSession)(this[audio_native_1.audioHandle], 'onStart').reset());
|
|
23
53
|
return true;
|
|
24
54
|
}
|
|
25
55
|
/**
|
|
26
|
-
*
|
|
56
|
+
* Serially process interleaved 16-bit PCM on the object's owning JS thread;
|
|
57
|
+
* lengths count samples, not frames. Native views are valid only until this
|
|
58
|
+
* synchronous or asynchronous callback ends; false stops capture
|
|
59
|
+
* asynchronously. By default, appends incoming samples to the native
|
|
60
|
+
* accumulator. You may modify samples before calling super; without super,
|
|
61
|
+
* samples are not saved.
|
|
62
|
+
* @zh 在对象所属 JS 线程串行处理交错的 16 位 PCM,长度单位为样本而非帧。
|
|
27
63
|
* Native 视图仅在本次同步或异步回调结束前有效;false 异步停止采集。
|
|
28
64
|
* 默认将传入样本追加到 Native 聚合器;可修改后调用 super,不调用则不保存。
|
|
65
|
+
* @ja オブジェクトの所属 JS スレッドで 16 ビットインターリーブ PCM を直列処理します。
|
|
66
|
+
* 長さはフレームではなくサンプル数です。Native ビューは今回の同期・非同期
|
|
67
|
+
* コールバック終了までのみ有効で、false はキャプチャを非同期で停止します。
|
|
68
|
+
* 既定では受け取ったサンプルを Native 蓄積領域に追加します。
|
|
69
|
+
* 変更後に super を呼ぶこともでき、呼ばない場合は保存しません。
|
|
70
|
+
* @ko 객체가 속한 JS 스레드에서 16비트 인터리브 PCM을 직렬로 처리합니다.
|
|
71
|
+
* 길이 단위는 프레임이 아닌 샘플입니다. Native 뷰는 이번 동기 또는 비동기
|
|
72
|
+
* 콜백이 끝날 때까지만 유효하며 false는 캡처를 비동기로 중지합니다.
|
|
73
|
+
* 기본적으로 입력 샘플을 Native 누적기에 추가합니다.
|
|
74
|
+
* 수정 후 super를 호출할 수 있으며, 호출하지 않으면 저장되지 않습니다.
|
|
29
75
|
*/
|
|
30
76
|
onProcessSamples(samples) {
|
|
31
77
|
return (0, audio_recorder_session_1.recorderCallbackSession)(this[audio_native_1.audioHandle], 'onProcessSamples')
|
|
32
78
|
.append(samples);
|
|
33
79
|
}
|
|
34
80
|
/**
|
|
35
|
-
*
|
|
81
|
+
* Called once on the object's owning JS thread after the device stops and
|
|
82
|
+
* delivered callbacks finish; supports asynchronous completion.
|
|
83
|
+
* Rejection, cancellation, and errors also trigger it. By default, finalizes
|
|
84
|
+
* PCM appended through super into a SoundBuffer.
|
|
85
|
+
* @zh 在设备停止且已交付回调结束后,于对象所属 JS 线程调用一次,支持异步完成。
|
|
36
86
|
* 拒绝、取消和异常同样触发;默认将已通过 super 追加的 PCM 完成为 SoundBuffer。
|
|
87
|
+
* @ja デバイス停止と配信済みコールバックの完了後、オブジェクトの所属 JS スレッドで
|
|
88
|
+
* 一度呼ばれます。非同期完了に対応します。拒否・キャンセル・例外時も呼ばれます。
|
|
89
|
+
* 既定では super で追加された PCM を SoundBuffer として完成させます。
|
|
90
|
+
* @ko 장치가 중지되고 전달된 콜백이 끝난 후 객체가 속한 JS 스레드에서
|
|
91
|
+
* 한 번 호출되며 비동기 완료를 지원합니다. 거부, 취소, 오류 시에도 호출됩니다.
|
|
92
|
+
* 기본적으로 super를 통해 추가한 PCM을 SoundBuffer로 완성합니다.
|
|
37
93
|
*/
|
|
38
94
|
onStop() {
|
|
39
95
|
this.onBuffer((0, audio_recorder_session_1.recorderCallbackSession)(this[audio_native_1.audioHandle], 'onStop').finalize());
|
|
40
96
|
}
|
|
41
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Enable the queue only for subclasses overriding callbacks;
|
|
99
|
+
* ordinary instances retain the native fast path.
|
|
100
|
+
* @zh 只有覆写回调的子类启用队列,普通实例保持 Native 快路径。
|
|
101
|
+
* @ja コールバックをオーバーライドするサブクラスのみキューを有効にし、
|
|
102
|
+
* 通常のインスタンスでは Native 高速経路を維持します。
|
|
103
|
+
* @ko 콜백을 재정의한 하위 클래스만 큐를 활성화하며,
|
|
104
|
+
* 일반 인스턴스는 Native 고속 경로를 유지합니다.
|
|
105
|
+
*/
|
|
42
106
|
recorderCallbacks() {
|
|
43
107
|
if (this.onStart === SoundBufferRecorder.prototype.onStart &&
|
|
44
108
|
this.onProcessSamples === SoundBufferRecorder.prototype.onProcessSamples &&
|
|
@@ -46,7 +110,15 @@ class SoundBufferRecorder extends sound_recorder_1.SoundRecorder {
|
|
|
46
110
|
return undefined;
|
|
47
111
|
return SoundBufferRecorder.callbacks(new WeakRef(this));
|
|
48
112
|
}
|
|
49
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Create weak-reference dispatchers outside instance scope so idle sessions
|
|
115
|
+
* do not keep wrappers alive.
|
|
116
|
+
* @zh 在实例作用域外创建弱引用派发器,避免空闲会话保活包装对象。
|
|
117
|
+
* @ja インスタンスのスコープ外で弱参照ディスパッチャーを作成し、
|
|
118
|
+
* アイドル中のセッションがラッパーの生存を維持しないようにします。
|
|
119
|
+
* @ko 인스턴스 범위 밖에서 약한 참조 디스패처를 생성하여
|
|
120
|
+
* 유휴 세션이 래퍼 객체를 계속 유지하지 않도록 합니다.
|
|
121
|
+
*/
|
|
50
122
|
static callbacks(weak) {
|
|
51
123
|
return {
|
|
52
124
|
onStart: () => weak.deref()?.onStart() ?? false,
|
|
@@ -54,7 +126,15 @@ class SoundBufferRecorder extends sound_recorder_1.SoundRecorder {
|
|
|
54
126
|
onStop: () => weak.deref()?.onStop(),
|
|
55
127
|
};
|
|
56
128
|
}
|
|
57
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Receive an independent native buffer; later recordings do not modify a
|
|
131
|
+
* previously returned SoundBuffer.
|
|
132
|
+
* @zh 接收独立 Native 缓冲区;后续录音不会修改已返回的 SoundBuffer。
|
|
133
|
+
* @ja 独立した Native バッファーを受け取ります。
|
|
134
|
+
* 後の録音で返却済みの SoundBuffer が変更されることはありません。
|
|
135
|
+
* @ko 독립적인 Native 버퍼를 받습니다.
|
|
136
|
+
* 이후 녹음은 이미 반환한 SoundBuffer를 수정하지 않습니다.
|
|
137
|
+
*/
|
|
58
138
|
onBuffer(buffer) {
|
|
59
139
|
this.buffer = sound_buffer_1.SoundBuffer[sound_buffer_1.adoptAudioBuffer](buffer);
|
|
60
140
|
}
|
|
@@ -2,43 +2,148 @@ import { audioHandle, type AudioHandle } from '../internal/audio-native';
|
|
|
2
2
|
import { Time } from '../system/time';
|
|
3
3
|
import type { InputStream } from '../system/input-stream';
|
|
4
4
|
import { type SoundChannel, type ReadonlySamples, type ChannelMap } from './value';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Read-only audio buffer interface; sample views retain their native storage.
|
|
7
|
+
* @zh 音频缓冲区的只读接口,样本视图保留其对应的原生存储。
|
|
8
|
+
* @ja 音声バッファーの読み取り専用インターフェース。
|
|
9
|
+
* サンプルビューは対応するネイティブストレージを保持します。
|
|
10
|
+
* @ko 오디오 버퍼의 읽기 전용 인터페이스입니다.
|
|
11
|
+
* 샘플 뷰는 해당 네이티브 저장소를 유지합니다.
|
|
12
|
+
*/
|
|
6
13
|
export type ReadonlySoundBuffer = Readonly<Pick<SoundBuffer, typeof audioHandle | 'getSamples' | 'getSampleCount' | 'getSampleRate' | 'getChannelCount' | 'getChannelMap' | 'getDuration' | 'saveToFile'>>;
|
|
7
14
|
export declare const adoptAudioBuffer: unique symbol;
|
|
8
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Views retain the exact native allocation from which they were obtained.
|
|
17
|
+
* @zh 视图保留获取时对应的原生内存分配。
|
|
18
|
+
* @ja ビューは取得元となったネイティブメモリ割り当てをそのまま保持します。
|
|
19
|
+
* @ko 뷰는 자신을 얻은 원래 네이티브 메모리 할당을 그대로 유지합니다.
|
|
20
|
+
*/
|
|
9
21
|
export declare class SoundBuffer {
|
|
10
22
|
readonly [audioHandle]: AudioHandle<'buffer'>;
|
|
11
23
|
private state;
|
|
12
24
|
private readonly queue;
|
|
13
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Create an empty audio buffer or deep-copy an existing buffer.
|
|
27
|
+
* @zh 创建空音频缓冲区,或深复制现有缓冲区。
|
|
28
|
+
* @ja 空の音声バッファーを作成するか、既存のバッファーをディープコピーします。
|
|
29
|
+
* @ko 빈 오디오 버퍼를 생성하거나 기존 버퍼를 깊은 복사합니다.
|
|
30
|
+
*/
|
|
14
31
|
constructor(source?: ReadonlySoundBuffer);
|
|
15
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Copy interleaved 16-bit PCM; sample rate is in Hz and channelMap specifies
|
|
34
|
+
* each channel's position.
|
|
35
|
+
* @zh 复制交错 16 位 PCM;采样率以 Hz 计,channelMap 指定各声道位置。
|
|
36
|
+
* @ja 16 ビットインターリーブ PCM をコピーします。サンプルレートは Hz、
|
|
37
|
+
* channelMap は各チャンネルの位置を指定します。
|
|
38
|
+
* @ko 16비트 인터리브 PCM을 복사합니다. 샘플 레이트는 Hz 단위이며
|
|
39
|
+
* channelMap은 각 채널 위치를 지정합니다.
|
|
40
|
+
*/
|
|
16
41
|
constructor(samples: Int16Array, channelCount: number, sampleRate: number, channelMap: Iterable<SoundChannel>);
|
|
17
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Copy the current source data synchronously, retaining this buffer's
|
|
44
|
+
* identity.
|
|
45
|
+
* @zh 同步复制源缓冲区的当前数据,保留当前缓冲区的身份。
|
|
46
|
+
* @ja 元バッファーの現在のデータを同期的にコピーし、
|
|
47
|
+
* このバッファーの同一性を保持します。
|
|
48
|
+
* @ko 원본 버퍼의 현재 데이터를 동기적으로 복사하며 이 버퍼의 정체성을 유지합니다.
|
|
49
|
+
*/
|
|
18
50
|
assign(source: ReadonlySoundBuffer): this;
|
|
19
51
|
/** @internal */
|
|
20
52
|
static [adoptAudioBuffer](data: AudioHandle<'bufferData'>): SoundBuffer;
|
|
21
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Asynchronously decode an entire audio file into native PCM storage,
|
|
55
|
+
* returning whether it succeeded.
|
|
56
|
+
* @zh 异步解码整个音频文件到原生 PCM 存储,返回是否成功。
|
|
57
|
+
* @ja 音声ファイル全体をネイティブ PCM ストレージに非同期でデコードし、
|
|
58
|
+
* 成功したかどうかを返します。
|
|
59
|
+
* @ko 전체 오디오 파일을 네이티브 PCM 저장소에 비동기로 디코딩하고
|
|
60
|
+
* 성공 여부를 반환합니다.
|
|
61
|
+
*/
|
|
22
62
|
loadFromFile(filename: string): Promise<boolean>;
|
|
23
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Asynchronously decode encoded audio bytes and replace the PCM,
|
|
65
|
+
* returning whether it succeeded.
|
|
66
|
+
* @zh 异步解码编码音频字节并替换 PCM,返回是否成功。
|
|
67
|
+
* @ja エンコード済み音声バイトを非同期でデコードして PCM を置き換え、
|
|
68
|
+
* 成功したかどうかを返します。
|
|
69
|
+
* @ko 인코딩된 오디오 바이트를 비동기로 디코딩하여 PCM을 교체하고
|
|
70
|
+
* 성공 여부를 반환합니다.
|
|
71
|
+
*/
|
|
24
72
|
loadFromMemory(data: Uint8Array): Promise<boolean>;
|
|
25
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Asynchronously decode all samples from an input stream, returning whether
|
|
75
|
+
* it succeeded; stream errors reject the Promise.
|
|
76
|
+
* @zh 从输入流异步解码全部样本,返回是否成功;流异常会拒绝 Promise。
|
|
77
|
+
* @ja 入力ストリームの全サンプルを非同期でデコードし、成功したかどうかを返します。
|
|
78
|
+
* ストリームの例外は Promise を拒否します。
|
|
79
|
+
* @ko 입력 스트림의 모든 샘플을 비동기로 디코딩하고 성공 여부를 반환합니다.
|
|
80
|
+
* 스트림 오류는 Promise를 거부합니다.
|
|
81
|
+
*/
|
|
26
82
|
loadFromStream(stream: InputStream): Promise<boolean>;
|
|
27
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Synchronously copy interleaved 16-bit PCM and replace the contents;
|
|
85
|
+
* sampleRate is in Hz. Return whether it succeeded.
|
|
86
|
+
* @zh 同步复制交错 16 位 PCM 并替换内容;sampleRate 为 Hz,返回是否成功。
|
|
87
|
+
* @ja 16 ビットインターリーブ PCM を同期的にコピーして内容を置き換えます。
|
|
88
|
+
* sampleRate は Hz で、成功したかどうかを返します。
|
|
89
|
+
* @ko 16비트 인터리브 PCM을 동기적으로 복사하여 내용을 교체합니다.
|
|
90
|
+
* sampleRate는 Hz 단위이며 성공 여부를 반환합니다.
|
|
91
|
+
*/
|
|
28
92
|
loadFromSamples(data: Int16Array, channelCount: number, sampleRate: number, channelMap: Iterable<SoundChannel>): boolean;
|
|
29
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Return a read-only typed PCM view, or undefined for an empty buffer.
|
|
95
|
+
* After reloading, existing views still reference the old storage.
|
|
96
|
+
* @zh 返回 PCM 只读类型视图;空缓冲区为 undefined,
|
|
97
|
+
* 重新加载后旧视图仍指向旧存储。
|
|
98
|
+
* @ja PCM の読み取り専用型ビューを返します。空のバッファーでは undefined。
|
|
99
|
+
* 再読み込み後も既存のビューは以前のストレージを参照します。
|
|
100
|
+
* @ko PCM의 읽기 전용 타입 뷰를 반환하며, 빈 버퍼이면 undefined입니다.
|
|
101
|
+
* 다시 로드한 후에도 기존 뷰는 이전 저장소를 참조합니다.
|
|
102
|
+
*/
|
|
30
103
|
getSamples(): ReadonlySamples | undefined;
|
|
31
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Return the total sample count across all channels.
|
|
106
|
+
* @zh 返回所有声道合计的样本数量。
|
|
107
|
+
* @ja 全チャンネルのサンプル総数を返します。
|
|
108
|
+
* @ko 모든 채널의 샘플 총수를 반환합니다.
|
|
109
|
+
*/
|
|
32
110
|
getSampleCount(): bigint;
|
|
33
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Return the sample rate per channel, in Hz.
|
|
113
|
+
* @zh 返回每声道采样率,单位为 Hz。
|
|
114
|
+
* @ja チャンネルごとのサンプルレートを Hz で返します。
|
|
115
|
+
* @ko 채널별 샘플 레이트를 Hz 단위로 반환합니다.
|
|
116
|
+
*/
|
|
34
117
|
getSampleRate(): number;
|
|
35
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Return the number of channels.
|
|
120
|
+
* @zh 返回声道数量。
|
|
121
|
+
* @ja チャンネル数を返します。
|
|
122
|
+
* @ko 채널 수를 반환합니다.
|
|
123
|
+
*/
|
|
36
124
|
getChannelCount(): number;
|
|
37
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Return a read-only view of channel positions in interleaved order.
|
|
127
|
+
* @zh 返回交错声道位置顺序的只读视图。
|
|
128
|
+
* @ja インターリーブ順のチャンネル位置の読み取り専用ビューを返します。
|
|
129
|
+
* @ko 인터리브 순서의 채널 위치를 나타내는 읽기 전용 뷰를 반환합니다.
|
|
130
|
+
*/
|
|
38
131
|
getChannelMap(): ChannelMap;
|
|
39
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Return a copy of the total audio duration.
|
|
134
|
+
* @zh 返回音频总时长副本。
|
|
135
|
+
* @ja 音声全体の長さのコピーを返します。
|
|
136
|
+
* @ko 오디오 전체 길이의 복사본을 반환합니다.
|
|
137
|
+
*/
|
|
40
138
|
getDuration(): Time;
|
|
41
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Asynchronously encode and save using the file extension to select the
|
|
141
|
+
* format, returning whether it succeeded.
|
|
142
|
+
* @zh 按文件扩展名异步编码保存,返回是否成功。
|
|
143
|
+
* @ja ファイルの拡張子に基づいて非同期でエンコード・保存し、
|
|
144
|
+
* 成功したかどうかを返します。
|
|
145
|
+
* @ko 파일 확장자에 따라 비동기로 인코딩하여 저장하고 성공 여부를 반환합니다.
|
|
146
|
+
*/
|
|
42
147
|
saveToFile(filename: string): Promise<boolean>;
|
|
43
148
|
private loadDecoded;
|
|
44
149
|
private load;
|