audio-mixer-engine 1.3.4 → 1.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "audio-mixer-engine",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Audio engine library for audio mixer applications with MIDI parsing, playback, and synthesis",
5
5
  "main": "dist/audio-mixer-engine.cjs.js",
6
6
  "module": "dist/audio-mixer-engine.es.js",
@@ -446,26 +446,29 @@ export default class PlaybackManager {
446
446
  stop() {
447
447
  if (this.state === 'stopped') return;
448
448
 
449
- const wasPlaying = this.state === 'playing';
450
- this.state = 'stopped';
451
- this.frozenTime = 0;
452
- this.leadInData = null;
453
- this.leadInProgress = null;
454
- this.leadInStartTime = null;
449
+ const previousState = this.state;
455
450
 
456
- // Stop all scheduling
451
+ // Apply the same per-state cleanup as pause()
452
+ if (previousState === 'lead-in') {
453
+ this._pauseLeadIn();
454
+ } else if (previousState === 'playing') {
455
+ this.midiPlayer.pause();
456
+ this._stopMetronome();
457
+ }
457
458
  this._stopLeadIn();
458
- this._stopMetronome();
459
459
  this._stopTimeUpdateLoop();
460
460
 
461
- // Reset metronome tracking
462
- this._resetMetronomeBeatTracking();
463
-
464
- // Stop MIDI player only if it was actually playing
465
- if (wasPlaying) {
466
- this.midiPlayer.stop();
461
+ // Reset to beginning
462
+ this.frozenTime = 0;
463
+ this.leadInData = null;
464
+ this.leadInProgress = null;
465
+ this.leadInStartTime = null;
466
+ if (this.midiPlayer) {
467
+ this.midiPlayer.skipToTime(0);
467
468
  }
469
+ this._resetMetronomeBeatTracking();
468
470
 
471
+ this.state = 'stopped';
469
472
  this._emitEvent('playbackStopped', {});
470
473
  }
471
474