Merging Audio API update - fix disconnect/sound stopping

This commit is contained in:
Tim Mickel 2014-09-12 11:42:37 -04:00
commit 20e90c68a1
2 changed files with 3 additions and 3 deletions

View file

@ -113,7 +113,7 @@ function Scratch(project_id) {
var isource = runtime.audioContext.createBufferSource();
isource.buffer = ibuffer;
isource.connect(runtime.audioContext.destination);
isource.noteOn(0);
isource.start();
iosAudioActive = true;
}
});

View file

@ -39,7 +39,7 @@ SoundPrims.prototype.addPrimsTo = function(primTable) {
var playSound = function(snd) {
if (snd.source) {
// If this particular sound is already playing, stop it.
snd.source.stop();
snd.source.disconnect();
snd.source = null;
}
@ -108,7 +108,7 @@ var stopAllSounds = function() {
runtime.audioPlaying = [];
for (var s = 0; s < oldPlaying.length; s++) {
if (oldPlaying[s].source) {
oldPlaying[s].source.noteOff(0);
oldPlaying[s].source.disconnect();
oldPlaying[s].source.finished();
}
}