diff --git a/6502.js b/6502.js index 163010cc..64bb9563 100644 --- a/6502.js +++ b/6502.js @@ -936,6 +936,7 @@ define(['./utils', './6502.opcodes', './via', './acia', './serial', './tube', '. this.touchScreen = new TouchScreen(this.scheduler); this.acia = new Acia(this, this.soundChip.toneGenerator, this.scheduler, this.touchScreen); this.serial = new Serial(this.acia); + this.ddNoise.spinDown(); this.fdc = new model.Fdc(this, this.ddNoise, this.scheduler); this.crtc = this.video.crtc; this.ula = this.video.ula; diff --git a/ddnoise.js b/ddnoise.js index e278e6fc..d93d9eaf 100644 --- a/ddnoise.js +++ b/ddnoise.js @@ -88,6 +88,11 @@ define(['./utils', 'underscore', 'promise'], function (utils, _) { this.state = SPIN_UP; var self = this; this.play(this.sounds.motorOn).then(function () { + // Handle race: we may have had spinDown() called on us before the + // spinUp() initial sound finished playing. + if (self.state === IDLE) { + return; + } self.play(self.sounds.motor, true).then(function (source) { self.motor = source; self.state = SPINNING;