diff options
author | erdgeist <erdgeist@bauklotz.fritz.box> | 2018-04-16 15:36:14 +0200 |
---|---|---|
committer | erdgeist <erdgeist@bauklotz.fritz.box> | 2018-04-16 15:36:14 +0200 |
commit | 8c978328b0d69216a1e60c3330c07d83c1408e12 (patch) | |
tree | d15e231961a57e0b9a84bd500bab69fcfe56e625 /midi-sdl.c | |
parent | 1b07b4d2ea8f716bef832b84bd38a2d0cdabb9b4 (diff) |
Add velocity code
Diffstat (limited to 'midi-sdl.c')
-rw-r--r-- | midi-sdl.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9,9 +9,9 @@ int midi_init() { | |||
9 | return 0; | 9 | return 0; |
10 | } | 10 | } |
11 | 11 | ||
12 | void midi_playnote( int channel, int note, int octave_offset ) { | 12 | void midi_playnote( int channel, int note, int octave_offset, int velocity ) { |
13 | char out[32]; | 13 | char out[32]; |
14 | int b = sprintf(out,"M%02X0020\nM%02X%02X%02X\n", 0xe0 | channel, 0x90 | channel, note + 12 * octave_offset, 0x7f); | 14 | int b = sprintf(out,"M%02X0020\nM%02X%02X%02X\n", 0xe0 | channel, 0x90 | channel, note + 12 * octave_offset, velocity&127); |
15 | if (g_harfe_connected && (g_harfe_fd != -1)) | 15 | if (g_harfe_connected && (g_harfe_fd != -1)) |
16 | write(g_harfe_fd, out, b); | 16 | write(g_harfe_fd, out, b); |
17 | } | 17 | } |