@sharpee/media 1.0.8 → 1.1.1

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 (2) hide show
  1. package/README.md +68 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @sharpee/media
2
+
3
+ Audio and media type definitions for the Sharpee Interactive Fiction platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @sharpee/media
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ - **Types only** - audio type definitions with no runtime dependencies beyond `@sharpee/core` (ADR-138).
14
+ - **Audio events** - typed event interfaces for sound effects, music, ambient loops, and procedural/effect signals.
15
+ - **Capabilities & preferences** - `AudioCapabilities` (what a client supports) and `AudioPreferences` (volume/mute state).
16
+ - **`AudioRegistry`** - registry for audio assets and recipes.
17
+ - Importing this package activates TypeScript declaration merging that adds audio event keys to `@sharpee/core`'s `EventDataRegistry`.
18
+
19
+ ## Usage
20
+
21
+ ```typescript
22
+ import type {
23
+ AudioEvent,
24
+ AudioSfxEvent,
25
+ AudioMusicPlayEvent,
26
+ AudioCapabilities,
27
+ AudioPreferences,
28
+ Volume,
29
+ AudioAssetPath,
30
+ } from '@sharpee/media';
31
+ import { isAudioEvent } from '@sharpee/media';
32
+
33
+ // Narrow an incoming event to an audio event
34
+ function handle(event: AudioEvent) {
35
+ if (isAudioEvent(event)) {
36
+ // dispatch to the client's audio subsystem
37
+ }
38
+ }
39
+
40
+ // Describe what a client supports and how the player prefers to hear it
41
+ const capabilities: AudioCapabilities = { /* client audio support flags */ };
42
+ const preferences: AudioPreferences = { /* volumes, mute state */ };
43
+ ```
44
+
45
+ Stories emit audio events through the engine; clients (such as the browser
46
+ `AudioManager`) consume them, filtered by the client's `AudioCapabilities`
47
+ and the player's `AudioPreferences`. This package only defines the shapes —
48
+ playback behavior lives in the client.
49
+
50
+ ## Key Exports
51
+
52
+ | Export | Description |
53
+ |--------|-------------|
54
+ | `AudioEvent` and variants | Sfx, music play/stop, ambient play/stop, procedural, effect, effect-clear event interfaces |
55
+ | `isAudioEvent` | Type guard for audio events |
56
+ | `AudioCapabilities`, `AudioPreferences` | Client support flags and player preferences |
57
+ | `Volume`, `DurationMs`, `StereoPan`, `PlaybackRate`, `AudioAssetPath`, `AudioFormat`, `AudioTarget` | Audio scalar/branded types |
58
+ | `AudioRegistry` | Registry of audio assets and recipes |
59
+
60
+ ## Related Packages
61
+
62
+ - [@sharpee/core](https://www.npmjs.com/package/@sharpee/core) - Core types and event registry
63
+ - [@sharpee/platform-browser](https://www.npmjs.com/package/@sharpee/platform-browser) - Browser client with `AudioManager`
64
+ - [@sharpee/sharpee](https://www.npmjs.com/package/@sharpee/sharpee) - Full platform bundle
65
+
66
+ ## License
67
+
68
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/media",
3
- "version": "1.0.8",
3
+ "version": "1.1.1",
4
4
  "description": "Audio and media type definitions for Sharpee Interactive Fiction Platform",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^1.0.8"
15
+ "@sharpee/core": "^1.1.1"
16
16
  },
17
17
  "keywords": [
18
18
  "interactive-fiction",