version 1.14, 2014/11/21 09:05:38 |
version 1.15, 2015/02/16 06:35:17 |
|
|
{ |
{ |
static unsigned char dummy[AMSG_DATAMAX]; |
static unsigned char dummy[AMSG_DATAMAX]; |
unsigned char *data = NULL; |
unsigned char *data = NULL; |
struct abuf *buf = NULL; |
|
int n, count; |
int n, count; |
|
|
#ifdef DEBUG |
#ifdef DEBUG |
|
|
#endif |
#endif |
return 1; |
return 1; |
} |
} |
if (f->slot) |
|
buf = &f->slot->sub.buf; |
|
else |
|
buf = &f->midi->obuf; |
|
while (f->wtodo > 0) { |
while (f->wtodo > 0) { |
data = abuf_rgetblk(buf, &count); |
if (f->slot) |
|
data = abuf_rgetblk(&f->slot->sub.buf, &count); |
|
else if (f->midi) |
|
data = abuf_rgetblk(&f->midi->obuf, &count); |
if (count > f->wtodo) |
if (count > f->wtodo) |
count = f->wtodo; |
count = f->wtodo; |
n = sock_fdwrite(f, data, count); |
n = sock_fdwrite(f, data, count); |
if (n == 0) |
if (n == 0) |
return 0; |
return 0; |
f->wtodo -= n; |
f->wtodo -= n; |
abuf_rdiscard(buf, n); |
if (f->slot) |
|
abuf_rdiscard(&f->slot->sub.buf, n); |
|
else if (f->midi) |
|
abuf_rdiscard(&f->midi->obuf, n); |
} |
} |
if (f->slot) |
if (f->slot) |
slot_read(f->slot); |
slot_read(f->slot); |
|
|
log_puts(": START message\n"); |
log_puts(": START message\n"); |
} |
} |
#endif |
#endif |
if (f->pstate != SOCK_INIT) { |
if (f->pstate != SOCK_INIT || s == NULL) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (log_level >= 1) { |
if (log_level >= 1) { |
sock_log(f); |
sock_log(f); |
|
|
log_puts(": SETPAR message\n"); |
log_puts(": SETPAR message\n"); |
} |
} |
#endif |
#endif |
if (f->pstate != SOCK_INIT) { |
if (f->pstate != SOCK_INIT || s == NULL) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (log_level >= 1) { |
if (log_level >= 1) { |
sock_log(f); |
sock_log(f); |
|
|
log_puts(": GETPAR message\n"); |
log_puts(": GETPAR message\n"); |
} |
} |
#endif |
#endif |
if (f->pstate != SOCK_INIT) { |
if (f->pstate != SOCK_INIT || s == NULL) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (log_level >= 1) { |
if (log_level >= 1) { |
sock_log(f); |
sock_log(f); |
|
|
log_puts(": SETVOL message\n"); |
log_puts(": SETVOL message\n"); |
} |
} |
#endif |
#endif |
if (f->pstate < SOCK_INIT) { |
if (f->pstate < SOCK_INIT || s == NULL) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (log_level >= 1) { |
if (log_level >= 1) { |
sock_log(f); |
sock_log(f); |
|
|
f->rtodo = sizeof(struct amsg); |
f->rtodo = sizeof(struct amsg); |
f->rstate = SOCK_RMSG; |
f->rstate = SOCK_RMSG; |
f->lastvol = ctl; /* dont trigger feedback message */ |
f->lastvol = ctl; /* dont trigger feedback message */ |
dev_midi_vol(s->dev, s); |
|
slot_setvol(s, ctl); |
slot_setvol(s, ctl); |
|
dev_midi_vol(s->dev, s); |
break; |
break; |
case AMSG_AUTH: |
case AMSG_AUTH: |
#ifdef DEBUG |
#ifdef DEBUG |