Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/midiplay Fix timer reset bug when playing multiple s...
details: https://anonhg.NetBSD.org/src/rev/45d50a1cfc35
branches: trunk
changeset: 477116:45d50a1cfc35
user: augustss <augustss%NetBSD.org@localhost>
date: Mon Oct 11 12:52:10 1999 +0000
description:
Fix timer reset bug when playing multiple songs.
diffstat:
usr.bin/midiplay/midiplay.c | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diffs (67 lines):
diff -r 89e2f7505488 -r 45d50a1cfc35 usr.bin/midiplay/midiplay.c
--- a/usr.bin/midiplay/midiplay.c Mon Oct 11 12:45:43 1999 +0000
+++ b/usr.bin/midiplay/midiplay.c Mon Oct 11 12:52:10 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: midiplay.c,v 1.8 1998/11/25 22:17:07 augustss Exp $ */
+/* $NetBSD: midiplay.c,v 1.9 1999/10/11 12:52:10 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -358,20 +358,7 @@
* The ticks variable is the number of ticks that make up a quarter
* note and is used as a reference value for the delays between
* the MIDI events.
- * The sequencer has two "knobs": the TIMEBASE and the TEMPO.
- * The delay specified in TMR_WAIT_REL is specified in
- * sequencer time units. The length of a unit is
- * 60*1000000 / (TIMEBASE * TEMPO).
- * Set it to 1ms/unit (adjusted by user tempo changes).
*/
- t = 500 * ttempo / 100;
- if (ioctl(fd, SEQUENCER_TMR_TIMEBASE, &t) < 0)
- err(1, "SEQUENCER_TMR_TIMEBASE");
- t = 120;
- if (ioctl(fd, SEQUENCER_TMR_TEMPO, &t) < 0)
- err(1, "SEQUENCER_TMR_TEMPO");
- if (ioctl(fd, SEQUENCER_TMR_START, 0) < 0)
- err(1, "SEQUENCER_TMR_START");
now = 0;
for (;;) {
/* Locate lowest curtime */
@@ -494,6 +481,7 @@
int listdevs = 0;
int example = 0;
int nmidi;
+ int t;
char *file = DEVMUSIC;
struct synth_info info;
FILE *f;
@@ -547,9 +535,27 @@
}
exit(0);
}
+
+ /*
+ * The sequencer has two "knobs": the TIMEBASE and the TEMPO.
+ * The delay specified in TMR_WAIT_REL is specified in
+ * sequencer time units. The length of a unit is
+ * 60*1000000 / (TIMEBASE * TEMPO).
+ * Set it to 1ms/unit (adjusted by user tempo changes).
+ */
+ t = 500 * ttempo / 100;
+ if (ioctl(fd, SEQUENCER_TMR_TIMEBASE, &t) < 0)
+ err(1, "SEQUENCER_TMR_TIMEBASE");
+ t = 120;
+ if (ioctl(fd, SEQUENCER_TMR_TEMPO, &t) < 0)
+ err(1, "SEQUENCER_TMR_TEMPO");
+ if (ioctl(fd, SEQUENCER_TMR_START, 0) < 0)
+ err(1, "SEQUENCER_TMR_START");
+
midireset();
if (example)
- playdata(sample, sizeof sample, "<Gubben Noa>");
+ while (example--)
+ playdata(sample, sizeof sample, "<Gubben Noa>");
else if (argc == 0)
playfile(stdin, "<stdin>");
else
Home |
Main Index |
Thread Index |
Old Index