File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -363,15 +363,16 @@ define(function (require) {
363363 } ) ;
364364 this . _voicesInUse . setValueAtTime ( 0 , t ) ;
365365 for ( var n in this . notes ) {
366- this . notes [ n ] . setValueAtTime ( null , t )
366+ this . notes [ n ] . dispose ( ) ;
367+ delete this . notes [ n ] ;
367368 }
368369 return ;
369370 }
370371
371372 //Make sure note is in frequency inorder to query the this.notes object
372373 var note = noteToFreq ( _note ) ;
373374
374- if ( this . notes [ note ] . getValueAtTime ( t ) === null ) {
375+ if ( ! this . notes [ note ] || this . notes [ note ] . getValueAtTime ( t ) === null ) {
375376 console . warn ( 'Cannot release a note that is not already playing' ) ;
376377 } else {
377378 //Find the scheduled change in this._voicesInUse that will be previous to this new note
@@ -384,7 +385,8 @@ define(function (require) {
384385 }
385386
386387 this . audiovoices [ this . notes [ note ] . getValueAtTime ( t ) ] . triggerRelease ( tFromNow ) ;
387- this . notes [ note ] . setValueAtTime ( null , t ) ;
388+ this . notes [ note ] . dispose ( ) ;
389+ delete this . notes [ note ] ;
388390
389391 this . _newest = this . _newest === 0 ? 0 : ( this . _newest - 1 ) % ( this . maxVoices - 1 ) ;
390392 }
You can’t perform that action at this time.
0 commit comments