@combos-fun/plugin-sound 0.0.7 → 0.0.9
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/agent-skill.md +6 -17
- package/package.json +10 -4
package/agent-skill.md
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
# `@combos-fun/plugin-sound` — Agent notes
|
|
2
2
|
|
|
3
|
-
Audio playback for Combos Fun. Web Audio internally
|
|
4
|
-
(`AudioContext` + `AudioBufferSourceNode` + `GainNode`). Shared between 2D
|
|
5
|
-
and 3D — there is no spatial / 3D-positional audio in this package.
|
|
3
|
+
Audio playback for Combos Fun. Web Audio internally (`AudioContext` + `AudioBufferSourceNode` + `GainNode`). Shared between 2D and 3D — there is no spatial / 3D-positional audio in this package.
|
|
6
4
|
|
|
7
5
|
## When to read
|
|
8
6
|
|
|
9
|
-
Read for any audio task: SFX, BGM, autoplay, loop, mute, volume, pause /
|
|
10
|
-
resume integration with `Game.pause()` / `Game.resume()`, touch-to-unlock
|
|
11
|
-
on mobile.
|
|
7
|
+
Read for any audio task: SFX, BGM, autoplay, loop, mute, volume, pause / resume integration with `Game.pause()` / `Game.resume()`, touch-to-unlock on mobile.
|
|
12
8
|
|
|
13
9
|
## Public API
|
|
14
10
|
|
|
@@ -27,8 +23,7 @@ import { resource, RESOURCE_TYPE } from '@combos-fun/engine';
|
|
|
27
23
|
| `seek` / `duration` | `number?` | |
|
|
28
24
|
| `onEnd` | `() => void?` | Fires when playback ends naturally |
|
|
29
25
|
|
|
30
|
-
Methods: `play()`, `pause()`, `stop()`. Read-only fields: `playing`,
|
|
31
|
-
`state` (`'unloaded' | 'loading' | 'loaded'`), `muted`, `volume`.
|
|
26
|
+
Methods: `play()`, `pause()`, `stop()`. Read-only fields: `playing`, `state` (`'unloaded' | 'loading' | 'loaded'`), `muted`, `volume`.
|
|
32
27
|
|
|
33
28
|
### `SoundSystemParams`
|
|
34
29
|
|
|
@@ -37,9 +32,7 @@ Methods: `play()`, `pause()`, `stop()`. Read-only fields: `playing`,
|
|
|
37
32
|
| `onError` | `(error: unknown) => void` | **Required** — TypeScript will fail without it |
|
|
38
33
|
| `autoPauseAndStart` | `boolean?` | Pause / resume audio along with `Game` |
|
|
39
34
|
|
|
40
|
-
System API: `resumeAll()`, `pauseAll()`, `stopAll()`, `muted`, `volume`,
|
|
41
|
-
`audioLocked` (true until first user gesture). Decoded `AudioBuffer`s are
|
|
42
|
-
cached per resource.
|
|
35
|
+
System API: `resumeAll()`, `pauseAll()`, `stopAll()`, `muted`, `volume`, `audioLocked` (true until first user gesture). Decoded `AudioBuffer`s are cached per resource.
|
|
43
36
|
|
|
44
37
|
### Audio resource registration
|
|
45
38
|
|
|
@@ -49,8 +42,7 @@ resource.addResource([
|
|
|
49
42
|
]);
|
|
50
43
|
```
|
|
51
44
|
|
|
52
|
-
The loader configures `mp3` / `wav` / `aac` / `ogg` as `arrayBuffer`. The
|
|
53
|
-
audio buffer is decoded once and reused.
|
|
45
|
+
The loader configures `mp3` / `wav` / `aac` / `ogg` as `arrayBuffer`. The audio buffer is decoded once and reused.
|
|
54
46
|
|
|
55
47
|
## Required setup
|
|
56
48
|
|
|
@@ -109,10 +101,7 @@ new Game({
|
|
|
109
101
|
|
|
110
102
|
## Video
|
|
111
103
|
|
|
112
|
-
`RESOURCE_TYPE.VIDEO` is supported by `@combos-fun/engine`'s loader for
|
|
113
|
-
`{ video: { type: 'mp4', url: '...' } }`, but on-canvas video playback is
|
|
114
|
-
app- or plugin-specific. After `getResource(name)`, use the resolved
|
|
115
|
-
`instance` in your video plugin or a DOM `<video>` element.
|
|
104
|
+
`RESOURCE_TYPE.VIDEO` is supported by `@combos-fun/engine`'s loader for `{ video: { type: 'mp4', url: '...' } }`, but on-canvas video playback is app- or plugin-specific. After `getResource(name)`, use the resolved `instance` in your video plugin or a DOM `<video>` element.
|
|
116
105
|
|
|
117
106
|
## Verification
|
|
118
107
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-sound",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Audio playback",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-sound.esm.js",
|
|
7
7
|
"bundle": "CombosFun.plugin.sound",
|
|
@@ -27,12 +27,18 @@
|
|
|
27
27
|
"types": "dist/plugin-sound.d.ts",
|
|
28
28
|
"keywords": [
|
|
29
29
|
"combos-fun",
|
|
30
|
-
"
|
|
30
|
+
"sound",
|
|
31
|
+
"audio",
|
|
32
|
+
"playback",
|
|
33
|
+
"volume",
|
|
34
|
+
"web-audio",
|
|
35
|
+
"sfx",
|
|
36
|
+
"bgm"
|
|
31
37
|
],
|
|
32
38
|
"author": "sun668 <q947692259@gmail.com>",
|
|
33
39
|
"dependencies": {
|
|
34
40
|
"eventemitter3": "^5.0.4",
|
|
35
|
-
"@combos-fun/engine": "0.0.
|
|
41
|
+
"@combos-fun/engine": "0.0.9"
|
|
36
42
|
},
|
|
37
43
|
"scripts": {
|
|
38
44
|
"build": "node ../../scripts/build-package.mjs"
|