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) {
363
363
} ) ;
364
364
this . _voicesInUse . setValueAtTime ( 0 , t ) ;
365
365
for ( var n in this . notes ) {
366
- this . notes [ n ] . setValueAtTime ( null , t )
366
+ this . notes [ n ] . dispose ( ) ;
367
+ delete this . notes [ n ] ;
367
368
}
368
369
return ;
369
370
}
370
371
371
372
//Make sure note is in frequency inorder to query the this.notes object
372
373
var note = noteToFreq ( _note ) ;
373
374
374
- if ( this . notes [ note ] . getValueAtTime ( t ) === null ) {
375
+ if ( ! this . notes [ note ] || this . notes [ note ] . getValueAtTime ( t ) === null ) {
375
376
console . warn ( 'Cannot release a note that is not already playing' ) ;
376
377
} else {
377
378
//Find the scheduled change in this._voicesInUse that will be previous to this new note
@@ -384,7 +385,8 @@ define(function (require) {
384
385
}
385
386
386
387
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 ] ;
388
390
389
391
this . _newest = this . _newest === 0 ? 0 : ( this . _newest - 1 ) % ( this . maxVoices - 1 ) ;
390
392
}
You can’t perform that action at this time.
0 commit comments