audio-mixer-ui 0.9.0 → 0.9.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.
- package/dist/audio-mixer-ui.js +32 -20
- package/dist/audio-mixer-ui.umd.cjs +1 -1
- 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,51 @@ 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
|
+
try {
|
|
3755
|
+
l.disconnect();
|
|
3756
|
+
} catch {
|
|
3757
|
+
}
|
|
3758
|
+
this.metronomeMasterGain = this.audioEngine.audioContext.createGain(), this.metronomeMasterGain.gain.value = 1, l.connect(this.metronomeMasterGain), console.log("Metronome master gain node created and connected");
|
|
3759
|
+
}
|
|
3760
|
+
/**
|
|
3761
|
+
* Set up silent calibration (set gain to 0 for inaudible measurement)
|
|
3762
|
+
* @private
|
|
3763
|
+
*/
|
|
3764
|
+
async _setupSilentCalibration() {
|
|
3765
|
+
if (!this.metronomeMasterGain)
|
|
3766
|
+
throw new Error("Metronome master gain not available for calibration");
|
|
3767
|
+
this.metronomeMasterGain.gain.value = 0, console.log("Silent calibration active (gain=0)");
|
|
3751
3768
|
}
|
|
3752
3769
|
/**
|
|
3753
|
-
* Tear down silent calibration
|
|
3754
|
-
* Disconnects from the silent gain node
|
|
3770
|
+
* Tear down silent calibration (restore gain to 1 for normal operation)
|
|
3755
3771
|
* @private
|
|
3756
3772
|
*/
|
|
3757
3773
|
_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
|
-
}
|
|
3774
|
+
this.metronomeMasterGain && (this.metronomeMasterGain.gain.value = 1, console.log("Silent calibration ended (gain=1)"));
|
|
3765
3775
|
}
|
|
3766
3776
|
// ========================================
|
|
3767
3777
|
// PUBLIC API - Audio Routing
|
|
3768
3778
|
// ========================================
|
|
3769
3779
|
/**
|
|
3770
3780
|
* Get metronome output node for mixer routing
|
|
3771
|
-
*
|
|
3781
|
+
* Returns the master gain node which allows silent calibration via gain control
|
|
3782
|
+
* @returns {AudioNode} Metronome master gain node (or raw output if not set up)
|
|
3772
3783
|
*/
|
|
3773
3784
|
getMetronomeOutput() {
|
|
3774
|
-
|
|
3785
|
+
var l;
|
|
3786
|
+
return this.metronomeMasterGain || ((l = this.audioEngine) == null ? void 0 : l.getMetronomeOutput());
|
|
3775
3787
|
}
|
|
3776
3788
|
/**
|
|
3777
3789
|
* Get MIDI part output (delegates to MidiPlayer)
|
|
@@ -4259,7 +4271,7 @@ class jU {
|
|
|
4259
4271
|
* Clean up resources and destroy the manager
|
|
4260
4272
|
*/
|
|
4261
4273
|
destroy() {
|
|
4262
|
-
this.stop(), this._stopLeadIn(), this._stopMetronome(), this._stopTimeUpdateLoop(), this.
|
|
4274
|
+
this.stop(), this._stopLeadIn(), this._stopMetronome(), this._stopTimeUpdateLoop(), this.metronomeMasterGain && (this.metronomeMasterGain.disconnect(), this.metronomeMasterGain = null), this.eventBus.all.clear();
|
|
4263
4275
|
}
|
|
4264
4276
|
// ========================================
|
|
4265
4277
|
// PRIVATE HELPER METHODS
|