@solidrt/flux-types 0.0.23 → 0.0.24

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.md CHANGED
@@ -47,7 +47,7 @@ rely on must be named.
47
47
  - `Flux` global (`version`, `capabilities`).
48
48
  - `flux:*` modules: `flux:http`, `flux:fs`, `flux:sqlite`, `flux:subprocess`,
49
49
  `flux:p2p`, `flux:process`, `flux:path`, and (on a gui-enabled runtime)
50
- `flux:camera`, `flux:microphone`, `flux:gpu`.
50
+ `flux:camera`, `flux:microphone`, `flux:audio`, `flux:gpu`.
51
51
  - Web-standard globals: `console`, `fetch` + `Headers`/`Request`/`Response`,
52
52
  `setTimeout`/`setInterval`/`queueMicrotask`, `performance`, `WebSocket`,
53
53
  `TextEncoder`/`TextDecoder`. These are deliberate subsets matching exactly what
package/gui/audio.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ // Sound playback (gui-enabled runtime only). The imperative primitive; `play`
2
+ // decodes an encoded clip (Ogg/Vorbis or WAV) and returns a handle whose
3
+ // `stop()` halts just that sound, so the raw track id never leaves the runtime.
4
+
5
+ declare module "flux:audio" {
6
+ /** Options for {@link play}. */
7
+ type PlayOptions = {
8
+ /** Repeat the clip until stopped. Defaults to false. */
9
+ loop?: boolean
10
+ /** Volume scale, 1.0 leaves the clip unchanged. Defaults to 1.0. */
11
+ gain?: number
12
+ }
13
+
14
+ /** A playing sound with controls bound to it. */
15
+ type SoundHandle = {
16
+ /** Stop this sound. A no-op if it already finished. */
17
+ stop(): void
18
+ }
19
+
20
+ /**
21
+ * Decode and start an encoded audio clip (Ogg/Vorbis or WAV). Returns
22
+ * immediately; the sound plays on the mixer's own thread.
23
+ */
24
+ export function play(bytes: Uint8Array, options?: PlayOptions): SoundHandle
25
+ /** Stop every playing sound. */
26
+ export function stopAll(): void
27
+ }
package/index.d.ts CHANGED
@@ -25,6 +25,7 @@
25
25
  /// <reference path="./gui/rendertree.d.ts" />
26
26
  /// <reference path="./gui/camera.d.ts" />
27
27
  /// <reference path="./gui/microphone.d.ts" />
28
+ /// <reference path="./gui/audio.d.ts" />
28
29
  /// <reference path="./gui/gpu.d.ts" />
29
30
  /// <reference path="./gui/raf.d.ts" />
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidrt/flux-types",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "license": "MIT",
5
5
  "author": "Antoine van Wel",
6
6
  "types": "index.d.ts",