summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/midi.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-10-21 18:57:43 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-10-21 18:57:43 +0000
commit6ebe19ad940ba7f867c1080614a5943ce0f81597 (patch)
tree8e426ae1ad08415b87e4f44e9d6744b036dd48b5 /usr.bin/aucat/midi.c
parent037c630a168e2dd796c6b34b17d366faf713cdb3 (diff)
use MODE_xxx and XRUN_xxx macros everywhere, and zap corresponding
AMSG_xxx macros, which in turns simplifies the code
Diffstat (limited to 'usr.bin/aucat/midi.c')
-rw-r--r--usr.bin/aucat/midi.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/usr.bin/aucat/midi.c b/usr.bin/aucat/midi.c
index aa2b6884a3f..8001f118182 100644
--- a/usr.bin/aucat/midi.c
+++ b/usr.bin/aucat/midi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: midi.c,v 1.28 2010/07/06 01:12:45 ratchov Exp $ */
+/* $OpenBSD: midi.c,v 1.29 2010/10/21 18:57:42 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -560,20 +560,19 @@ ctl_getidx(struct aproc *p, char *who)
umap |= (1 << i);
}
for (unit = 0; ; unit++) {
- if (unit == CTL_NSLOT)
+ if (unit == CTL_NSLOT) {
+#ifdef DEBUG
+ if (debug_level >= 1) {
+ dbg_puts(name);
+ dbg_puts(": too many instances");
+ }
+#endif
return -1;
+ }
if ((umap & (1 << unit)) == 0)
break;
}
-#ifdef DEBUG
- if (debug_level >= 3) {
- aproc_dbg(p);
- dbg_puts(": new control name is ");
- dbg_puts(name);
- dbg_putu(unit);
- dbg_puts("\n");
- }
-#endif
+
/*
* find a free controller slot with the same name/unit
*/
@@ -583,7 +582,8 @@ ctl_getidx(struct aproc *p, char *who)
slot->unit == unit) {
#ifdef DEBUG
if (debug_level >= 3) {
- aproc_dbg(p);
+ dbg_puts(name);
+ dbg_putu(unit);
dbg_puts(": found slot ");
dbg_putu(i);
dbg_puts("\n");
@@ -608,8 +608,16 @@ ctl_getidx(struct aproc *p, char *who)
bestidx = i;
}
}
- if (bestidx == CTL_NSLOT)
+ if (bestidx == CTL_NSLOT) {
+#ifdef DEBUG
+ if (debug_level >= 1) {
+ dbg_puts(name);
+ dbg_putu(unit);
+ dbg_puts(": out of mixer slots\n");
+ }
+#endif
return -1;
+ }
slot = p->u.ctl.slot + bestidx;
if (slot->name[0] != '\0')
slot->vol = MIDI_MAXCTL;
@@ -618,7 +626,8 @@ ctl_getidx(struct aproc *p, char *who)
slot->unit = unit;
#ifdef DEBUG
if (debug_level >= 3) {
- aproc_dbg(p);
+ dbg_puts(name);
+ dbg_putu(unit);
dbg_puts(": overwritten slot ");
dbg_putu(bestidx);
dbg_puts("\n");