scratch-audio
Advanced tools
Comparing version 0.1.0-prerelease.20190114210212 to 0.1.0-prerelease.20190925183642
{ | ||
"name": "scratch-audio", | ||
"version": "0.1.0-prerelease.20190114210212", | ||
"version": "0.1.0-prerelease.20190925183642", | ||
"description": "audio engine for scratch 3.0", | ||
@@ -5,0 +5,0 @@ "main": "dist.js", |
@@ -45,5 +45,4 @@ const Effect = require('./Effect'); | ||
const {gain} = this.outputNode; | ||
const {currentTime, DECAY_WAIT, DECAY_DURATION} = this.audioEngine; | ||
gain.setValueAtTime(gain.value, currentTime + DECAY_WAIT); | ||
gain.linearRampToValueAtTime(value / 100, currentTime + DECAY_WAIT + DECAY_DURATION); | ||
const {currentTime, DECAY_DURATION} = this.audioEngine; | ||
gain.linearRampToValueAtTime(value / 100, currentTime + DECAY_DURATION); | ||
} | ||
@@ -50,0 +49,0 @@ |
@@ -302,4 +302,4 @@ const {EventEmitter} = require('events'); | ||
taken.volumeEffect.set(0); | ||
const {currentTime, DECAY_WAIT, DECAY_DURATION} = this.audioEngine; | ||
taken.outputNode.stop(currentTime + DECAY_WAIT + DECAY_DURATION); | ||
const {currentTime, DECAY_DURATION} = this.audioEngine; | ||
taken.outputNode.stop(currentTime + DECAY_DURATION); | ||
} | ||
@@ -306,0 +306,0 @@ |
@@ -74,3 +74,3 @@ /* global Uint8Array Promise */ | ||
suite.test('stop decay', t => { | ||
t.plan(7); | ||
t.plan(5); | ||
soundPlayer.play(); | ||
@@ -92,9 +92,6 @@ soundPlayer.connect(audioEngine); | ||
audioContext.$processTo(audioEngine.DECAY_WAIT + audioEngine.DECAY_DURATION / 2); | ||
const engineInputs = help.engineInputs; | ||
t.notEqual(engineInputs[0].gain.value, 1, 'gain value should not be 1'); | ||
t.notEqual(engineInputs[0].gain.value, 0, 'gain value should not be 0'); | ||
audioContext.$processTo(audioEngine.DECAY_DURATION / 2); | ||
t.equal(outputNode.$state, 'PLAYING'); | ||
audioContext.$processTo(audioEngine.DECAY_WAIT + audioEngine.DECAY_DURATION + 0.001); | ||
audioContext.$processTo(audioEngine.DECAY_DURATION + 0.001); | ||
t.deepEqual(help.engineInputs, [{ | ||
@@ -101,0 +98,0 @@ name: 'GainNode', |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
600980
4716