diff options
| author | erdgeist <erdgeist@bauklotz.fritz.box> | 2016-08-12 22:35:28 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@bauklotz.fritz.box> | 2016-08-12 22:35:28 +0200 |
| commit | 04a417f20a8b5340c6cb83a52f84f415cce9ed60 (patch) | |
| tree | fad21861d5b70a27ff369b955a3434b7c9abe42a /midi-sdl.c | |
| parent | 830ec9041b5b70782f5a3781d27af9b149c028b1 (diff) | |
renamed midi.c to midi-sdl.c
Diffstat (limited to 'midi-sdl.c')
| -rw-r--r-- | midi-sdl.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/midi-sdl.c b/midi-sdl.c new file mode 100644 index 0000000..7509859 --- /dev/null +++ b/midi-sdl.c | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #include <stdlib.h> | ||
| 2 | #include <unistd.h> | ||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | #include "midi.h" | ||
| 6 | #include "main.h" | ||
| 7 | |||
| 8 | int midi_init() { | ||
| 9 | return 0; | ||
| 10 | } | ||
| 11 | |||
| 12 | void midi_playnote( int channel, int note, int octave_offset ) { | ||
| 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); | ||
| 15 | if (g_harfe_connected && (g_harfe_fd != -1)) | ||
| 16 | write(g_harfe_fd, out, b); | ||
| 17 | } | ||
| 18 | |||
| 19 | void midi_silencenote( int channel, int note, int octave_offset ) { | ||
| 20 | char out[10]; | ||
| 21 | int b = sprintf(out,"M%02X%02X%02X\n", 0x80 | channel, note + 12 * octave_offset, 0); | ||
| 22 | if (g_harfe_connected && (g_harfe_fd != -1)) | ||
| 23 | write(g_harfe_fd, out, b); | ||
| 24 | } | ||
| 25 | |||
| 26 | void midi_pitchbend( int channel, int pitch ) { | ||
| 27 | char out[10]; | ||
| 28 | pitch += 8192; | ||
| 29 | if (pitch < 0) | ||
| 30 | pitch = 0; | ||
| 31 | if (pitch > 16383) | ||
| 32 | pitch = 16383; | ||
| 33 | int b = sprintf(out,"M%02X%02X%02X\n", 0xe0 | channel, 0x7f & pitch, 0x7f & (pitch>>7)); | ||
| 34 | if (g_harfe_connected && (g_harfe_fd != -1)) | ||
| 35 | write(g_harfe_fd, out, b); | ||
| 36 | } | ||
| 37 | |||
| 38 | //void midi_controller_event( int saite, int value ); | ||
| 39 | |||
