Merging #87 Audio API update - fix disconnect/sound stopping
This commit is contained in:
commit
20e90c68a1
2 changed files with 3 additions and 3 deletions
js
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue