Lines Matching refs:ev
46 static void note_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
47 static void one_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
48 static void pitchbend_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
49 static void two_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
50 static void one_param_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
51 static void songpos_event(struct snd_midi_event *dev, struct snd_seq_event *ev);
52 static void note_decode(struct snd_seq_event *ev, unsigned char *buf);
53 static void one_param_decode(struct snd_seq_event *ev, unsigned char *buf);
54 static void pitchbend_decode(struct snd_seq_event *ev, unsigned char *buf);
55 static void two_param_decode(struct snd_seq_event *ev, unsigned char *buf);
56 static void songpos_decode(struct snd_seq_event *ev, unsigned char *buf);
64 void (*encode)(struct snd_midi_event *dev, struct snd_seq_event *ev);
65 void (*decode)(struct snd_seq_event *ev, unsigned char *buf);
97 struct snd_seq_event *ev);
99 struct snd_seq_event *ev);
104 struct snd_seq_event *ev);
217 struct snd_seq_event *ev) in snd_midi_event_encode() argument
222 ev->type = SNDRV_SEQ_EVENT_NONE; in snd_midi_event_encode()
225 rc = snd_midi_event_encode_byte(dev, *buf++, ev); in snd_midi_event_encode()
243 struct snd_seq_event *ev) in snd_midi_event_encode_byte() argument
252 ev->type = status_event[ST_SPECIAL + c - 0xf0].event; in snd_midi_event_encode_byte()
253 ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; in snd_midi_event_encode_byte()
254 ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED; in snd_midi_event_encode_byte()
255 return ev->type != SNDRV_SEQ_EVENT_NONE; in snd_midi_event_encode_byte()
283 ev->type = status_event[dev->type].event; in snd_midi_event_encode_byte()
284 ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; in snd_midi_event_encode_byte()
285 ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED; in snd_midi_event_encode_byte()
287 status_event[dev->type].encode(dev, ev); in snd_midi_event_encode_byte()
294 ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; in snd_midi_event_encode_byte()
295 ev->flags |= SNDRV_SEQ_EVENT_LENGTH_VARIABLE; in snd_midi_event_encode_byte()
296 ev->type = SNDRV_SEQ_EVENT_SYSEX; in snd_midi_event_encode_byte()
297 ev->data.ext.len = dev->read; in snd_midi_event_encode_byte()
298 ev->data.ext.ptr = dev->buf; in snd_midi_event_encode_byte()
312 static void note_event(struct snd_midi_event *dev, struct snd_seq_event *ev) in note_event() argument
314 ev->data.note.channel = dev->buf[0] & 0x0f; in note_event()
315 ev->data.note.note = dev->buf[1]; in note_event()
316 ev->data.note.velocity = dev->buf[2]; in note_event()
320 static void one_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev) in one_param_ctrl_event() argument
322 ev->data.control.channel = dev->buf[0] & 0x0f; in one_param_ctrl_event()
323 ev->data.control.value = dev->buf[1]; in one_param_ctrl_event()
327 static void pitchbend_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev) in pitchbend_ctrl_event() argument
329 ev->data.control.channel = dev->buf[0] & 0x0f; in pitchbend_ctrl_event()
330 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192; in pitchbend_ctrl_event()
334 static void two_param_ctrl_event(struct snd_midi_event *dev, struct snd_seq_event *ev) in two_param_ctrl_event() argument
336 ev->data.control.channel = dev->buf[0] & 0x0f; in two_param_ctrl_event()
337 ev->data.control.param = dev->buf[1]; in two_param_ctrl_event()
338 ev->data.control.value = dev->buf[2]; in two_param_ctrl_event()
342 static void one_param_event(struct snd_midi_event *dev, struct snd_seq_event *ev) in one_param_event() argument
344 ev->data.control.value = dev->buf[1]; in one_param_event()
348 static void songpos_event(struct snd_midi_event *dev, struct snd_seq_event *ev) in songpos_event() argument
350 ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1]; in songpos_event()
358 struct snd_seq_event *ev) in snd_midi_event_decode() argument
362 if (ev->type == SNDRV_SEQ_EVENT_NONE) in snd_midi_event_decode()
366 if (ev->type == status_event[type].event) in snd_midi_event_decode()
370 if (ev->type == extra_event[type].event) in snd_midi_event_decode()
371 return extra_event[type].decode(dev, buf, count, ev); in snd_midi_event_decode()
380 cmd = 0x80 | (type << 4) | (ev->data.note.channel & 0x0f); in snd_midi_event_decode()
385 return snd_seq_expand_var_event(ev, count, buf, 1, 0); in snd_midi_event_decode()
397 status_event[type].decode(ev, xbuf + 1); in snd_midi_event_decode()
402 status_event[type].decode(ev, xbuf + 0); in snd_midi_event_decode()
414 static void note_decode(struct snd_seq_event *ev, unsigned char *buf) in note_decode() argument
416 buf[0] = ev->data.note.note & 0x7f; in note_decode()
417 buf[1] = ev->data.note.velocity & 0x7f; in note_decode()
421 static void one_param_decode(struct snd_seq_event *ev, unsigned char *buf) in one_param_decode() argument
423 buf[0] = ev->data.control.value & 0x7f; in one_param_decode()
427 static void pitchbend_decode(struct snd_seq_event *ev, unsigned char *buf) in pitchbend_decode() argument
429 int value = ev->data.control.value + 8192; in pitchbend_decode()
435 static void two_param_decode(struct snd_seq_event *ev, unsigned char *buf) in two_param_decode() argument
437 buf[0] = ev->data.control.param & 0x7f; in two_param_decode()
438 buf[1] = ev->data.control.value & 0x7f; in two_param_decode()
442 static void songpos_decode(struct snd_seq_event *ev, unsigned char *buf) in songpos_decode() argument
444 buf[0] = ev->data.control.value & 0x7f; in songpos_decode()
445 buf[1] = (ev->data.control.value >> 7) & 0x7f; in songpos_decode()
450 int count, struct snd_seq_event *ev) in extra_decode_ctrl14() argument
455 cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f); in extra_decode_ctrl14()
456 if (ev->data.control.param < 0x20) { in extra_decode_ctrl14()
466 buf[idx++] = ev->data.control.param; in extra_decode_ctrl14()
467 buf[idx++] = (ev->data.control.value >> 7) & 0x7f; in extra_decode_ctrl14()
470 buf[idx++] = ev->data.control.param + 0x20; in extra_decode_ctrl14()
471 buf[idx++] = ev->data.control.value & 0x7f; in extra_decode_ctrl14()
480 buf[idx++] = ev->data.control.param & 0x7f; in extra_decode_ctrl14()
481 buf[idx++] = ev->data.control.value & 0x7f; in extra_decode_ctrl14()
488 int count, struct snd_seq_event *ev) in extra_decode_xrpn() argument
507 cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f); in extra_decode_xrpn()
508 bytes[0] = (ev->data.control.param & 0x3f80) >> 7; in extra_decode_xrpn()
509 bytes[1] = ev->data.control.param & 0x007f; in extra_decode_xrpn()
510 bytes[2] = (ev->data.control.value & 0x3f80) >> 7; in extra_decode_xrpn()
511 bytes[3] = ev->data.control.value & 0x007f; in extra_decode_xrpn()
517 cbytes = ev->type == SNDRV_SEQ_EVENT_NONREGPARAM ? cbytes_nrpn : cbytes_rpn; in extra_decode_xrpn()