-/* $OpenBSD: dev.c,v 1.80 2021/01/28 11:06:58 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.81 2021/01/28 11:10:00 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
void
slot_start(struct slot *s)
{
+ struct dev *d = s->dev;
#ifdef DEBUG
if (s->pstate != SLOT_INIT) {
slot_log(s);
log_puts(": playing ");
aparams_log(&s->par);
log_puts(" -> ");
- aparams_log(&s->dev->par);
+ aparams_log(&d->par);
log_puts("\n");
}
}
log_puts(": recording ");
aparams_log(&s->par);
log_puts(" <- ");
- aparams_log(&s->dev->par);
+ aparams_log(&d->par);
log_puts("\n");
}
}
/*
* N-th recorded block is the N-th played block
*/
- s->sub.prime = -dev_getpos(s->dev) / s->dev->round;
+ s->sub.prime = -dev_getpos(d) / d->round;
}
s->skip = 0;
* get the current position, the origin is when the first sample
* played and/or recorded
*/
- s->delta = dev_getpos(s->dev) * (int)s->round / (int)s->dev->round;
+ s->delta = dev_getpos(d) * (int)s->round / (int)d->round;
s->delta_rem = 0;
if (s->mode & MODE_PLAY) {
slot_detach(struct slot *s)
{
struct slot **ps;
- struct dev *d;
+ struct dev *d = s->dev;
long long pos;
-#ifdef DEBUG
- if (log_level >= 3) {
- slot_log(s);
- log_puts(": detaching\n");
- }
-#endif
- for (ps = &s->dev->slot_list; *ps != s; ps = &(*ps)->next) {
+ for (ps = &d->slot_list; *ps != s; ps = &(*ps)->next) {
#ifdef DEBUG
if (*ps == NULL) {
slot_log(s);
}
*ps = s->next;
- d = s->dev;
-
/*
* adjust clock, go back d->delta ticks so that slot_attach()
* could be called with the resulting state
}
#endif
if (s->mode & MODE_PLAY)
- dev_mix_adjvol(s->dev);
+ dev_mix_adjvol(d);
}
/*