diff options
Diffstat (limited to 'midi.c')
| -rw-r--r-- | midi.c | 39 |
1 files changed, 0 insertions, 39 deletions
| @@ -1,39 +0,0 @@ | |||
| 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 | |||
