CVS commit: src/usr.bin/midirecord

2020-03-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Mar 14 09:01:11 UTC 2020

Modified Files:
src/usr.bin/midirecord: midirecord.1

Log Message:
Sort sections. Fix date.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/midirecord/midirecord.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.7 src/usr.bin/midirecord/midirecord.1:1.8
--- src/usr.bin/midirecord/midirecord.1:1.7	Sat Mar 14 08:09:55 2020
+++ src/usr.bin/midirecord/midirecord.1	Sat Mar 14 09:01:11 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: midirecord.1,v 1.7 2020/03/14 08:09:55 mrg Exp $
+.\"	$NetBSD: midirecord.1,v 1.8 2020/03/14 09:01:11 wiz Exp $
 .\"
 .\" Copyright (c) 1998, 1999, 2001, 2002, 2010, 2014, 2015, 2020 Matthew R. Green
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd Friday 13, 2020
+.Dd March 13, 2020
 .Dt MIDIRECORD 1
 .Os
 .Sh NAME
@@ -105,6 +105,11 @@ Format is [hh:]mm:ss[.dd].
 .It Fl V
 Be verbose.
 .El
+.Sh ENVIRONMENT
+.Bl -tag -width MIDIDEVICE
+.It Ev MIDIDEVICE
+the midi device to be used.
+.El
 .Sh EXAMPLES
 You can use
 .Nm
@@ -134,11 +139,6 @@ set to CC#6 (Control Data Entry MSB) tur
 For completeness, setting both CC#62 and CC#63 for the parameter
 number, as well as CC#6 and CC#26 (Control Data Entry MSB) to 0
 provides a complete NRPN control message.
-.Sh ENVIRONMENT
-.Bl -tag -width MIDIDEVICE
-.It Ev MIDIDEVICE
-the midi device to be used.
-.El
 .Sh SEE ALSO
 .Xr midiplay 1 ,
 .Xr midi 4 ,



CVS commit: src/usr.bin/midirecord

2020-03-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar 14 08:09:55 UTC 2020

Modified Files:
src/usr.bin/midirecord: midirecord.1

Log Message:
add an example of using midirecord(1) to learn about how device
specific MIDI messages are formed, allowing their use from MIDI
input files, not just the device controls.

using this method, i can now control the voice mode type on my
new synth.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/midirecord/midirecord.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.6 src/usr.bin/midirecord/midirecord.1:1.7
--- src/usr.bin/midirecord/midirecord.1:1.6	Sun Dec 11 08:40:10 2016
+++ src/usr.bin/midirecord/midirecord.1	Sat Mar 14 08:09:55 2020
@@ -1,6 +1,6 @@
-.\"	$NetBSD: midirecord.1,v 1.6 2016/12/11 08:40:10 mrg Exp $
+.\"	$NetBSD: midirecord.1,v 1.7 2020/03/14 08:09:55 mrg Exp $
 .\"
-.\" Copyright (c) 1998, 1999, 2001, 2002, 2010, 2014, 2015 Matthew R. Green
+.\" Copyright (c) 1998, 1999, 2001, 2002, 2010, 2014, 2015, 2020 Matthew R. Green
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 22, 2015
+.Dd Friday 13, 2020
 .Dt MIDIRECORD 1
 .Os
 .Sh NAME
@@ -105,6 +105,35 @@ Format is [hh:]mm:ss[.dd].
 .It Fl V
 Be verbose.
 .El
+.Sh EXAMPLES
+You can use
+.Nm
+to observe activity on a MIDI bus using the
+.Fl D
+and
+.Fl V
+options and learn about device-specific MIDI messages.
+.Pp
+For instance, to determine the MIDI messages needed to switch to ARP mode
+on a Korg minilogue XD synthesizer, which does not document any control
+change or non-registered parameter numbers for this function but does
+document that ARP is part of the
+.Dq VOICE TYPE MODE ,
+parameter these messages were seen:
+.Pp
+.Dl midi_event_chn_common_to_output:444: MIDI_CTL_CHANGE: channel 0 ctrl 62 val 10
+.Dl midi_event_chn_common_to_output:444: MIDI_CTL_CHANGE: channel 0 ctrl 6 val 1
+.Pp
+which shows that CC#62 (hexadecimal) was set to value 10 (also
+hexadecimal), and that CC#6 was set to value 1.
+As CC#62 is also the least significant byte of the non-registered
+parameter number, we can guess that NRPN 0,62 controls the
+.Dq VOICE MODE TYPE
+parameter documented in the synthesizer manual, and that the value 1
+set to CC#6 (Control Data Entry MSB) turns on ARP mode.
+For completeness, setting both CC#62 and CC#63 for the parameter
+number, as well as CC#6 and CC#26 (Control Data Entry MSB) to 0
+provides a complete NRPN control message.
 .Sh ENVIRONMENT
 .Bl -tag -width MIDIDEVICE
 .It Ev MIDIDEVICE
@@ -129,3 +158,7 @@ SYSEX, LOCAL and FULLSIZE messages are n
 .Nx
 .Xr sequencer 4
 device does not generate them.
+.Pp
+.Nm
+will hang after the timeout waiting for the very next message before
+it will exit and finish writing the file.



CVS commit: src/usr.bin/midirecord

2017-06-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jun  3 21:31:14 UTC 2017

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
avoid assert() and simply return errors.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.11 src/usr.bin/midirecord/midirecord.c:1.12
--- src/usr.bin/midirecord/midirecord.c:1.11	Sun Dec 11 08:40:10 2016
+++ src/usr.bin/midirecord/midirecord.c	Sat Jun  3 21:31:14 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: midirecord.c,v 1.11 2016/12/11 08:40:10 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.12 2017/06/03 21:31:14 mrg Exp $	*/
 
 /*
- * Copyright (c) 2014, 2015 Matthew R. Green
+ * Copyright (c) 2014, 2015, 2017 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: midirecord.c,v 1.11 2016/12/11 08:40:10 mrg Exp $");
+__RCSID("$NetBSD: midirecord.c,v 1.12 2017/06/03 21:31:14 mrg Exp $");
 #endif
 
 #include 
@@ -53,7 +53,6 @@ __RCSID("$NetBSD: midirecord.c,v 1.11 20
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "libaudio.h"
@@ -327,6 +326,11 @@ midi_event_timer_wait_abs_to_output(
 	unsigned val = 0, xdiv;
 	int vallen = 0, i;
 
+	if (bufsize < 4) {
+		warnx("too small bufsize: %zu", bufsize);
+		return 0;
+	}
+
 	if (prev_div == 0 && !oflag)
 		prev_div = e.t_WAIT_ABS.divisions;
 	cur_div = e.t_WAIT_ABS.divisions;
@@ -415,9 +419,18 @@ midi_event_chn_common_to_output(seq_even
 {
 	size_t	size = 0;
 
-	assert(e.common.channel < 16);
 	LOG("SEQ_CHN_COMMON");
 
+	if (bufsize < 3) {
+		warnx("too small bufsize: %zu", bufsize);
+		return 0;
+	}
+
+	if (e.common.channel >= 16) {
+		warnx("invalid channel: %u", e.common.channel);
+		return 0;
+	}
+
 	if (filter_devchan(e.common.device, e.common.channel))
 		return 0;
 
@@ -474,9 +487,18 @@ midi_event_chn_voice_to_output(seq_event
 {
 	size_t	size = 0;
 
-	assert(e.common.channel < 16);
 	LOG("SEQ_CHN_VOICE");
 
+	if (bufsize < 3) {
+		warnx("too small bufsize: %zu", bufsize);
+		return 0;
+	}
+
+	if (e.common.channel >= 16) {
+		warnx("invalid channel: %u", e.common.channel);
+		return 0;
+	}
+
 	if (filter_devchan(e.voice.device, e.voice.channel))
 		return 0;
 
@@ -554,9 +576,6 @@ midi_event_to_output(seq_event_t e, u_ch
 {
 	size_t size = 0;
 
-	/* XXX so far we only process 4 byte returns */
-	assert(bufsize >= 4);
-
 	LOG("event: %02x:%02x:%02x:%02x %02x:%02x:%02x:%02x", e.tag,
 	 e.unknown.byte[0], e.unknown.byte[1],
 	 e.unknown.byte[2], e.unknown.byte[3],
@@ -716,8 +735,10 @@ cleanup(int signo)
 			err(1, "failed to stop midi timer");
 	}
 
-	close(outfd);
-	close(midifd);
+	if (close(outfd) != 0)
+		warn("couldn't close output");
+	if (close(midifd) != 0)
+		warn("couldn't close midi device");
 	if (signo != 0)
 		(void)raise_default_signal(signo);
 



CVS commit: src/usr.bin/midirecord

2016-12-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Dec 11 08:40:10 UTC 2016

Modified Files:
src/usr.bin/midirecord: midirecord.1 midirecord.c

Log Message:
copyright and date maint.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/midirecord/midirecord.1
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.5 src/usr.bin/midirecord/midirecord.1:1.6
--- src/usr.bin/midirecord/midirecord.1:1.5	Wed Sep 23 05:31:01 2015
+++ src/usr.bin/midirecord/midirecord.1	Sun Dec 11 08:40:10 2016
@@ -1,6 +1,6 @@
-.\"	$NetBSD: midirecord.1,v 1.5 2015/09/23 05:31:01 mrg Exp $
+.\"	$NetBSD: midirecord.1,v 1.6 2016/12/11 08:40:10 mrg Exp $
 .\"
