New feature: show song position (measure.beat) during playback

From: George Wieggers <george.wieggers_at_gmail.com>
Date: Sun Feb 03 2008 - 19:11:38 CET
Hi!

I'm sending my first patch for midish. This patch adds some info, if
"debug song" is turned on. While playing, the current measure and beat
are written to stderr, like other debug info.

Some background info: I'm trying to create a very simple front-end for
midish and it would be very nice if I can "see" that a song is
playing.

Patch follows (based on latest development snapshot)

I hope this patch will make it into the next release of midish.

With kind regards, George




--- ../orig/midish/song.c       2007-08-25 16:13:28.000000000 +0200
+++ ./song.c    2008-02-03 18:56:51.000000000 +0100
@@ -28,6 +28,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include <stdio.h>
+
 #include "dbg.h"
 #include "mididev.h"
 #include "mux.h"
@@ -499,6 +501,16 @@
 }

 /*
+ * provide song-position feedback
+ */
+static void song_debug_measure(struct song *o)
+{
+        char debug[50];
+        sprintf(debug, "song_play: measure[%d.%d]\n", o->measure + 1,
o->beat + 1);
+        dbg_puts(debug);
+}
+
+/*
  * move all track pointers 1 tick forward. Return true if at least one
  * track moved forward and 0 if no track moved forward (ie end of the
  * song was track reached)
@@ -523,6 +535,9 @@
                        o->beat = 0;
                        o->measure++;
                }
+               if (song_debug) {
+                       song_debug_measure(o);
+               }
        }
 #if 0
        if (song_debug) {
Received on Sun, 3 Feb 2008 19:11:38 +0100

This archive was generated by hypermail 2.1.8 : Wed Nov 08 2017 - 16:32:19 CET