@viji-dev/core 0.5.3 → 0.5.5

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/index.d.ts CHANGED
@@ -441,9 +441,17 @@ export declare class AudioSystem {
441
441
  */
442
442
  getChannelCount(): number;
443
443
  /**
444
- * Record a tap for the specified instrument onset
445
- */
446
- tapOnset(instrument: InstrumentType): void;
444
+ * Record a tap for the specified instrument onset.
445
+ * `options.skipRecognition` opts the tap out of the recognition pipeline
446
+ * only (no IOI accumulation, no `tryRecognizePattern`, no `applyPattern`).
447
+ * Mode still flips `'auto' → 'tapping'` so the visual envelope and
448
+ * audio-event filter run; only the pattern-detection pipeline is bypassed.
449
+ * Used by host-side relay of forwarded tap messages where another core
450
+ * owns the authoritative recognition.
451
+ */
452
+ tapOnset(instrument: InstrumentType, options?: {
453
+ skipRecognition?: boolean;
454
+ }): void;
447
455
  /**
448
456
  * Clear tap pattern for an instrument, restoring auto-detection
449
457
  */
@@ -467,7 +475,9 @@ export declare class AudioSystem {
467
475
  onOnsetModeChange(listener: (ev: OnsetModeChangeEvent) => void): Unsubscribe;
468
476
  onOnsetSessionEnd(listener: (ev: OnsetSessionEndEvent) => void): Unsubscribe;
469
477
  onOnsetMuteChange(listener: (ev: OnsetMuteChangeEvent) => void): Unsubscribe;
470
- exportOnsetSessionState(): SerializedOnsetState;
478
+ exportOnsetSessionState(options?: {
479
+ instruments?: ReadonlyArray<InstrumentType>;
480
+ }): SerializedOnsetState;
471
481
  importOnsetSessionState(state: SerializedOnsetState, clockOffset: number): void;
472
482
  exportAudioAnalysisState(): SerializedAudioAnalysisState;
473
483
  importAudioAnalysisState(state: SerializedAudioAnalysisState, clockOffset: number): void;
@@ -2244,7 +2254,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2244
2254
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2245
2255
  export declare type Unsubscribe = () => void;
2246
2256
 
2247
- export declare const VERSION = "0.5.3";
2257
+ export declare const VERSION = "0.5.5";
2248
2258
 
2249
2259
  /**
2250
2260
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -3015,8 +3025,25 @@ export declare class VijiCore {
3015
3025
  * Tap an onset for a specific instrument.
3016
3026
  * First tap switches the instrument from auto to tapping mode.
3017
3027
  * If a repeating pattern is recognized, it continues after tapping stops.
3028
+ *
3029
+ * `options.skipRecognition: true` opts the tap out of the **recognition
3030
+ * pipeline only** — no `tapIOIs` accumulation, no `tryRecognizePattern`,
3031
+ * no `applyPattern`, no `handlePatternTap`. Mode still flips
3032
+ * `'auto' → 'tapping'` on the first tap of a session (and back to
3033
+ * `'auto'` on the 5s timeout). The mode flip is load-bearing for
3034
+ * `processFrame`'s drain of `pendingTapEvents`, the audio-event filter
3035
+ * that prevents music+tap doubling, and `onModeChange` consumers. Use
3036
+ * `skipRecognition` when relaying tap messages from another instance
3037
+ * that owns the authoritative recognition (e.g. host receiving
3038
+ * controller taps over WebRTC); the receiving core's pattern is then
3039
+ * driven only by `importSessionState` from the authoritative sender.
3040
+ *
3041
+ * The `MIN_TAP_INTERVAL_MS` debounce still applies regardless of the
3042
+ * `skipRecognition` flag.
3018
3043
  */
3019
- tap: (instrument: "kick" | "snare" | "hat") => void;
3044
+ tap: (instrument: "kick" | "snare" | "hat", options?: {
3045
+ skipRecognition?: boolean;
3046
+ }) => void;
3020
3047
  /**
3021
3048
  * Clear the tap pattern for an instrument, restoring auto-detection
3022
3049
  */
@@ -3095,8 +3122,22 @@ export declare class VijiCore {
3095
3122
  * Cross-device-safe (no audio analysis state included). Pair with
3096
3123
  * `importSessionState` on a receiver. Wall-clock fields are in this
3097
3124
  * instance's `performance.now()` clock space.
3125
+ *
3126
+ * `options.instruments` scopes the snapshot to the listed instruments
3127
+ * only; omitted instruments are absent from the payload. The receiver
3128
+ * leaves its existing state for those instruments untouched (the
3129
+ * receiver's `applyInstrumentPayload` skips missing keys). Default =
3130
+ * all three.
3131
+ *
3132
+ * Cross-device commits should typically scope to the just-completed
3133
+ * instrument (e.g. `exportSessionState({ instruments: [ev.instrument] })`
3134
+ * inside an `onSessionEnd` handler) so the receiver's unrelated
3135
+ * instrument state isn't inadvertently overwritten by the sender's
3136
+ * default values.
3098
3137
  */
3099
- exportSessionState: () => SerializedOnsetState;
3138
+ exportSessionState: (options?: {
3139
+ instruments?: ReadonlyArray<"kick" | "snare" | "hat">;
3140
+ }) => SerializedOnsetState;
3100
3141
  /**
3101
3142
  * Replace per-instrument onset state from a serialized payload.
3102
3143
  * `clockOffset` is added to all sender-clocked fields during import
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, V, a, b } from "./index-Bhq4eJe_.js";
1
+ import { A, V, a, b } from "./index-DsJxKERc.js";
2
2
  export {
3
3
  A as AudioSystem,
4
4
  V as VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viji-dev/core",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Universal execution engine for Viji Creative scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",