@@ -45,6 +45,8 @@ extern "C" {
45
45
46
46
#define VOLUME_FACTOR 0 .005f ;
47
47
48
+ #define VELO_MIDI_FIX 4
49
+
48
50
void MidiSend1 (uint8_t b0) {
49
51
midi_usb_MidiSend1 (1 , b0);
50
52
#ifdef USE_MIDI_SERIAL
@@ -652,7 +654,7 @@ class Instrument {
652
654
buttons[but].state = STATE_ON;
653
655
buttons[but].midinote = buttons[but].midinote_base + start_note_offset;
654
656
buttons[but].start_note_offset = start_note_offset;
655
- int velo = 0 + buttons[but].vpres * velo_sensitivity * 256 ;
657
+ int velo = 0 + buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX ;
656
658
if (velo > 127 ) velo = 127 ;
657
659
else if (velo < 1 ) velo = 1 ;
658
660
MidiSend3 (MIDI_NOTE_ON | midi_channel_offset,
@@ -755,7 +757,7 @@ class Instrument {
755
757
756
758
} else { // Note off
757
759
buttons[but].state = STATE_OFF;
758
- int velo = 0 - buttons[but].vpres * velo_sensitivity * 256 ;
760
+ int velo = 0 - buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX ;
759
761
if (velo > 127 ) velo = 127 ;
760
762
else if (velo < 0 ) velo = 0 ;
761
763
MidiSend3 (MIDI_NOTE_OFF | midi_channel_offset,
@@ -895,7 +897,7 @@ class Instrument {
895
897
buttons[but].state = STATE_OFF;
896
898
897
899
#ifdef USE_MIDI_OUT
898
- int velo = 0 - buttons[but].vpres * velo_sensitivity * 256 ;
900
+ int velo = 0 - buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX ;
899
901
if (velo > 127 ) velo = 127 ;
900
902
else if (velo < 0 ) velo = 0 ;
901
903
MidiSend3 (MIDI_NOTE_OFF | (midi_channel_offset + buttons[but].voice ),
@@ -934,7 +936,7 @@ class Instrument {
934
936
last_button = but;
935
937
936
938
#ifdef USE_MIDI_OUT
937
- int velo = 0 + buttons[but].vpres * velo_sensitivity * 256 ;
939
+ int velo = 0 + buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX ;
938
940
if (velo > 127 ) velo = 127 ;
939
941
else if (velo < 1 ) velo = 1 ;
940
942
0 commit comments