spessasynth_lib 3.24.10 → 3.24.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.
@@ -67,15 +67,16 @@ export function noteOn(channel, midiNote, velocity, enableDebugging = false, sen
67
67
  // portamento
68
68
  let portamentoFromKey = -1;
69
69
  let portamentoDuration = 0;
70
- if (!channelObject.drumChannel && channelObject.midiControllers[midiControllers.portamentoOnOff] >= 8064) // (64 << 7)
70
+ const currentFromKey = channelObject.midiControllers[midiControllers.portamentoControl] >> 7;
71
+ if (!channelObject.drumChannel && currentFromKey !== sentMidiNote && channelObject.midiControllers[midiControllers.portamentoOnOff] >= 8192) // (64 << 7)
71
72
  {
72
73
  // note: the 14-bit value needs to go down to 7-bit
73
74
  const portamentoTime = channelObject.midiControllers[midiControllers.portamentoTime] >> 7;
74
- portamentoFromKey = channelObject.midiControllers[midiControllers.portamentoControl] >> 7;
75
- const diff = Math.abs(sentMidiNote - portamentoFromKey);
75
+ const diff = Math.abs(sentMidiNote - currentFromKey);
76
76
  portamentoDuration = portamentoTimeToSeconds(portamentoTime, diff);
77
+ portamentoFromKey = currentFromKey;
77
78
  // set portamento control to previous value
78
- channelObject.midiControllers[midiControllers.portamentoControl] = sentMidiNote << 7;
79
+ this.controllerChange(channel, midiControllers.portamentoControl, sentMidiNote);
79
80
  }
80
81
 
81
82
  // get voices