audio-mixer-ui 0.9.0 → 0.9.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/audio-mixer-ui.js +33 -20
- package/dist/audio-mixer-ui.umd.cjs +9 -9
- package/package.json +2 -2
package/dist/audio-mixer-ui.js
CHANGED
|
@@ -3339,7 +3339,7 @@ class jU {
|
|
|
3339
3339
|
}, this.startupConfig = {
|
|
3340
3340
|
delayMs: 25,
|
|
3341
3341
|
...U.startup
|
|
3342
|
-
}, this.state = "reset", this.frozenTime = 0, this.leadInData = null, this.leadInStartTime = null, this.leadInProgress = null, this.leadInInterval = null, this.timeUpdateInterval = null, this.metronomeScheduleInterval = null, this.nextBeatIndex = 0, this.measuredLatencyMs = null, this.latencyMeasurements = [], this.isCalibrating = !1, this.baselineLatencyMs = null, this.
|
|
3342
|
+
}, this.state = "reset", this.frozenTime = 0, this.leadInData = null, this.leadInStartTime = null, this.leadInProgress = null, this.leadInInterval = null, this.timeUpdateInterval = null, this.metronomeScheduleInterval = null, this.nextBeatIndex = 0, this.measuredLatencyMs = null, this.latencyMeasurements = [], this.isCalibrating = !1, this.baselineLatencyMs = null, this.metronomeMasterGain = null, this._validateConfig(), this._loadBaselineLatency(), this._audioEngineReady && this._setupMetronomeMasterGain(), this.midiPlayer && this._completeMidiPlayerSetup();
|
|
3343
3343
|
}
|
|
3344
3344
|
// ========================================
|
|
3345
3345
|
// PUBLIC API - Initialization Methods
|
|
@@ -3352,7 +3352,7 @@ class jU {
|
|
|
3352
3352
|
setAudioEngine(l) {
|
|
3353
3353
|
if (!l || !l.isInitialized)
|
|
3354
3354
|
throw new Error("An initialized AudioEngine is required");
|
|
3355
|
-
this.audioEngine = l, this._audioEngineReady = !0, this.parsedData && !this.midiPlayer && this._setupPlayerWithAudio();
|
|
3355
|
+
this.audioEngine = l, this._audioEngineReady = !0, this._setupMetronomeMasterGain(), this.parsedData && !this.midiPlayer && this._setupPlayerWithAudio();
|
|
3356
3356
|
}
|
|
3357
3357
|
/**
|
|
3358
3358
|
* Check if audio engine is ready for playback
|
|
@@ -3739,39 +3739,52 @@ class jU {
|
|
|
3739
3739
|
}
|
|
3740
3740
|
}
|
|
3741
3741
|
/**
|
|
3742
|
-
* Set up
|
|
3743
|
-
*
|
|
3742
|
+
* Set up metronome master gain node (permanently in audio chain)
|
|
3743
|
+
* This node sits between the audio engine's metronome output and external connections
|
|
3744
3744
|
* @private
|
|
3745
3745
|
*/
|
|
3746
|
-
|
|
3746
|
+
_setupMetronomeMasterGain() {
|
|
3747
|
+
if (!this._audioEngineReady || this.metronomeMasterGain)
|
|
3748
|
+
return;
|
|
3747
3749
|
const l = this.audioEngine.getMetronomeOutput();
|
|
3748
|
-
if (!l)
|
|
3749
|
-
|
|
3750
|
-
|
|
3750
|
+
if (!l) {
|
|
3751
|
+
console.warn("Metronome output not available - master gain not created");
|
|
3752
|
+
return;
|
|
3753
|
+
}
|
|
3754
|
+
const U = this.audioEngine.getMetronomeAnalyser();
|
|
3755
|
+
try {
|
|
3756
|
+
l.disconnect();
|
|
3757
|
+
} catch {
|
|
3758
|
+
}
|
|
3759
|
+
this.metronomeMasterGain = this.audioEngine.audioContext.createGain(), this.metronomeMasterGain.gain.value = 1, l.connect(this.metronomeMasterGain), U ? (l.connect(U), console.log("Metronome master gain node created and connected (analyser reconnected)")) : console.log("Metronome master gain node created and connected (no analyser)");
|
|
3751
3760
|
}
|
|
3752
3761
|
/**
|
|
3753
|
-
*
|
|
3754
|
-
*
|
|
3762
|
+
* Set up silent calibration (set gain to 0 for inaudible measurement)
|
|
3763
|
+
* @private
|
|
3764
|
+
*/
|
|
3765
|
+
async _setupSilentCalibration() {
|
|
3766
|
+
if (!this.metronomeMasterGain)
|
|
3767
|
+
throw new Error("Metronome master gain not available for calibration");
|
|
3768
|
+
this.metronomeMasterGain.gain.value = 0, console.log("Silent calibration active (gain=0)");
|
|
3769
|
+
}
|
|
3770
|
+
/**
|
|
3771
|
+
* Tear down silent calibration (restore gain to 1 for normal operation)
|
|
3755
3772
|
* @private
|
|
3756
3773
|
*/
|
|
3757
3774
|
_teardownSilentCalibration() {
|
|
3758
|
-
|
|
3759
|
-
if (!(!l || !this.silentGainNode))
|
|
3760
|
-
try {
|
|
3761
|
-
l.disconnect(this.silentGainNode), console.log("Silent calibration torn down");
|
|
3762
|
-
} catch (U) {
|
|
3763
|
-
console.warn("Error disconnecting silent calibration:", U);
|
|
3764
|
-
}
|
|
3775
|
+
this.metronomeMasterGain && (this.metronomeMasterGain.gain.value = 1, console.log("Silent calibration ended (gain=1)"));
|
|
3765
3776
|
}
|
|
3766
3777
|
// ========================================
|
|
3767
3778
|
// PUBLIC API - Audio Routing
|
|
3768
3779
|
// ========================================
|
|
3769
3780
|
/**
|
|
3770
3781
|
* Get metronome output node for mixer routing
|
|
3771
|
-
*
|
|
3782
|
+
* Returns the master gain node which allows silent calibration via gain control
|
|
3783
|
+
* @returns {AudioNode} Metronome master gain node (or raw output if not set up)
|
|
3772
3784
|
*/
|
|
3773
3785
|
getMetronomeOutput() {
|
|
3774
|
-
|
|
3786
|
+
var l;
|
|
3787
|
+
return this.metronomeMasterGain || ((l = this.audioEngine) == null ? void 0 : l.getMetronomeOutput());
|
|
3775
3788
|
}
|
|
3776
3789
|
/**
|
|
3777
3790
|
* Get MIDI part output (delegates to MidiPlayer)
|
|
@@ -4259,7 +4272,7 @@ class jU {
|
|
|
4259
4272
|
* Clean up resources and destroy the manager
|
|
4260
4273
|
*/
|
|
4261
4274
|
destroy() {
|
|
4262
|
-
this.stop(), this._stopLeadIn(), this._stopMetronome(), this._stopTimeUpdateLoop(), this.
|
|
4275
|
+
this.stop(), this._stopLeadIn(), this._stopMetronome(), this._stopTimeUpdateLoop(), this.metronomeMasterGain && (this.metronomeMasterGain.disconnect(), this.metronomeMasterGain = null), this.eventBus.all.clear();
|
|
4263
4276
|
}
|
|
4264
4277
|
// ========================================
|
|
4265
4278
|
// PRIVATE HELPER METHODS
|