-.\" Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
+.\" Copyright (c) 1998, 1999, 2001, 2002, 2010, 2014, 2015 Matthew R. Green
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 22, 2015
+.Dd September 22, 2015
 .Dt MIDIRECORD 1
 .Os
 .Sh NAME

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.10 src/usr.bin/midirecord/midirecord.c:1.11
--- src/usr.bin/midirecord/midirecord.c:1.10	Wed Sep 23 05:31:01 2015
+++ src/usr.bin/midirecord/midirecord.c	Sun Dec 11 08:40:10 2016
@@ -1,7 +1,7 @@
-/*	$NetBSD: midirecord.c,v 1.10 2015/09/23 05:31:01 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.11 2016/12/11 08:40:10 mrg Exp $	*/
 
 /*
- * Copyright (c) 2014 Matthew R. Green
+ * Copyright (c) 2014, 2015 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: midirecord.c,v 1.10 2015/09/23 05:31:01 mrg Exp $");
+__RCSID("$NetBSD: midirecord.c,v 1.11 2016/12/11 08:40:10 mrg Exp $");
 #endif
 
 #include 



CVS commit: src/usr.bin/midirecord

2015-09-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Sep 23 05:31:01 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.1 midirecord.c

Log Message:
add "-R " option, to round beat counts to be aligned to
, which defaults to 1.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/midirecord/midirecord.1
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.4 src/usr.bin/midirecord/midirecord.1:1.5
--- src/usr.bin/midirecord/midirecord.1:1.4	Mon Jun  8 06:33:35 2015
+++ src/usr.bin/midirecord/midirecord.1	Wed Sep 23 05:31:01 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: midirecord.1,v 1.4 2015/06/08 06:33:35 mrg Exp $
+.\"	$NetBSD: midirecord.1,v 1.5 2015/09/23 05:31:01 mrg Exp $
 .\"
 .\" Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 30, 2014
+.Dd July 22, 2015
 .Dt MIDIRECORD 1
 .Os
 .Sh NAME
@@ -38,6 +38,7 @@
 .Op Fl d Ar devices
 .Op Fl f Ar sequencerdev
 .Op Fl n Ar notesperbeat
+.Op Fl R Ar roundbeats
 .Op Fl r Ar raw_output
 .Op Fl T Ar tempo
 .Op Fl t Ar time
@@ -87,6 +88,11 @@ Start the relative timer at process star
 the first event.
 .It Fl q
 Be quiet.
+.It Fl R Ar roundbeats
+Round timings to
+.Ar roundbeats
+of a note.
+Output will always be aligned to this many beats.
 .It Fl r Ar raw_output
 Create the raw output of the sequencer device in
 .Ar raw_output .

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.9 src/usr.bin/midirecord/midirecord.c:1.10
--- src/usr.bin/midirecord/midirecord.c:1.9	Sun Jun 21 06:04:45 2015
+++ src/usr.bin/midirecord/midirecord.c	Wed Sep 23 05:31:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.9 2015/06/21 06:04:45 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.10 2015/09/23 05:31:01 mrg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: midirecord.c,v 1.9 2015/06/21 06:04:45 mrg Exp $");
+__RCSID("$NetBSD: midirecord.c,v 1.10 2015/09/23 05:31:01 mrg Exp $");
 #endif
 
 #include 
@@ -72,6 +72,7 @@ static ssize_t	data_size;
 static struct timeval record_time;
 static struct timeval start_time;
 static int	tempo = 120;
+static unsigned	round_beats = 1;
 static unsigned	notes_per_beat = 24;
 static bool ignore_timer_fail = false;
 static bool stdout_mode = false;
@@ -144,6 +145,11 @@ main(int argc, char *argv[])
 		case 'r':
 			raw_output = optarg;
 			break;
+		case 'R':
+			decode_uint(optarg, _beats);
+			if (round_beats == 0)
+errx(1, "-R  must be a positive integer");
+			break;
 		case 't':
 			no_time_limit = 0;
 			decode_time(optarg, _time);
@@ -316,6 +322,7 @@ midi_event_timer_wait_abs_to_output(
 	size_t bufsize)
 {
 	static unsigned prev_div;
+	static int prev_leftover;
 	unsigned cur_div;
 	unsigned val = 0, xdiv;
 	int vallen = 0, i;
@@ -324,7 +331,15 @@ midi_event_timer_wait_abs_to_output(
 		prev_div = e.t_WAIT_ABS.divisions;
 	cur_div = e.t_WAIT_ABS.divisions;
 
-	xdiv = cur_div - prev_div;
+	xdiv = cur_div - prev_div + prev_leftover;
+	if (round_beats != 1) {
+		// round to closest
+		prev_leftover = xdiv % round_beats;
+		xdiv -= prev_leftover;
+		if (verbose)
+			fprintf(stderr, "adjusted beat value to %x (leftover = %d)\n",
+			xdiv, prev_leftover);
+	}
 	if (xdiv) {
 		while (xdiv) {
 			uint32_t extra = val ? 0x80 : 0;



CVS commit: src/usr.bin/midirecord

2015-06-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jun 21 06:04:45 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
fix the log message typo.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.8 src/usr.bin/midirecord/midirecord.c:1.9
--- src/usr.bin/midirecord/midirecord.c:1.8	Wed Mar  4 13:34:49 2015
+++ src/usr.bin/midirecord/midirecord.c	Sun Jun 21 06:04:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.8 2015/03/04 13:34:49 christos Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.9 2015/06/21 06:04:45 mrg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.8 2015/03/04 13:34:49 christos Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.9 2015/06/21 06:04:45 mrg Exp $);
 #endif
 
 #include sys/param.h
@@ -301,7 +301,7 @@ midi_event_local_to_output(seq_event_t e
 {
 	size_t	size = 0;
 
-	LOG(UNHANDLED SEQ_COCAL);
+	LOG(UNHANDLED SEQ_LOCAL);
 
 	return size;
 }



CVS commit: src/usr.bin/midirecord

2015-06-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jun  8 06:33:35 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.1

Log Message:
midirecord first appears in netbsd 7.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/midirecord/midirecord.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.3 src/usr.bin/midirecord/midirecord.1:1.4
--- src/usr.bin/midirecord/midirecord.1:1.3	Tue Dec 30 18:52:47 2014
+++ src/usr.bin/midirecord/midirecord.1	Mon Jun  8 06:33:35 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: midirecord.1,v 1.3 2014/12/30 18:52:47 mrg Exp $
+.\	$NetBSD: midirecord.1,v 1.4 2015/06/08 06:33:35 mrg Exp $
 .\
 .\ Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
 .\ All rights reserved.
@@ -112,7 +112,7 @@ the midi device to be used.
 The
 .Nm
 program was first seen in
-.Nx 8 .
+.Nx 7 .
 .Sh AUTHORS
 The
 .Nm



CVS commit: src/usr.bin/midirecord

2015-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 13:34:49 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
PR/49716: Henning Petersen: Use false and true on bool, fix sign in printf
formats.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.7 src/usr.bin/midirecord/midirecord.c:1.8
--- src/usr.bin/midirecord/midirecord.c:1.7	Sun Mar  1 04:56:54 2015
+++ src/usr.bin/midirecord/midirecord.c	Wed Mar  4 08:34:49 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.7 2015/03/01 09:56:54 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.8 2015/03/04 13:34:49 christos Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.7 2015/03/01 09:56:54 mrg Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.8 2015/03/04 13:34:49 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
 			channels);
 			break;
 		case 'D':
-			debug++;
+			debug = true;
 			break;
 		case 'd':
 			parse_ints(optarg, filt_devnos, num_filt_devnos,
@@ -237,7 +237,7 @@ main(int argc, char *argv[])
 	data_size = 0;
 
 	if (verbose)
-		fprintf(stderr, tempo=%d notes_per_beat=%d\n,
+		fprintf(stderr, tempo=%d notes_per_beat=%u\n,
 		   tempo, notes_per_beat);
 
 	if (!no_time_limit  verbose)
@@ -282,7 +282,7 @@ debug_log(const char *file, size_t line,
 
 	if (!debug)
 		return;
-	fprintf(stderr, %s:%zd: , file, line);
+	fprintf(stderr, %s:%zu: , file, line);
 	va_start(ap, fmt);
 	vfprintf(stderr, fmt, ap);
 	va_end(ap);



CVS commit: src/usr.bin/midirecord

2015-03-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar  1 09:56:54 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
be explicit about stdout mode.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.6 src/usr.bin/midirecord/midirecord.c:1.7
--- src/usr.bin/midirecord/midirecord.c:1.6	Sat Jan  3 22:57:54 2015
+++ src/usr.bin/midirecord/midirecord.c	Sun Mar  1 09:56:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.6 2015/01/03 22:57:54 joerg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.7 2015/03/01 09:56:54 mrg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.6 2015/01/03 22:57:54 joerg Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.7 2015/03/01 09:56:54 mrg Exp $);
 #endif
 
 #include sys/param.h
@@ -74,6 +74,7 @@ static struct timeval start_time;
 static int	tempo = 120;
 static unsigned	notes_per_beat = 24;
 static bool ignore_timer_fail = false;
+static bool stdout_mode = false;
 
 static void debug_log(const char *, size_t, const char *, ...)
 __printflike(3, 4);
@@ -191,8 +192,10 @@ main(int argc, char *argv[])
 		outfd = open(*argv, mode, 0666);
 		if (outfd  0)
 			err(1, could not open %s, *argv);
-	} else
+	} else {
+		stdout_mode = true;
 		outfd = STDOUT_FILENO;
+	}
 
 	/* open the raw output file */
 	if (raw_output) {
@@ -711,7 +714,7 @@ rewrite_header(void)
 {
 
 	/* can't do this here! */
-	if (outfd == STDOUT_FILENO)
+	if (stdout_mode)
 		return;
 
 	if (lseek(outfd, (off_t)0, SEEK_SET) == (off_t)-1)
@@ -734,7 +737,7 @@ write_midi_header(void)
 		0, 0, /* ntracks */
 		0, 0, /* notes per beat */
 	};
-	/* XXX only spport one track so far */
+	/* XXX only support one track so far */
 	unsigned ntracks = 1;
 	unsigned char track[] = {
 		'M', 'T', 'r', 'k',



CVS commit: src/usr.bin/midirecord

2015-01-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jan  3 22:57:54 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
Mark debug_log as printf-like.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.5 src/usr.bin/midirecord/midirecord.c:1.6
--- src/usr.bin/midirecord/midirecord.c:1.5	Thu Jan  1 04:57:01 2015
+++ src/usr.bin/midirecord/midirecord.c	Sat Jan  3 22:57:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.5 2015/01/01 04:57:01 christos Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.6 2015/01/03 22:57:54 joerg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.5 2015/01/01 04:57:01 christos Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.6 2015/01/03 22:57:54 joerg Exp $);
 #endif
 
 #include sys/param.h
@@ -75,7 +75,8 @@ static int	tempo = 120;
 static unsigned	notes_per_beat = 24;
 static bool ignore_timer_fail = false;
 
-static void debug_log(const char *, size_t, const char *, ...);
+static void debug_log(const char *, size_t, const char *, ...)
+__printflike(3, 4);
 static size_t midi_event_local_to_output(seq_event_t, u_char *, size_t);
 static size_t midi_event_timer_wait_abs_to_output(seq_event_t, u_char *,
 		  size_t);



CVS commit: src/usr.bin/midirecord

2014-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan  1 04:57:01 UTC 2015

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
don't shadow div(3)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.4 src/usr.bin/midirecord/midirecord.c:1.5
--- src/usr.bin/midirecord/midirecord.c:1.4	Tue Dec 30 13:52:47 2014
+++ src/usr.bin/midirecord/midirecord.c	Wed Dec 31 23:57:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.4 2014/12/30 18:52:47 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.5 2015/01/01 04:57:01 christos Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.4 2014/12/30 18:52:47 mrg Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.5 2015/01/01 04:57:01 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -313,21 +313,21 @@ midi_event_timer_wait_abs_to_output(
 {
 	static unsigned prev_div;
 	unsigned cur_div;
-	unsigned val = 0, div;
+	unsigned val = 0, xdiv;
 	int vallen = 0, i;
 
 	if (prev_div == 0  !oflag)
 		prev_div = e.t_WAIT_ABS.divisions;
 	cur_div = e.t_WAIT_ABS.divisions;
 
-	div = cur_div - prev_div;
-	if (div) {
-		while (div) {
+	xdiv = cur_div - prev_div;
+	if (xdiv) {
+		while (xdiv) {
 			uint32_t extra = val ? 0x80 : 0;
 
 			val = 8;
-			val |= (div  0x7f) | extra;
-			div = 7;
+			val |= (xdiv  0x7f) | extra;
+			xdiv = 7;
 			vallen++;
 		}
 	} else



CVS commit: src/usr.bin/midirecord

2014-12-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Dec 30 12:10:07 UTC 2014

Modified Files:
src/usr.bin/midirecord: midirecord.1

Log Message:
Describe -T. Sync SYNOPSIS with options. Sort options.
Remove trailing whitespace. Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/midirecord/midirecord.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.1 src/usr.bin/midirecord/midirecord.1:1.2
--- src/usr.bin/midirecord/midirecord.1:1.1	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/midirecord.1	Tue Dec 30 12:10:07 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: midirecord.1,v 1.1 2014/12/30 04:14:25 mrg Exp $
+.\	$NetBSD: midirecord.1,v 1.2 2014/12/30 12:10:07 wiz Exp $
 .\
 .\ Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
 .\ All rights reserved.
@@ -32,15 +32,15 @@
 .Nd record midi files
 .Sh SYNOPSIS
 .Nm
-.Op Fl afhoqV
+.Op Fl aDfhqV
 .Op Fl B Ar buffersize
 .Op Fl c Ar channels
 .Op Fl d Ar devices
 .Op Fl f Ar sequencerdev
 .Op Fl n Ar notesperbeat
 .Op Fl r Ar raw_output
-.Op Fl t Ar time
 .Op Fl T Ar tempo
+.Op Fl t Ar time
 .Ar file
 .Sh DESCRIPTION
 The
@@ -49,7 +49,6 @@ program converts the sequencer events re
 .Ar sequencerdev
 to the named MIDI SMF output.
 If the file name is \-, output will go to the standard output.
-.Pp
 .Sh OPTIONS
 The following options are available:
 .Bl -tag -width XnXnotesperbeatX
@@ -79,11 +78,14 @@ Print a help message.
 .It Fl n Ar notesperbeat
 Sets the MIDI notes (clocks) per beat to
 .Ar notesperbeat .
+.It Fl q
+Be quiet.
 .It Fl r Ar raw_output
 Create the raw output of the sequencer device in
 .Ar raw_output .
-.It Fl q
-Be quiet.
+.It Fl T Ar tempo
+Set the tempo for the recording to
+.Ar tempo .
 .It Fl t Ar time
 Sets the maximum amount of time to record.
 Format is [hh:]mm:ss[.dd].
@@ -92,17 +94,17 @@ Be verbose.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width MIDIDEVICE
-.It MIDIDEVICE
+.It Ev MIDIDEVICE
 the midi device to be used.
 .El
 .Sh SEE ALSO
 .Xr midiplay 1 ,
 .Xr midi 4 ,
-.Xr sequencer 4 .
+.Xr sequencer 4
 .Sh HISTORY
 The
 .Nm
-program was first seen in 
+program was first seen in
 .Nx 8 .
 .Sh AUTHORS
 The



CVS commit: src/usr.bin/midirecord

2014-12-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Dec 30 12:14:34 UTC 2014

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.2 src/usr.bin/midirecord/midirecord.c:1.3
--- src/usr.bin/midirecord/midirecord.c:1.2	Tue Dec 30 06:08:14 2014
+++ src/usr.bin/midirecord/midirecord.c	Tue Dec 30 12:14:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.2 2014/12/30 06:08:14 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.3 2014/12/30 12:14:34 wiz Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.2 2014/12/30 06:08:14 mrg Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.3 2014/12/30 12:14:34 wiz Exp $);
 #endif
 
 #include sys/param.h
@@ -786,16 +786,16 @@ static void
 usage(void)
 {
 
-	fprintf(stderr, Usage: %s [-afhoqV] [options] {outfile|-}\n,
+	fprintf(stderr, Usage: %s [-aDfhqV] [options] {outfile|-}\n,
 	getprogname());
 	fprintf(stderr, Options:\n
 	\t-B buffer size\n
-	\t-c filt_chans\n
-	\t-d filt_devno\n
+	\t-c channels\n
+	\t-d devices\n
 	\t-f sequencerdev\n
-	\t-n notes per beat\n
+	\t-n notesperbeat\n
 	\t-r raw_output\n
-	\t-t recording time\n
-	\t-T tempo\n);
+	\t-T tempo\n
+	\t-t recording time\n);
 	exit(EXIT_FAILURE);
 }



CVS commit: src/usr.bin/midirecord

2014-12-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 18:52:47 UTC 2014

Modified Files:
src/usr.bin/midirecord: midirecord.1 midirecord.c

Log Message:
- this is midirecord(1) not midiorecord(1)
- add the -o handling to the getopt() and man page
- bump date


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/midirecord/midirecord.1
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.1
diff -u src/usr.bin/midirecord/midirecord.1:1.2 src/usr.bin/midirecord/midirecord.1:1.3
--- src/usr.bin/midirecord/midirecord.1:1.2	Tue Dec 30 12:10:07 2014
+++ src/usr.bin/midirecord/midirecord.1	Tue Dec 30 18:52:47 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: midirecord.1,v 1.2 2014/12/30 12:10:07 wiz Exp $
+.\	$NetBSD: midirecord.1,v 1.3 2014/12/30 18:52:47 mrg Exp $
 .\
 .\ Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
 .\ All rights reserved.
@@ -24,15 +24,15 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd December 29, 2014
+.Dd December 30, 2014
 .Dt MIDIRECORD 1
 .Os
 .Sh NAME
-.Nm midiorecord
+.Nm midirecord
 .Nd record midi files
 .Sh SYNOPSIS
 .Nm
-.Op Fl aDfhqV
+.Op Fl aDfhoqV
 .Op Fl B Ar buffersize
 .Op Fl c Ar channels
 .Op Fl d Ar devices
@@ -49,6 +49,10 @@ program converts the sequencer events re
 .Ar sequencerdev
 to the named MIDI SMF output.
 If the file name is \-, output will go to the standard output.
+By default, timing for events begins with the first event.
+The
+.Fl o
+flag may be used to start timing events at the process start up.
 .Sh OPTIONS
 The following options are available:
 .Bl -tag -width XnXnotesperbeatX
@@ -78,6 +82,9 @@ Print a help message.
 .It Fl n Ar notesperbeat
 Sets the MIDI notes (clocks) per beat to
 .Ar notesperbeat .
+.It Fl o
+Start the relative timer at process start up instead of at
+the first event.
 .It Fl q
 Be quiet.
 .It Fl r Ar raw_output

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.3 src/usr.bin/midirecord/midirecord.c:1.4
--- src/usr.bin/midirecord/midirecord.c:1.3	Tue Dec 30 12:14:34 2014
+++ src/usr.bin/midirecord/midirecord.c	Tue Dec 30 18:52:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.3 2014/12/30 12:14:34 wiz Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.4 2014/12/30 18:52:47 mrg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.3 2014/12/30 12:14:34 wiz Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.4 2014/12/30 18:52:47 mrg Exp $);
 #endif
 
 #include sys/param.h
@@ -106,7 +106,7 @@ main(int argc, char *argv[])
 	size_t	bufsize = 0;
 	int	ch, no_time_limit = 1;
 
-	while ((ch = getopt(argc, argv, aB:c:Dd:f:hn:qr:t:T:V)) != -1) {
+	while ((ch = getopt(argc, argv, aB:c:Dd:f:hn:oqr:t:T:V)) != -1) {
 		switch (ch) {
 		case 'a':
 			aflag++;



CVS commit: src/usr.bin/midirecord

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 04:14:25 UTC 2014

Added Files:
src/usr.bin/midirecord: Makefile midirecord.1 midirecord.c

Log Message:
add a program to record midi files from /dev/music.

this doesn't process several potential result that netbsd does
not output on /dev/music, and should be largely complete for
our current sequencer(4).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/midirecord/Makefile \
src/usr.bin/midirecord/midirecord.1 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/usr.bin/midirecord/Makefile
diff -u /dev/null src/usr.bin/midirecord/Makefile:1.1
--- /dev/null	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/Makefile	Tue Dec 30 04:14:25 2014
@@ -0,0 +1,15 @@
+#	$NetBSD: Makefile,v 1.1 2014/12/30 04:14:25 mrg Exp $
+
+PROG=	midirecord
+
+.include bsd.own.mk
+
+LIBAUDIO != cd ${.CURDIR}/../audio/common  ${PRINTOBJDIR}
+CPPFLAGS+=-I${.CURDIR}/../audio/common
+DPADD+=	${LIBAUDIO}/libaudio.a
+LDADD+=	-L${LIBAUDIO} -laudio
+
+DPADD+=	${LIBUTIL}
+LDADD+=	-lutil
+
+.include bsd.prog.mk
Index: src/usr.bin/midirecord/midirecord.1
diff -u /dev/null src/usr.bin/midirecord/midirecord.1:1.1
--- /dev/null	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/midirecord.1	Tue Dec 30 04:14:25 2014
@@ -0,0 +1,116 @@
+.\	$NetBSD: midirecord.1,v 1.1 2014/12/30 04:14:25 mrg Exp $
+.\
+.\ Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.Dd December 29, 2014
+.Dt MIDIRECORD 1
+.Os
+.Sh NAME
+.Nm midiorecord
+.Nd record midi files
+.Sh SYNOPSIS
+.Nm
+.Op Fl afhoqV
+.Op Fl B Ar buffersize
+.Op Fl c Ar channels
+.Op Fl d Ar devices
+.Op Fl f Ar sequencerdev
+.Op Fl n Ar notesperbeat
+.Op Fl r Ar raw_output
+.Op Fl t Ar time
+.Op Fl T Ar tempo
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+program converts the sequencer events read on
+.Ar sequencerdev
+to the named MIDI SMF output.
+If the file name is \-, output will go to the standard output.
+.Pp
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width XnXnotesperbeatX
+.It Fl a
+Append to the specified file, rather than overwriting.
+.It Fl B Ar buffersize
+Set the sequencer device read buffer size to
+.Ar buffersize .
+The default value is 32768 bytes.
+.It Fl c Ar channels
+Sets the filter list of channels to
+.Ar channels ,
+which is a comma separated list of channels to filter in.
+.It Fl D
+Enable debug log.
+.It Fl d Ar devices
+Sets the filter list of devices to
+.Ar devices ,
+which is a comma separated list of devices to filter in.
+.It Fl f Ar sequencerdev
+Sets the sequencer device to use to
+.Ar sequencerdev .
+The default is
+.Pa /dev/music .
+.It Fl h
+Print a help message.
+.It Fl n Ar notesperbeat
+Sets the MIDI notes (clocks) per beat to
+.Ar notesperbeat .
+.It Fl r Ar raw_output
+Create the raw output of the sequencer device in
+.Ar raw_output .
+.It Fl q
+Be quiet.
+.It Fl t Ar time
+Sets the maximum amount of time to record.
+Format is [hh:]mm:ss[.dd].
+.It Fl V
+Be verbose.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width MIDIDEVICE
+.It MIDIDEVICE
+the midi device to be used.
+.El
+.Sh SEE ALSO
+.Xr midiplay 1 ,
+.Xr midi 4 ,
+.Xr sequencer 4 .
+.Sh HISTORY
+The
+.Nm
+program was first seen in 
+.Nx 8 .
+.Sh AUTHORS
+The
+.Nm
+program was written by
+.An Matthew R. Green Aq Mt m...@eterna.com.au .
+.Sh BUGS
+SYSEX, LOCAL and FULLSIZE messages are not currently handled, but the
+.Nx
+.Xr sequencer 4
+device does not generate them.
Index: src/usr.bin/midirecord/midirecord.c
diff -u /dev/null src/usr.bin/midirecord/midirecord.c:1.1
--- /dev/null	Tue Dec 

CVS commit: src/usr.bin/midirecord

2014-12-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 30 06:08:14 UTC 2014

Modified Files:
src/usr.bin/midirecord: midirecord.c

Log Message:
only prev_div needs to be static.
add channel to some log messages.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/midirecord/midirecord.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/midirecord/midirecord.c
diff -u src/usr.bin/midirecord/midirecord.c:1.1 src/usr.bin/midirecord/midirecord.c:1.2
--- src/usr.bin/midirecord/midirecord.c:1.1	Tue Dec 30 04:14:25 2014
+++ src/usr.bin/midirecord/midirecord.c	Tue Dec 30 06:08:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: midirecord.c,v 1.1 2014/12/30 04:14:25 mrg Exp $	*/
+/*	$NetBSD: midirecord.c,v 1.2 2014/12/30 06:08:14 mrg Exp $	*/
 
 /*
  * Copyright (c) 2014 Matthew R. Green
@@ -33,7 +33,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: midirecord.c,v 1.1 2014/12/30 04:14:25 mrg Exp $);
+__RCSID($NetBSD: midirecord.c,v 1.2 2014/12/30 06:08:14 mrg Exp $);
 #endif
 
 #include sys/param.h
@@ -311,7 +311,8 @@ midi_event_timer_wait_abs_to_output(
 	u_char *buffer,
 	size_t bufsize)
 {
-	static uint32_t prev_div, cur_div;
+	static unsigned prev_div;
+	unsigned cur_div;
 	unsigned val = 0, div;
 	int vallen = 0, i;
 
@@ -330,7 +331,7 @@ midi_event_timer_wait_abs_to_output(
 			vallen++;
 		}
 	} else
-		val = 0, vallen = 1;
+		vallen = 1;
 
 	for (i = 0; i  vallen; i++) {
 		buffer[i] = val  0xff;
@@ -466,8 +467,8 @@ midi_event_chn_voice_to_output(seq_event
 		buffer[1] = e.c_NOTEOFF.key;
 		buffer[2] = e.c_NOTEOFF.velocity;
 
-		LOG(MIDI_NOTEOFF: key %x velocity %x,
-		e.c_NOTEOFF.key, e.c_NOTEOFF.velocity);
+		LOG(MIDI_NOTEOFF: channel %x key %x velocity %x,
+		e.c_NOTEOFF.channel, e.c_NOTEOFF.key, e.c_NOTEOFF.velocity);
 		size = 3;
 		break;
 
@@ -476,8 +477,8 @@ midi_event_chn_voice_to_output(seq_event
 		buffer[1] = e.c_NOTEON.key;
 		buffer[2] = e.c_NOTEON.velocity;
 
-		LOG(MIDI_NOTEON: key %x velocity %x,
-		e.c_NOTEON.key, e.c_NOTEON.velocity);
+		LOG(MIDI_NOTEON: channel %x key %x velocity %x,
+		e.c_NOTEON.channel, e.c_NOTEON.key, e.c_NOTEON.velocity);
 		size = 3;
 		break;