Skip to content

Commit 20e90c6

Browse files
author
Tim Mickel
committed
Merging scratchfoundation#87 Audio API update - fix disconnect/sound stopping
2 parents a5cf476 + 1bc446c commit 20e90c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

js/Scratch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function Scratch(project_id) {
113113
var isource = runtime.audioContext.createBufferSource();
114114
isource.buffer = ibuffer;
115115
isource.connect(runtime.audioContext.destination);
116-
isource.noteOn(0);
116+
isource.start();
117117
iosAudioActive = true;
118118
}
119119
});

js/primitives/SoundPrims.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SoundPrims.prototype.addPrimsTo = function(primTable) {
3939
var playSound = function(snd) {
4040
if (snd.source) {
4141
// If this particular sound is already playing, stop it.
42-
snd.source.stop();
42+
snd.source.disconnect();
4343
snd.source = null;
4444
}
4545

@@ -108,7 +108,7 @@ var stopAllSounds = function() {
108108
runtime.audioPlaying = [];
109109
for (var s = 0; s < oldPlaying.length; s++) {
110110
if (oldPlaying[s].source) {
111-
oldPlaying[s].source.noteOff(0);
111+
oldPlaying[s].source.disconnect();
112112
oldPlaying[s].source.finished();
113113
}
114114
}

0 commit comments

Comments
 (0)