1
1
import p5sound from './main' ;
2
2
import TimelineSignal from 'Tone/signal/TimelineSignal.js' ;
3
- import { noteToFreq , freqToMidi } from './helpers' ;
3
+ import { noteToFreq } from './helpers' ;
4
4
5
5
/**
6
6
* An AudioVoice is used as a single voice for sound synthesis.
@@ -274,9 +274,7 @@ class PolySynth {
274
274
else {
275
275
currentVoice = this . _oldest ;
276
276
277
- oldestNote = freqToMidi (
278
- this . audiovoices [ this . _oldest ] . oscillator . freq ( ) . value
279
- ) ;
277
+ let oldestNote = this . audiovoices [ this . _oldest ] . oscillator . freq ( ) . value ;
280
278
this . noteRelease ( oldestNote ) ;
281
279
this . _oldest = ( this . _oldest + 1 ) % ( this . maxVoices - 1 ) ;
282
280
}
@@ -389,6 +387,7 @@ class PolySynth {
389
387
this . notes [ n ] . dispose ( ) ;
390
388
delete this . notes [ n ] ;
391
389
}
390
+ this . _newest = 0 ;
392
391
return ;
393
392
}
394
393
@@ -400,10 +399,7 @@ class PolySynth {
400
399
} else {
401
400
//Find the scheduled change in this._voicesInUse that will be previous to this new note
402
401
//subtract 1 and schedule this value at time 't', when this note will stop playing
403
- var previousVal = Math . max (
404
- ~ ~ this . _voicesInUse . getValueAtTime ( t ) . value ,
405
- 1
406
- ) ;
402
+ var previousVal = Math . max ( ~ ~ this . _voicesInUse . getValueAtTime ( t ) , 1 ) ;
407
403
this . _voicesInUse . setValueAtTime ( previousVal - 1 , t ) ;
408
404
//Then update all scheduled values that follow to decrease by 1 but never go below 0
409
405
if ( previousVal > 0 ) {
0 commit comments