@@ -83,7 +83,7 @@ export class MidiChannel {
83
83
if ( voice . note === note ) {
84
84
if ( this . controllerValues [ CONTROL_SUSTAIN ] >= 64 ) {
85
85
this . sustainedVoices [ note ] = voice ;
86
- } else {
86
+ } else {
87
87
voice . noteoff ( ) ;
88
88
}
89
89
break ;
@@ -142,15 +142,15 @@ export class MidiChannel {
142
142
}
143
143
if ( oldestVoice !== null ) {
144
144
const voice = ( oldestVoice as MidiVoice ) ;
145
- for ( let n = 0 ; n < sampleBufferFrames ; n ++ ) {
145
+ for ( let n = 0 ; n < sampleBufferFrames ; n ++ ) {
146
146
voice . nextframe ( ) ;
147
147
const fact : f32 = ( ( sampleBufferFrames as f32 ) - ( n as f32 ) ) / ( sampleBufferFrames as f32 ) ;
148
- this . voiceTransitionBuffer [ n << 1 ] += this . signal . left * fact ;
149
- this . voiceTransitionBuffer [ ( n << 1 ) + 1 ] += this . signal . right * fact ;
148
+ this . voiceTransitionBuffer [ n << 1 ] += this . signal . left * fact ;
149
+ this . voiceTransitionBuffer [ ( n << 1 ) + 1 ] += this . signal . right * fact ;
150
150
this . signal . clear ( ) ;
151
151
}
152
152
voice . activationCount = voiceActivationCount ++ ;
153
- this . removeFromSustainedVoices ( voice ) ;
153
+ this . removeFromSustainedVoices ( voice ) ;
154
154
}
155
155
return oldestVoice ;
156
156
}
@@ -237,10 +237,10 @@ export function shortmessage(val1: u8, val2: u8, val3: u8): void {
237
237
}
238
238
239
239
export function getActiveVoicesStatusSnapshot ( ) : usize {
240
- for ( let n = 0 ; n < activeVoices . length ; n ++ ) {
240
+ for ( let n = 0 ; n < activeVoices . length ; n ++ ) {
241
241
const activeVoicesStatusSnapshotIndex = n * 3 ;
242
- if ( activeVoices [ n ] != null ) {
243
- const voice = ( activeVoices [ n ] as MidiVoice ) ;
242
+ if ( activeVoices [ n ] != null ) {
243
+ const voice = ( activeVoices [ n ] as MidiVoice ) ;
244
244
activeVoicesStatusSnapshot [ activeVoicesStatusSnapshotIndex ] = voice . channelNo ;
245
245
activeVoicesStatusSnapshot [ activeVoicesStatusSnapshotIndex + 1 ] = voice . note ;
246
246
activeVoicesStatusSnapshot [ activeVoicesStatusSnapshotIndex + 2 ] = voice . velocity ;
@@ -303,11 +303,11 @@ export function fillSampleBufferWithNumSamples(numSamples: i32): void {
303
303
304
304
channelsignal . left += midichannel . voiceTransitionBuffer [ voiceTransitionBufferNdx ] ;
305
305
midichannel . voiceTransitionBuffer [ voiceTransitionBufferNdx ] = 0 ;
306
- channelsignal . right += midichannel . voiceTransitionBuffer [ voiceTransitionBufferNdx + 1 ] ;
307
- midichannel . voiceTransitionBuffer [ voiceTransitionBufferNdx + 1 ] = 0 ;
308
-
309
- midichannel . preprocess ( ) ;
310
-
306
+ channelsignal . right += midichannel . voiceTransitionBuffer [ voiceTransitionBufferNdx + 1 ] ;
307
+ midichannel . voiceTransitionBuffer [ voiceTransitionBufferNdx + 1 ] = 0 ;
308
+
309
+ midichannel . preprocess ( ) ;
310
+
311
311
channelsignal . left *= midichannel . pan . leftLevel * midichannel . volume ;
312
312
channelsignal . right *= midichannel . pan . rightLevel * midichannel . volume ;
313
313
0 commit comments