@viji-dev/core 0.5.1 → 0.5.2
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/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +1 -1
- package/dist/artist-global.d.ts +1 -1
- package/dist/docs-api.js +47 -37
- package/dist/{essentia-wasm.web-x6zu4Vib.js → essentia-wasm.web-DE6gem4m.js} +2 -2
- package/dist/{essentia-wasm.web-x6zu4Vib.js.map → essentia-wasm.web-DE6gem4m.js.map} +1 -1
- package/dist/{index-Cqh1k_49.js → index-B8LJ9m47.js} +51 -3
- package/dist/index-B8LJ9m47.js.map +1 -0
- package/dist/index.d.ts +22 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/index-Cqh1k_49.js.map +0 -1
|
@@ -1897,7 +1897,7 @@ class EssentiaOnsetDetection {
|
|
|
1897
1897
|
this.initPromise = (async () => {
|
|
1898
1898
|
try {
|
|
1899
1899
|
const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
|
|
1900
|
-
const wasmModule = await import("./essentia-wasm.web-
|
|
1900
|
+
const wasmModule = await import("./essentia-wasm.web-DE6gem4m.js").then((n) => n.e);
|
|
1901
1901
|
const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
|
|
1902
1902
|
let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
|
|
1903
1903
|
if (!WASMModule) {
|
|
@@ -6178,6 +6178,7 @@ class OnsetTapManager {
|
|
|
6178
6178
|
};
|
|
6179
6179
|
modeChangeListeners = /* @__PURE__ */ new Set();
|
|
6180
6180
|
sessionEndListeners = /* @__PURE__ */ new Set();
|
|
6181
|
+
muteChangeListeners = /* @__PURE__ */ new Set();
|
|
6181
6182
|
suppressEmissions = false;
|
|
6182
6183
|
tap(instrument) {
|
|
6183
6184
|
const s = this.state[instrument];
|
|
@@ -6185,6 +6186,9 @@ class OnsetTapManager {
|
|
|
6185
6186
|
if (s.muted) {
|
|
6186
6187
|
s.muted = false;
|
|
6187
6188
|
s.mutedAt = 0;
|
|
6189
|
+
if (!this.suppressEmissions) {
|
|
6190
|
+
this.fireMuteChange({ instrument, prevMuted: true, muted: false });
|
|
6191
|
+
}
|
|
6188
6192
|
}
|
|
6189
6193
|
let ioi = -1;
|
|
6190
6194
|
if (s.lastTapTime > 0) {
|
|
@@ -6221,6 +6225,7 @@ class OnsetTapManager {
|
|
|
6221
6225
|
}
|
|
6222
6226
|
clear(instrument) {
|
|
6223
6227
|
const s = this.state[instrument];
|
|
6228
|
+
const prevMuted = s.muted;
|
|
6224
6229
|
this.cancelSessionTimers(s);
|
|
6225
6230
|
s.sessionActive = false;
|
|
6226
6231
|
this.setMode(instrument, "auto");
|
|
@@ -6236,6 +6241,9 @@ class OnsetTapManager {
|
|
|
6236
6241
|
s.pendingTapEvents = [];
|
|
6237
6242
|
s.envelope.reset();
|
|
6238
6243
|
s.envelopeSmoothed.reset();
|
|
6244
|
+
if (prevMuted && !this.suppressEmissions) {
|
|
6245
|
+
this.fireMuteChange({ instrument, prevMuted: true, muted: false });
|
|
6246
|
+
}
|
|
6239
6247
|
}
|
|
6240
6248
|
getMode(instrument) {
|
|
6241
6249
|
return this.state[instrument].mode;
|
|
@@ -6252,6 +6260,7 @@ class OnsetTapManager {
|
|
|
6252
6260
|
setMuted(instrument, muted) {
|
|
6253
6261
|
const s = this.state[instrument];
|
|
6254
6262
|
if (s.muted === muted) return;
|
|
6263
|
+
const prevMuted = s.muted;
|
|
6255
6264
|
const now = performance.now();
|
|
6256
6265
|
if (muted) {
|
|
6257
6266
|
s.muted = true;
|
|
@@ -6264,6 +6273,9 @@ class OnsetTapManager {
|
|
|
6264
6273
|
s.lastTapTime += pauseDuration;
|
|
6265
6274
|
}
|
|
6266
6275
|
}
|
|
6276
|
+
if (!this.suppressEmissions) {
|
|
6277
|
+
this.fireMuteChange({ instrument, prevMuted, muted: s.muted });
|
|
6278
|
+
}
|
|
6267
6279
|
}
|
|
6268
6280
|
isMuted(instrument) {
|
|
6269
6281
|
return this.state[instrument].muted;
|
|
@@ -6283,6 +6295,12 @@ class OnsetTapManager {
|
|
|
6283
6295
|
this.sessionEndListeners.delete(listener);
|
|
6284
6296
|
};
|
|
6285
6297
|
}
|
|
6298
|
+
onMuteChange(listener) {
|
|
6299
|
+
this.muteChangeListeners.add(listener);
|
|
6300
|
+
return () => {
|
|
6301
|
+
this.muteChangeListeners.delete(listener);
|
|
6302
|
+
};
|
|
6303
|
+
}
|
|
6286
6304
|
// ─────────────────────────────────────────────────────────────────────────
|
|
6287
6305
|
// State serialization
|
|
6288
6306
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -6495,6 +6513,15 @@ class OnsetTapManager {
|
|
|
6495
6513
|
}
|
|
6496
6514
|
}
|
|
6497
6515
|
}
|
|
6516
|
+
fireMuteChange(ev) {
|
|
6517
|
+
for (const listener of this.muteChangeListeners) {
|
|
6518
|
+
try {
|
|
6519
|
+
listener(ev);
|
|
6520
|
+
} catch (err) {
|
|
6521
|
+
console.error("Error in onMuteChange listener:", err);
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6498
6525
|
/**
|
|
6499
6526
|
* Schedule (or reschedule) the per-instrument session timers on every tap.
|
|
6500
6527
|
* 500ms timer fires `'pattern'` outcome if instrument is in pattern mode at
|
|
@@ -8515,6 +8542,9 @@ class AudioSystem {
|
|
|
8515
8542
|
onOnsetSessionEnd(listener) {
|
|
8516
8543
|
return this.onsetTapManager.onSessionEnd(listener);
|
|
8517
8544
|
}
|
|
8545
|
+
onOnsetMuteChange(listener) {
|
|
8546
|
+
return this.onsetTapManager.onMuteChange(listener);
|
|
8547
|
+
}
|
|
8518
8548
|
// ─────────────────────────────────────────────────────────────────────────
|
|
8519
8549
|
// State serialization. Onset-only export is cross-device-safe; the full
|
|
8520
8550
|
// audio block is for same-process scene-switch transfer (sender's audio
|
|
@@ -11146,6 +11176,24 @@ class VijiCore {
|
|
|
11146
11176
|
return this.audioSystem?.onOnsetSessionEnd(listener) ?? (() => {
|
|
11147
11177
|
});
|
|
11148
11178
|
},
|
|
11179
|
+
/**
|
|
11180
|
+
* Listen for instrument mute-state transitions (`true ↔ false`). Fires
|
|
11181
|
+
* whenever the underlying mute state actually changes, regardless of
|
|
11182
|
+
* which method triggered it:
|
|
11183
|
+
* - `setMuted(instrument, muted)` when `prev !== next`
|
|
11184
|
+
* - `tap(instrument)` auto-unmute on first tap of a muted instrument
|
|
11185
|
+
* - `clear(instrument)` when the instrument was muted
|
|
11186
|
+
*
|
|
11187
|
+
* Idempotent calls (e.g. `setMuted(true)` on an already-muted instrument)
|
|
11188
|
+
* do not fire. Imported state does NOT fire either.
|
|
11189
|
+
*
|
|
11190
|
+
* @returns Unsubscribe function. Call to remove the listener.
|
|
11191
|
+
*/
|
|
11192
|
+
onMuteChange: (listener) => {
|
|
11193
|
+
this.validateReady();
|
|
11194
|
+
return this.audioSystem?.onOnsetMuteChange(listener) ?? (() => {
|
|
11195
|
+
});
|
|
11196
|
+
},
|
|
11149
11197
|
/**
|
|
11150
11198
|
* Snapshot per-instrument onset state for cross-instance transfer.
|
|
11151
11199
|
* Cross-device-safe (no audio analysis state included). Pair with
|
|
@@ -11581,7 +11629,7 @@ function validateCoreStatePayload(state) {
|
|
|
11581
11629
|
}
|
|
11582
11630
|
return null;
|
|
11583
11631
|
}
|
|
11584
|
-
const VERSION = "0.5.
|
|
11632
|
+
const VERSION = "0.5.2";
|
|
11585
11633
|
export {
|
|
11586
11634
|
AudioSystem as A,
|
|
11587
11635
|
VERSION as V,
|
|
@@ -11589,4 +11637,4 @@ export {
|
|
|
11589
11637
|
VijiCoreError as b,
|
|
11590
11638
|
getDefaultExportFromCjs as g
|
|
11591
11639
|
};
|
|
11592
|
-
//# sourceMappingURL=index-
|
|
11640
|
+
//# sourceMappingURL=index-B8LJ9m47.js.map
|