spessasynth_lib 3.22.9 → 3.22.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -143,7 +143,20 @@ export function resetControllers(channel)
143
143
  channelObject.keyCentTuning.fill(0);
144
144
 
145
145
  // reset the array
146
- channelObject.midiControllers.set(resetArray);
146
+ for (let i = 0; i < resetArray.length; i++)
147
+ {
148
+ const resetValue = resetArray[i];
149
+ if (channelObject.midiControllers[i] !== resetValue && i < 127)
150
+ {
151
+ // call cc change if reset
152
+ this.callEvent("controllerchange", {
153
+ channel: channel,
154
+ controllerNumber: i,
155
+ controllerValue: resetValue >> 7
156
+ });
157
+ }
158
+ channelObject.midiControllers[i] = resetValue;
159
+ }
147
160
  channelObject.channelVibrato = { rate: 0, depth: 0, delay: 0 };
148
161
  channelObject.holdPedal = false;
149
162
 
@@ -144,12 +144,12 @@ export class WorkletLowpassFilter
144
144
  // fix cutoff on low frequencies (fluid_iir_filter.c line 392)
145
145
  filter.cutoffHz = Math.min(filter.cutoffHz, 0.45 * sampleRate);
146
146
 
147
- // adjust the filterQ (fluid_iir_filter.c line 204)
148
- const qDb = (filter.reasonanceCb / 10) - 3.01;
149
- filter.reasonanceGain = decibelAttenuationToGain(-1 * qDb); // -1 because it's attenuation and we don't want attenuation
147
+ const qDb = filter.reasonanceCb / 10;
148
+ // correct the filter gain, like fluid does
149
+ filter.reasonanceGain = decibelAttenuationToGain(-1 * (qDb - 3.01)); // -1 because it's attenuation and we don't want attenuation
150
150
 
151
151
  // reduce the gain by the Q factor (fluid_iir_filter.c line 250)
152
- const qGain = 1 / Math.sqrt(filter.reasonanceGain);
152
+ const qGain = 1 / Math.sqrt(decibelAttenuationToGain(-qDb));
153
153
 
154
154
 
155
155
  // code is ported from https://github.com/sinshu/meltysynth/ to work with js.