version 1.41, 2012/03/23 11:59:54 |
version 1.42, 2012/04/11 06:05:43 |
|
|
/* |
/* |
* length of voice and common messages (status byte included) |
* length of voice and common messages (status byte included) |
*/ |
*/ |
unsigned voice_len[] = { 3, 3, 3, 3, 2, 2, 3 }; |
unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 }; |
unsigned common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 }; |
unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 }; |
|
|
/* |
/* |
* call-back invoked periodically to implement throttling; at each invocation |
* call-back invoked periodically to implement throttling; at each invocation |
|
|
{ |
{ |
struct aproc *p = (struct aproc *)addr; |
struct aproc *p = (struct aproc *)addr; |
struct abuf *i, *inext; |
struct abuf *i, *inext; |
unsigned tickets; |
unsigned int tickets; |
|
|
timo_add(&p->u.midi.timo, MIDITHRU_TIMO); |
timo_add(&p->u.midi.timo, MIDITHRU_TIMO); |
|
|
|
|
* send a message to the given output |
* send a message to the given output |
*/ |
*/ |
void |
void |
midi_copy(struct abuf *ibuf, struct abuf *obuf, unsigned char *msg, unsigned len) |
midi_copy(struct abuf *ibuf, struct abuf *obuf, unsigned char *msg, |
|
unsigned int len) |
{ |
{ |
unsigned ocount; |
unsigned int ocount; |
unsigned char *odata; |
unsigned char *odata; |
|
|
if (msg[0] == SYSEX_START) |
if (msg[0] == SYSEX_START) |
|
|
* ie. don't sent back the message to the sender |
* ie. don't sent back the message to the sender |
*/ |
*/ |
void |
void |
midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg, unsigned len) |
midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg, |
|
unsigned int len) |
{ |
{ |
struct abuf *i, *inext; |
struct abuf *i, *inext; |
|
|
|
|
* send a quarter frame MTC message |
* send a quarter frame MTC message |
*/ |
*/ |
void |
void |
midi_send_qfr(struct aproc *p, unsigned rate, int delta) |
midi_send_qfr(struct aproc *p, unsigned int rate, int delta) |
{ |
{ |
unsigned char buf[2]; |
unsigned char buf[2]; |
unsigned data; |
unsigned int data; |
int qfrlen; |
int qfrlen; |
|
|
p->u.midi.delta += delta * MTC_SEC; |
p->u.midi.delta += delta * MTC_SEC; |
|
|
* send a full frame MTC message |
* send a full frame MTC message |
*/ |
*/ |
void |
void |
midi_send_full(struct aproc *p, unsigned origin, unsigned rate, unsigned round, unsigned pos) |
midi_send_full(struct aproc *p, unsigned int origin, unsigned int rate, |
|
unsigned int round, unsigned int pos) |
{ |
{ |
unsigned char buf[10]; |
unsigned char buf[10]; |
unsigned fps; |
unsigned int fps; |
|
|
p->u.midi.delta = MTC_SEC * pos; |
p->u.midi.delta = MTC_SEC * pos; |
if (rate % (30 * 4 * round) == 0) { |
if (rate % (30 * 4 * round) == 0) { |
|
|
void |
void |
midi_copy_dump(struct aproc *p, struct abuf *obuf) |
midi_copy_dump(struct aproc *p, struct abuf *obuf) |
{ |
{ |
unsigned i; |
unsigned int i; |
unsigned char msg[sizeof(struct sysex)]; |
unsigned char msg[sizeof(struct sysex)]; |
struct ctl_slot *s; |
struct ctl_slot *s; |
|
|
|
|
* call-back. |
* call-back. |
*/ |
*/ |
void |
void |
midi_send_vol(struct aproc *p, int slot, unsigned vol) |
midi_send_vol(struct aproc *p, int slot, unsigned int vol) |
{ |
{ |
unsigned char msg[3]; |
unsigned char msg[3]; |
|
|
|
|
midi_onvoice(struct aproc *p, struct abuf *ibuf) |
midi_onvoice(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
struct ctl_slot *slot; |
struct ctl_slot *slot; |
unsigned chan; |
unsigned int chan; |
#ifdef DEBUG |
#ifdef DEBUG |
unsigned i; |
unsigned int i; |
|
|
if (debug_level >= 3) { |
if (debug_level >= 3) { |
abuf_dbg(ibuf); |
abuf_dbg(ibuf); |
|
|
midi_onsysex(struct aproc *p, struct abuf *ibuf) |
midi_onsysex(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
struct sysex *x; |
struct sysex *x; |
unsigned fps, len; |
unsigned int fps, len; |
#ifdef DEBUG |
#ifdef DEBUG |
unsigned i; |
unsigned int i; |
|
|
if (debug_level >= 3) { |
if (debug_level >= 3) { |
abuf_dbg(ibuf); |
abuf_dbg(ibuf); |
|
|
midi_in(struct aproc *p, struct abuf *ibuf) |
midi_in(struct aproc *p, struct abuf *ibuf) |
{ |
{ |
unsigned char c, *idata; |
unsigned char c, *idata; |
unsigned i, icount; |
unsigned int i, icount; |
|
|
if (!ABUF_ROK(ibuf)) |
if (!ABUF_ROK(ibuf)) |
return 0; |
return 0; |