mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 22:12:48 -05:00
fixes to stop all
This commit is contained in:
parent
a89ab4b25d
commit
173c243439
1 changed files with 9 additions and 4 deletions
|
@ -17,7 +17,6 @@ function AudioEngine (sounds) {
|
||||||
this.distortion = new Tone.Distortion();
|
this.distortion = new Tone.Distortion();
|
||||||
this.pitchEffectValue;
|
this.pitchEffectValue;
|
||||||
|
|
||||||
|
|
||||||
// the effects are chained to an effects node for this clone, then to the master output
|
// the effects are chained to an effects node for this clone, then to the master output
|
||||||
// so audio is sent from each player or instrument, through the effects in order, then out
|
// so audio is sent from each player or instrument, through the effects in order, then out
|
||||||
// note that the pitch effect works differently - it sets the playback rate for each player
|
// note that the pitch effect works differently - it sets the playback rate for each player
|
||||||
|
@ -145,11 +144,15 @@ AudioEngine.prototype.stopAllSounds = function () {
|
||||||
// this.drumSamplers[i].triggerRelease();
|
// this.drumSamplers[i].triggerRelease();
|
||||||
// }
|
// }
|
||||||
// stop sounds triggered with playSound
|
// stop sounds triggered with playSound
|
||||||
|
if (this.soundPlayers && this.soundPlayers.length > 0) {
|
||||||
for (var i=0; i<this.soundPlayers.length; i++) {
|
for (var i=0; i<this.soundPlayers.length; i++) {
|
||||||
this.soundPlayers[i].stop();
|
this.soundPlayers[i].stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// stop soundfont notes
|
// stop soundfont notes
|
||||||
|
if (this.instrument) {
|
||||||
this.instrument.stop();
|
this.instrument.stop();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioEngine.prototype.setEffect = function (effect, value) {
|
AudioEngine.prototype.setEffect = function (effect, value) {
|
||||||
|
@ -232,6 +235,8 @@ AudioEngine.prototype.clearEffects = function () {
|
||||||
this.panner.pan.value = 0;
|
this.panner.pan.value = 0;
|
||||||
this.reverb.wet.value = 0;
|
this.reverb.wet.value = 0;
|
||||||
this.distortion.wet.value = 0;
|
this.distortion.wet.value = 0;
|
||||||
|
|
||||||
|
this.effectsNode.gain.value = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioEngine.prototype.setVolume = function (value) {
|
AudioEngine.prototype.setVolume = function (value) {
|
||||||
|
|
Loading…
Reference in a new issue