Make a constant for speech volume

This commit is contained in:
Eric Rosenbaum 2018-09-05 18:36:01 -04:00
parent fe746a7c43
commit 36711931b2

View file

@ -19,6 +19,12 @@ const SERVER_HOST = 'https://synthesis-service.scratch.mit.edu';
*/ */
const SERVER_TIMEOUT = 10000; // 10 seconds const SERVER_TIMEOUT = 10000; // 10 seconds
/**
* Volume for playback of speech sounds, as a percentage.
* @type {number}
*/
const SPEECH_VOLUME = 250;
/** /**
* An id for one of the voices. * An id for one of the voices.
*/ */
@ -357,7 +363,7 @@ class Scratch3SpeakBlocks {
// Increase the volume // Increase the volume
const engine = this.runtime.audioEngine; const engine = this.runtime.audioEngine;
const chain = engine.createEffectChain(); const chain = engine.createEffectChain();
chain.set('volume', 250); chain.set('volume', SPEECH_VOLUME);
soundPlayer.connect(chain); soundPlayer.connect(chain);
soundPlayer.play(); soundPlayer.play();