shithub: orca

Download patch

ref: c5f0c601ae93df571ed74e52db54eefa42e63a0d
parent: f9255bbf99267dc360741461deea27d6dab92b3b
author: cancel <cancel@cancel.fm>
date: Sun Jan 19 18:17:26 EST 2020

Change default velocity to be 127

--- a/sim.c
+++ b/sim.c
@@ -305,15 +305,21 @@
   Usz channel_num = index_of(channel_g);
   if (channel_num > 15)
     channel_num = 15;
-  Usz vel_num = index_of(velocity_g);
-  // MIDI notes with velocity zero are actually note-offs. (MIDI has two ways
-  // to send note offs. Zero-velocity is the alternate way.) If there is a zero
-  // velocity, we'll just not do anything.
-  if (vel_num == 0)
-    return;
-  vel_num = vel_num * 8 - 1; // 1~16 -> 7~127
-  if (vel_num > 127)
+  Usz vel_num;
+  if (velocity_g == '.') {
+    // If no velocity is specified, set it to full.
     vel_num = 127;
+  } else {
+    vel_num = index_of(velocity_g);
+    // MIDI notes with velocity zero are actually note-offs. (MIDI has two ways
+    // to send note offs. Zero-velocity is the alternate way.) If there is a zero
+    // velocity, we'll just not do anything.
+    if (vel_num == 0)
+      return;
+    vel_num = vel_num * 8 - 1; // 1~16 -> 7~127
+    if (vel_num > 127)
+      vel_num = 127;
+  }
   Oevent_midi *oe =
       (Oevent_midi *)oevent_list_alloc_item(extra_params->oevent_list);
   oe->oevent_type = (U8)Oevent_type_midi;