diff --git a/sndiod/dev.c b/sndiod/dev.c index a7d3292..e23c86d 100644 --- a/sndiod/dev.c +++ b/sndiod/dev.c @@ -132,9 +132,6 @@ slot_log(struct slot *s) static char *pstates[] = { "ini", "sta", "rdy", "run", "stp", "mid" }; - static char *tstates[] = { - "off", "sta", "run", "stp" - }; #endif log_puts(s->name); log_putu(s->unit); @@ -145,8 +142,6 @@ slot_log(struct slot *s) if (s->ops) { log_puts(",pst="); log_puts(pstates[s->pstate]); - log_puts(",mmc="); - log_puts(tstates[s->tstate]); } } #endif @@ -1000,7 +995,6 @@ dev_new(char *path, struct aparams *par, d->slot[i].unit = i; d->slot[i].ops = NULL; d->slot[i].vol = MIDI_MAXCTL; - d->slot[i].tstate = MMC_OFF; d->slot[i].serial = d->serial++; strlcpy(d->slot[i].name, "prog", SLOT_NAMEMAX); } @@ -1315,9 +1309,9 @@ dev_sync_attach(struct dev *d) } for (i = 0; i < DEV_NSLOT; i++) { s = d->slot + i; - if (!s->ops || s->tstate == MMC_OFF) + if (!s->ops || !s->opt->mmc) continue; - if (s->tstate != MMC_START || s->pstate != SLOT_READY) { + if (s->pstate != SLOT_READY) { #ifdef DEBUG if (log_level >= 3) { slot_log(s); @@ -1331,18 +1325,9 @@ dev_sync_attach(struct dev *d) return; for (i = 0; i < DEV_NSLOT; i++) { s = d->slot + i; - if (!s->ops) + if (!s->ops || !s->opt->mmc) continue; - if (s->tstate == MMC_START) { -#ifdef DEBUG - if (log_level >= 3) { - slot_log(s); - log_puts(": started\n"); - } -#endif - s->tstate = MMC_RUN; - slot_attach(s); - } + slot_attach(s); } d->tstate = MMC_RUN; dev_midi_full(d); @@ -1672,13 +1657,7 @@ found: s->mix.nch = s->opt->pmax - s->opt->pmin + 1; if (s->mode & MODE_RECMASK) s->sub.nch = s->opt->rmax - s->opt->rmin + 1; - if (s->opt->mmc) { - s->xrun = XRUN_SYNC; - s->tstate = MMC_STOP; - } else { - s->xrun = XRUN_IGNORE; - s->tstate = MMC_OFF; - } + s->xrun = s->opt->mmc ? XRUN_SYNC : XRUN_IGNORE; s->appbufsz = d->bufsz; s->round = d->round; s->rate = d->rate; @@ -1821,12 +1800,10 @@ slot_ready(struct slot *s) */ if (s->dev->pstate == DEV_CFG) return; - if (s->tstate == MMC_OFF) + if (!s->opt->mmc) slot_attach(s); - else { - s->tstate = MMC_START; + else dev_sync_attach(s->dev); - } } /* @@ -1923,9 +1900,6 @@ slot_stop(struct slot *s) slot_ready(s); } - if (s->tstate != MMC_OFF) - s->tstate = MMC_STOP; - if (s->pstate == SLOT_RUN) { if (s->mode & MODE_PLAY) { /* diff --git a/sndiod/dev.h b/sndiod/dev.h index ba784aa..4f91512 100644 --- a/sndiod/dev.h +++ b/sndiod/dev.h @@ -89,7 +89,6 @@ struct slot { unsigned int unit; /* instance of name */ unsigned int serial; /* global unique number */ unsigned int vol; /* current (midi) volume */ - unsigned int tstate; /* mmc state */ }; struct opt { @@ -190,7 +189,6 @@ struct dev { /* * MIDI machine control (MMC) */ -#define MMC_OFF 0 /* ignore MMC messages */ #define MMC_STOP 1 /* stopped, can't start */ #define MMC_START 2 /* attempting to start */ #define MMC_RUN 3 /* started */