version 1.28, 2010/07/06 01:12:45 |
version 1.29, 2010/10/21 18:57:42 |
|
|
umap |= (1 << i); |
umap |= (1 << i); |
} |
} |
for (unit = 0; ; unit++) { |
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; |
return -1; |
|
} |
if ((umap & (1 << unit)) == 0) |
if ((umap & (1 << unit)) == 0) |
break; |
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 |
* find a free controller slot with the same name/unit |
*/ |
*/ |
|
|
slot->unit == unit) { |
slot->unit == unit) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 3) { |
if (debug_level >= 3) { |
aproc_dbg(p); |
dbg_puts(name); |
|
dbg_putu(unit); |
dbg_puts(": found slot "); |
dbg_puts(": found slot "); |
dbg_putu(i); |
dbg_putu(i); |
dbg_puts("\n"); |
dbg_puts("\n"); |
|
|
bestidx = i; |
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; |
return -1; |
|
} |
slot = p->u.ctl.slot + bestidx; |
slot = p->u.ctl.slot + bestidx; |
if (slot->name[0] != '\0') |
if (slot->name[0] != '\0') |
slot->vol = MIDI_MAXCTL; |
slot->vol = MIDI_MAXCTL; |
|
|
slot->unit = unit; |
slot->unit = unit; |
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 3) { |
if (debug_level >= 3) { |
aproc_dbg(p); |
dbg_puts(name); |
|
dbg_putu(unit); |
dbg_puts(": overwritten slot "); |
dbg_puts(": overwritten slot "); |
dbg_putu(bestidx); |
dbg_putu(bestidx); |
dbg_puts("\n"); |
dbg_puts("\n"); |