Symbol: mtc
usr.bin/sndiod/dev.c
1137
mtc_trigger(struct mtc *mtc)
usr.bin/sndiod/dev.c
1142
if (mtc->tstate != MTC_START) {
usr.bin/sndiod/dev.c
1143
logx(2, "%s: not started by mmc yet, waiting.", mtc->dev->path);
usr.bin/sndiod/dev.c
1148
if (s->opt == NULL || s->opt->mtc != mtc)
usr.bin/sndiod/dev.c
1157
if (!dev_ref(mtc->dev))
usr.bin/sndiod/dev.c
1161
if (s->opt == NULL || s->opt->mtc != mtc)
usr.bin/sndiod/dev.c
1166
mtc->tstate = MTC_RUN;
usr.bin/sndiod/dev.c
1167
mtc_midi_full(mtc);
usr.bin/sndiod/dev.c
1168
dev_wakeup(mtc->dev);
usr.bin/sndiod/dev.c
1175
mtc_start(struct mtc *mtc)
usr.bin/sndiod/dev.c
1177
if (mtc->tstate == MTC_STOP) {
usr.bin/sndiod/dev.c
1178
mtc->tstate = MTC_START;
usr.bin/sndiod/dev.c
1179
mtc_trigger(mtc);
usr.bin/sndiod/dev.c
1182
logx(3, "%s: ignoring mmc start", mtc->dev->path);
usr.bin/sndiod/dev.c
1191
mtc_stop(struct mtc *mtc)
usr.bin/sndiod/dev.c
1193
switch (mtc->tstate) {
usr.bin/sndiod/dev.c
1195
mtc->tstate = MTC_STOP;
usr.bin/sndiod/dev.c
1198
mtc->tstate = MTC_STOP;
usr.bin/sndiod/dev.c
1199
dev_unref(mtc->dev);
usr.bin/sndiod/dev.c
1203
logx(3, "%s: ignored mmc stop", mtc->dev->path);
usr.bin/sndiod/dev.c
1213
mtc_loc(struct mtc *mtc, unsigned int origin)
usr.bin/sndiod/dev.c
1215
logx(2, "%s: relocated to %u", mtc->dev->path, origin);
usr.bin/sndiod/dev.c
1217
if (mtc->tstate == MTC_RUN)
usr.bin/sndiod/dev.c
1218
mtc_stop(mtc);
usr.bin/sndiod/dev.c
1219
mtc->origin = origin;
usr.bin/sndiod/dev.c
1220
if (mtc->tstate == MTC_RUN)
usr.bin/sndiod/dev.c
1221
mtc_start(mtc);
usr.bin/sndiod/dev.c
1228
mtc_setdev(struct mtc *mtc, struct dev *d)
usr.bin/sndiod/dev.c
1232
if (mtc->dev == d)
usr.bin/sndiod/dev.c
1238
if (mtc->tstate == MTC_RUN) {
usr.bin/sndiod/dev.c
1239
mtc->delta -= mtc->dev->delta;
usr.bin/sndiod/dev.c
1240
dev_unref(mtc->dev);
usr.bin/sndiod/dev.c
1243
mtc->dev = d;
usr.bin/sndiod/dev.c
1245
if (mtc->tstate == MTC_RUN) {
usr.bin/sndiod/dev.c
1246
mtc->delta += mtc->dev->delta;
usr.bin/sndiod/dev.c
1247
dev_ref(mtc->dev);
usr.bin/sndiod/dev.c
1248
dev_wakeup(mtc->dev);
usr.bin/sndiod/dev.c
1253
if (o->mtc == mtc)
usr.bin/sndiod/dev.c
1254
opt_setdev(o, mtc->dev);
usr.bin/sndiod/dev.c
1416
s->xrun = s->opt->mtc != NULL ? XRUN_SYNC : XRUN_IGNORE;
usr.bin/sndiod/dev.c
1537
if (s->opt->mtc == NULL) {
usr.bin/sndiod/dev.c
1541
mtc_trigger(s->opt->mtc);
usr.bin/sndiod/dev.c
177
mtc_midi_qfr(struct mtc *mtc, int delta)
usr.bin/sndiod/dev.c
183
mtc->delta += delta * MTC_SEC;
usr.bin/sndiod/dev.c
184
qfrlen = mtc->dev->rate * (MTC_SEC / (4 * mtc->fps));
usr.bin/sndiod/dev.c
185
while (mtc->delta >= qfrlen) {
usr.bin/sndiod/dev.c
186
switch (mtc->qfr) {
usr.bin/sndiod/dev.c
188
data = mtc->fr & 0xf;
usr.bin/sndiod/dev.c
191
data = mtc->fr >> 4;
usr.bin/sndiod/dev.c
194
data = mtc->sec & 0xf;
usr.bin/sndiod/dev.c
197
data = mtc->sec >> 4;
usr.bin/sndiod/dev.c
200
data = mtc->min & 0xf;
usr.bin/sndiod/dev.c
203
data = mtc->min >> 4;
usr.bin/sndiod/dev.c
206
data = mtc->hr & 0xf;
usr.bin/sndiod/dev.c
209
data = (mtc->hr >> 4) | (mtc->fps_id << 1);
usr.bin/sndiod/dev.c
213
mtc->fr += 2;
usr.bin/sndiod/dev.c
214
if (mtc->fr < mtc->fps)
usr.bin/sndiod/dev.c
216
mtc->fr -= mtc->fps;
usr.bin/sndiod/dev.c
217
mtc->sec++;
usr.bin/sndiod/dev.c
218
if (mtc->sec < 60)
usr.bin/sndiod/dev.c
220
mtc->sec = 0;
usr.bin/sndiod/dev.c
221
mtc->min++;
usr.bin/sndiod/dev.c
222
if (mtc->min < 60)
usr.bin/sndiod/dev.c
224
mtc->min = 0;
usr.bin/sndiod/dev.c
225
mtc->hr++;
usr.bin/sndiod/dev.c
226
if (mtc->hr < 24)
usr.bin/sndiod/dev.c
228
mtc->hr = 0;
usr.bin/sndiod/dev.c
235
buf[1] = (mtc->qfr << 4) | data;
usr.bin/sndiod/dev.c
236
mtc->qfr++;
usr.bin/sndiod/dev.c
237
mtc->qfr &= 7;
usr.bin/sndiod/dev.c
238
dev_midi_send(mtc->dev, buf, 2);
usr.bin/sndiod/dev.c
239
mtc->delta -= qfrlen;
usr.bin/sndiod/dev.c
247
mtc_midi_full(struct mtc *mtc)
usr.bin/sndiod/dev.c
252
mtc->delta = -MTC_SEC * (int)mtc->dev->bufsz;
usr.bin/sndiod/dev.c
253
if (mtc->dev->rate % (30 * 4 * mtc->dev->round) == 0) {
usr.bin/sndiod/dev.c
254
mtc->fps_id = MTC_FPS_30;
usr.bin/sndiod/dev.c
255
mtc->fps = 30;
usr.bin/sndiod/dev.c
256
} else if (mtc->dev->rate % (25 * 4 * mtc->dev->round) == 0) {
usr.bin/sndiod/dev.c
257
mtc->fps_id = MTC_FPS_25;
usr.bin/sndiod/dev.c
258
mtc->fps = 25;
usr.bin/sndiod/dev.c
260
mtc->fps_id = MTC_FPS_24;
usr.bin/sndiod/dev.c
261
mtc->fps = 24;
usr.bin/sndiod/dev.c
264
logx(3, "%s: mtc full frame at %d, %d fps", mtc->dev->path, mtc->delta, mtc->fps);
usr.bin/sndiod/dev.c
266
fps = mtc->fps;
usr.bin/sndiod/dev.c
267
mtc->hr = (mtc->origin / (MTC_SEC * 3600)) % 24;
usr.bin/sndiod/dev.c
268
mtc->min = (mtc->origin / (MTC_SEC * 60)) % 60;
usr.bin/sndiod/dev.c
269
mtc->sec = (mtc->origin / (MTC_SEC)) % 60;
usr.bin/sndiod/dev.c
270
mtc->fr = (mtc->origin / (MTC_SEC / fps)) % fps;
usr.bin/sndiod/dev.c
277
x.u.full.hr = mtc->hr | (mtc->fps_id << 5);
usr.bin/sndiod/dev.c
278
x.u.full.min = mtc->min;
usr.bin/sndiod/dev.c
279
x.u.full.sec = mtc->sec;
usr.bin/sndiod/dev.c
280
x.u.full.fr = mtc->fr;
usr.bin/sndiod/dev.c
282
mtc->qfr = 0;
usr.bin/sndiod/dev.c
283
dev_midi_send(mtc->dev, (unsigned char *)&x, SYSEX_SIZE(full));
usr.bin/sndiod/dev.c
86
struct mtc mtc_array[1] = {
usr.bin/sndiod/dev.h
276
extern struct mtc mtc_array[1];
usr.bin/sndiod/dev.h
308
void mtc_midi_qfr(struct mtc *, int);
usr.bin/sndiod/dev.h
309
void mtc_midi_full(struct mtc *);
usr.bin/sndiod/dev.h
310
void mtc_trigger(struct mtc *);
usr.bin/sndiod/dev.h
311
void mtc_start(struct mtc *);
usr.bin/sndiod/dev.h
312
void mtc_stop(struct mtc *);
usr.bin/sndiod/dev.h
313
void mtc_loc(struct mtc *, unsigned int);
usr.bin/sndiod/dev.h
314
void mtc_setdev(struct mtc *, struct dev *);
usr.bin/sndiod/opt.c
186
if (o->mtc == NULL)
usr.bin/sndiod/opt.c
188
mtc_setdev(o->mtc, o->dev);
usr.bin/sndiod/opt.c
190
mtc_stop(o->mtc);
usr.bin/sndiod/opt.c
195
if (o->mtc == NULL)
usr.bin/sndiod/opt.c
197
mtc_setdev(o->mtc, o->dev);
usr.bin/sndiod/opt.c
199
mtc_start(o->mtc);
usr.bin/sndiod/opt.c
206
if (o->mtc == NULL)
usr.bin/sndiod/opt.c
208
mtc_setdev(o->mtc, o->dev);
usr.bin/sndiod/opt.c
220
mtc_stop(o->mtc);
usr.bin/sndiod/opt.c
223
mtc_loc(o->mtc,
usr.bin/sndiod/opt.c
390
o->mtc = mmc ? &mtc_array[0] : NULL;
usr.bin/sndiod/opt.c
542
if (o->mtc != NULL && o->mtc->dev != ndev) {
usr.bin/sndiod/opt.c
543
mtc_setdev(o->mtc, ndev);
usr.bin/sndiod/opt.h
42
struct mtc *mtc; /* if set, MMC-controlled MTC source */
usr.bin/sndiod/sndiod.c
702
o->maxweight, o->mtc != NULL, o->dup, o->mode) == NULL)
usr.bin/sndiod/sock.c
660
if (s->opt->mtc != NULL && s->xrun == XRUN_IGNORE)