]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/midi.c
midi.c: resurrect debug printing.
[lilypond.git] / python / midi.c
index 01c9925ece5445a65d947109f6efc7bc3c80945a..2ec52244097f7f35f1c007f847aff050868147bd 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2001--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2001--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
             Jan Nieuwenhuizen <janneke@gnu.org>
 
 
@@ -60,7 +60,8 @@ compat_itoa (int i)
 #if 0
 int x = 0;
 int *track = &x;
-#define debug_print(f, args...) fprintf (stderr, "%s:%d: track: %p :" f, __FUNCTION__, __LINE__, *track, ##args)
+#define urg_debug_print(f, args...) fprintf (stderr, "%s:%d: track: %p: " f, __FUNCTION__, __LINE__, *track, ##args)
+#define debug_print(f, args...) fprintf (stderr, f, ##args)
 #else
 #define debug_print(f, args...)
 #endif
@@ -161,7 +162,7 @@ get_number (unsigned char ** str, unsigned char * end_str, int length)
     sum = (sum << 8) + (unsigned char) (*str)[i];
 
   *str += length;
-  debug_print ("%d:\n", sum);
+  debug_print ("%ld:\n", sum);
   return sum;
 }
 
@@ -178,7 +179,7 @@ get_variable_length_number (unsigned char **str, unsigned char * end_str)
       if (!(x & 0x80))
        break;
     }
-  debug_print ("%d:\n", sum);
+  debug_print ("%ld:\n", sum);
   return sum;
 }
 
@@ -312,8 +313,8 @@ midi_parse_track (unsigned char **track, unsigned char *track_end)
 
   track_len = get_number (track, *track + 4, 4);
 
-  debug_print ("track_len: %u\n", track_len);
-  debug_print ("track_size: %u\n", track_size);
+  debug_print ("track_len: %lu\n", track_len);
+  debug_print ("track_size: %lu\n", track_size);
   debug_print ("track begin: %p\n", track);
   debug_print ("track end: %p\n", track + track_len);
   
@@ -388,7 +389,7 @@ midi_parse (unsigned char **midi,unsigned  char *midi_end)
   format = get_number (midi, *midi + 2, 2);
   tracks = get_number (midi, *midi + 2, 2);
 
-  if (tracks > 32)
+  if (tracks > 256)
     return midi_error (__FUNCTION__,  ": too many tracks: ", compat_itoa (tracks));
   
   division = get_number (midi, *midi + 2, 2) * 4;