Fixes to lilypond backend
authorJelmer Vernooij <jelmer@samba.org>
Sun, 6 Jun 2004 17:47:30 +0000 (18:47 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 6 Jun 2004 17:47:30 +0000 (18:47 +0100)
ptb2ly.c
ptb2midi.c

index 6d162c74ef7419ed4de50ade71a4907b2efac503..b782169d906fdacbf64924cdf981aa280540ffaa 100644 (file)
--- a/ptb2ly.c
+++ b/ptb2ly.c
@@ -111,7 +111,7 @@ void ly_write_position(FILE *out, struct ptb_position *pos)
                
                fprintf(out, "%s", note_names[abs(note)%12]);
 
-               j = abs(note / 12);
+               j = (note+11) / 12;
                if(note < 0) {
                        for(i = j; i < 1; i++) fprintf(out, ",");
                } else if(note > 0) {
index 074fdbc0d09837c15df5aef0b70a6573c1509e3e..9fbd50b526a408a63e9e9d9f7594a4cfbf555cb8 100644 (file)
 #include <popt.h>
 #include "ptb.h"
 
+#define MIDI_COMMAND_
+
+void midi_write_meta_data(FILE *out, char command, void *data, guint8 length)
+{
+       fwrite(out, &command, 1);
+       fwrite(out, &length, sizeof(length));
+       fwrite(out, data, length);
+}
+
+void midi_write_channel_data(FILE *out, char command, char channel, void *data, size_t length)
+{
+       guint8 first;
+       first = command ^ 4 + channel;
+       fwrite(out, &first, 1);
+       fwrite(out, data, length);
+}
+
 int main(int argc, const char **argv) 
 {
        FILE *out = stdout;