@msb235/blits 0.3.0 → 0.4.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/dist/mixer.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type Curve } from './easing.js';
2
+ import { type Motions } from './motion.js';
2
3
  import { type Built, intosOf, type Scratch } from './patch.js';
3
4
  import { Store } from './store.js';
4
5
  import type { Channel, Engine, FadeSpec, Kit, Mix, MixOptions, Patch, Setting, VoiceSpec } from './types.js';
@@ -8,8 +9,10 @@ export interface Subject<S> {
8
9
  reaches: boolean;
9
10
  /** The voice's `stagger` answer in voice ms, fixed on first sight. */
10
11
  delay: number;
11
- /** The mix timestamp this subject's delay ran out at, which its fade in counts from. */
12
+ /** The mix timestamp this subject's delay ran out at, which its step grid counts from. */
12
13
  since: number;
14
+ /** The mix timestamp its fade in counts from: `since`, or earlier for a voice holding before. */
15
+ shown: number;
13
16
  /** The weight this voice gave this subject the last frame it was probed, 0 where it gave none. */
14
17
  weight: number;
15
18
  /** Left at rest during a handover, so it stops contributing. */
@@ -102,7 +105,7 @@ export declare class Voice<I, O> {
102
105
  readonly patch: Patch<I, O, unknown>;
103
106
  readonly fade: FadeSpec;
104
107
  start: number;
105
- state: 'pending' | 'live' | 'fading' | 'done';
108
+ state: 'pending' | 'live' | 'held' | 'fading' | 'done';
106
109
  rate: number;
107
110
  weight: number;
108
111
  /**
@@ -144,9 +147,31 @@ export declare class Voice<I, O> {
144
147
  keeping: boolean;
145
148
  /** For a motion patch, the hook it was given to ask the mix for its subjects' voice time. */
146
149
  frame: ((subject: I) => number) | null;
150
+ /** For a motion patch, the hook it was given to bring a subject faded out of this voice back. */
151
+ revive: ((subject: I) => void) | null;
152
+ /** Subjects fading out of this voice alone, by the ramp each started; null while none are. */
153
+ parts: Map<I, {
154
+ at: number;
155
+ over: number;
156
+ }> | null;
157
+ /** Subjects faded out of this voice, by the mix time each left at; null while none have. */
158
+ parted: Map<I, number> | null;
147
159
  readonly ease: Curve | undefined;
148
160
  /** How many passes its `loop` plays, worked out once. */
149
161
  readonly passes: number;
162
+ /** Voice ms its passes last, Infinity for an aperiodic patch or a loop for good. */
163
+ readonly span: number;
164
+ /** The state behind a motion patch, undefined for any other. */
165
+ readonly motion: Motions<I> | undefined;
166
+ /** Its `hold`, for a patch it applies to: motion holds its target already. */
167
+ readonly holdsBefore: boolean;
168
+ readonly holdsAfter: boolean;
169
+ /** The mix time it first showed: when it was cued, or the first sync after. */
170
+ opened: number;
171
+ /** Which of its entries in the mix's due queue is current; older ones are skipped when popped. */
172
+ dueToken: number;
173
+ /** Records made while it was pending, whose `since` its start may since have moved. */
174
+ early: Subject<unknown>[] | null;
150
175
  /** Reused for every call this voice makes, so it is valid only during the call. */
151
176
  readonly setting: Setting<unknown>;
152
177
  /** Every subject this voice has been asked about, so a handover knows when it is finished. */
@@ -166,6 +191,8 @@ export declare class Voice<I, O> {
166
191
  placing: boolean;
167
192
  resolve: () => void;
168
193
  readonly done: Promise<void>;
194
+ play: (played: boolean) => void;
195
+ readonly played: Promise<boolean>;
169
196
  constructor(id: number, spec: VoiceSpec<I, O>, patch: Patch<I, O, unknown>, fade: FadeSpec, now: number, start: number, slotOf: Map<string, number>, channels: readonly Channel<unknown>[], host: unknown, send: (event: unknown) => void);
170
197
  elapsedAt(now: number): number;
171
198
  /** The mix time its clock reads `elapsed`, inverting `elapsedAt`; Infinity where it never will. */