Home | History | Annotate | Download | only in seq

Lines Matching refs:ev

57 typedef void (*event_encode_t)(snd_midi_event_t *dev, snd_seq_event_t *ev);
58 typedef void (*event_decode_t)(const snd_seq_event_t *ev, unsigned char *buf);
65 static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
66 static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
67 static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
68 static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
69 static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
70 static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
71 static void note_decode(const snd_seq_event_t *ev, unsigned char *buf);
72 static void one_param_decode(const snd_seq_event_t *ev, unsigned char *buf);
73 static void pitchbend_decode(const snd_seq_event_t *ev, unsigned char *buf);
74 static void two_param_decode(const snd_seq_event_t *ev, unsigned char *buf);
75 static void songpos_decode(const snd_seq_event_t *ev, unsigned char *buf);
116 static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int len, const snd_seq_event_t *ev);
117 static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev);
121 int (*decode)(snd_midi_event_t *dev, unsigned char *buf, int len, const snd_seq_event_t *ev);
265 * \param ev Result - sequencer event
269 * If complete sequencer event is available, ev->type is not
272 long snd_midi_event_encode(snd_midi_event_t *dev, const unsigned char *buf, long count, snd_seq_event_t *ev)
277 ev->type = SND_SEQ_EVENT_NONE;
280 rc = snd_midi_event_encode_byte(dev, *buf++, ev);
295 * \param ev Result - sequencer event
300 int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev)
308 ev->type = status_event[ST_SPECIAL + c - 0xf0].event;
309 ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
310 ev->flags |= SND_SEQ_EVENT_LENGTH_FIXED;
311 return ev->type != SND_SEQ_EVENT_NONE;
338 ev->type = status_event[dev->type].event;
339 ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
340 ev->flags |= SND_SEQ_EVENT_LENGTH_FIXED;
342 status_event[dev->type].encode(dev, ev);
349 ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
350 ev->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE;
351 ev->type = SND_SEQ_EVENT_SYSEX;
352 ev->data.ext.len = dev->read;
353 ev->data.ext.ptr = dev->buf;
366 static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
368 ev->data.note.channel = dev->buf[0] & 0x0f;
369 ev->data.note.note = dev->buf[1];
370 ev->data.note.velocity = dev->buf[2];
374 static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
376 ev->data.control.channel = dev->buf[0] & 0x0f;
377 ev->data.control.value = dev->buf[1];
381 static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
383 ev->data.control.channel = dev->buf[0] & 0x0f;
384 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192;
388 static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
390 ev->data.control.channel = dev->buf[0] & 0x0f;
391 ev->data.control.param = dev->buf[1];
392 ev->data.control.value = dev->buf[2];
396 static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
398 ev->data.control.value = dev->buf[1];
402 static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
404 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1];
412 * \param ev Event to decode
417 long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, const snd_seq_event_t *ev)
423 if (ev->type == SND_SEQ_EVENT_NONE)
427 if (ev->type == status_event[type].event)
431 if (ev->type == extra_event[type].event)
432 return extra_event[type].decode(dev, buf, count, ev);
441 cmd = 0x80 | (type << 4) | (ev->data.note.channel & 0x0f);
445 qlen = ev->data.ext.len;
448 switch (ev->flags & SND_SEQ_EVENT_LENGTH_MASK) {
452 memcpy(buf, ev->data.ext.ptr, qlen);
461 status_event[type].decode(ev, xbuf + 1);
465 status_event[type].decode(ev, xbuf + 0);
477 static void note_decode(const snd_seq_event_t *ev, unsigned char *buf)
479 buf[0] = ev->data.note.note & 0x7f;
480 buf[1] = ev->data.note.velocity & 0x7f;
484 static void one_param_decode(const snd_seq_event_t *ev, unsigned char *buf)
486 buf[0] = ev->data.control.value & 0x7f;
490 static void pitchbend_decode(const snd_seq_event_t *ev, unsigned char *buf)
492 int value = ev->data.control.value + 8192;
498 static void two_param_decode(const snd_seq_event_t *ev, unsigned char *buf)
500 buf[0] = ev->data.control.param & 0x7f;
501 buf[1] = ev->data.control.value & 0x7f;
505 static void songpos_decode(const snd_seq_event_t *ev, unsigned char *buf)
507 buf[0] = ev->data.control.value & 0x7f;
508 buf[1] = (ev->data.control.value >> 7) & 0x7f;
512 static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev)
517 cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
518 if (ev->data.control.param < 32) {
528 buf[idx++] = ev->data.control.param;
529 buf[idx++] = (ev->data.control.value >> 7) & 0x7f;
532 buf[idx++] = ev->data.control.param + 32;
533 buf[idx++] = ev->data.control.value & 0x7f;
542 buf[idx++] = ev->data.control.param & 0x7f;
543 buf[idx++] = ev->data.control.value & 0x7f;
549 static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev)
568 cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
569 bytes[0] = ev->data.control.param & 0x007f;
570 bytes[1] = (ev->data.control.param & 0x3f80) >> 7;
571 bytes[2] = ev
572 bytes[3] = (ev->data.control.value & 0x3f80) >> 7;
578 cbytes = ev->type == SND_SEQ_EVENT_NONREGPARAM ? cbytes_nrpn : cbytes_rpn;