version 1.48, 2010/06/04 06:15:28 |
version 1.49, 2010/06/05 12:45:48 |
|
|
f->xrun = AMSG_IGNORE; |
f->xrun = AMSG_IGNORE; |
f->delta = 0; |
f->delta = 0; |
f->tickpending = 0; |
f->tickpending = 0; |
|
f->startpos = 0; |
f->startpending = 0; |
f->startpending = 0; |
f->vol = f->lastvol = MIDI_MAXCTL; |
f->vol = f->lastvol = MIDI_MAXCTL; |
f->slot = -1; |
f->slot = -1; |
|
|
f->walign = f->round; |
f->walign = f->round; |
} |
} |
f->delta = 0; |
f->delta = 0; |
|
f->startpos = 0; |
f->wmax = 0; |
f->wmax = 0; |
f->rmax = f->bufsz; |
f->rmax = f->bufsz; |
f->tickpending = 0; |
f->tickpending = 0; |
|
|
* get the current position, the origin is when |
* get the current position, the origin is when |
* the first sample is played/recorded |
* the first sample is played/recorded |
*/ |
*/ |
f->delta = dev_getpos(f->dev) * (int)f->round / (int)f->dev->round; |
f->startpos = dev_getpos(f->dev) * (int)f->round / (int)f->dev->round; |
f->startpending = 1; |
f->startpending = 1; |
f->pstate = SOCK_RUN; |
f->pstate = SOCK_RUN; |
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 3) { |
if (debug_level >= 3) { |
sock_dbg(f); |
sock_dbg(f); |
dbg_puts(": attaching at "); |
dbg_puts(": attaching at "); |
dbg_puti(f->delta); |
dbg_puti(f->startpos); |
dbg_puts("\n"); |
dbg_puts("\n"); |
} |
} |
#endif |
#endif |
|
|
} |
} |
|
|
/* |
/* |
|
* Send initial position |
|
*/ |
|
if (f->startpending) { |
|
#ifdef DEBUG |
|
if (debug_level >= 4) { |
|
sock_dbg(f); |
|
dbg_puts(": building POS message, pos = "); |
|
dbg_puti(f->startpos); |
|
dbg_puts("\n"); |
|
} |
|
#endif |
|
AMSG_INIT(&f->wmsg); |
|
f->wmsg.cmd = AMSG_POS; |
|
f->wmsg.u.ts.delta = f->startpos; |
|
f->wtodo = sizeof(struct amsg); |
|
f->wstate = SOCK_WMSG; |
|
f->startpending = 0; |
|
return 1; |
|
} |
|
|
|
/* |
* If pos changed, build a MOVE message. |
* If pos changed, build a MOVE message. |
*/ |
*/ |
if ((f->tickpending && f->delta > 0) || f->startpending) { |
if (f->tickpending) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (debug_level >= 4) { |
if (debug_level >= 4) { |
sock_dbg(f); |
sock_dbg(f); |
dbg_puts(": building POS message, delta = "); |
dbg_puts(": building MOVE message, delta = "); |
dbg_puti(f->delta); |
dbg_puti(f->delta); |
dbg_puts("\n"); |
dbg_puts("\n"); |
} |
} |
#endif |
#endif |
f->wmax += f->delta; |
f->wmax += f->delta; |
if (f->delta > 0) |
f->rmax += f->delta; |
f->rmax += f->delta; |
|
AMSG_INIT(&f->wmsg); |
AMSG_INIT(&f->wmsg); |
f->wmsg.cmd = AMSG_MOVE; |
f->wmsg.cmd = AMSG_MOVE; |
f->wmsg.u.ts.delta = f->delta; |
f->wmsg.u.ts.delta = f->delta; |
|
|
f->wstate = SOCK_WMSG; |
f->wstate = SOCK_WMSG; |
f->delta = 0; |
f->delta = 0; |
f->tickpending = 0; |
f->tickpending = 0; |
f->startpending = 0; |
|
return 1; |
return 1; |
} |
} |
|
|