^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __SOUND_SEQ_MIDI_EVENT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __SOUND_SEQ_MIDI_EVENT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * MIDI byte <-> sequencer event coder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Jaroslav Kysela <perex@perex.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <sound/asequencer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define MAX_MIDI_EVENT_BUF 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* midi status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct snd_midi_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) int qlen; /* queue length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int read; /* chars read */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int type; /* current event type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned char lastcmd; /* last command (for MIDI state handling) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned char nostat; /* no state flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int bufsize; /* allocated buffer size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned char *buf; /* input buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void snd_midi_event_free(struct snd_midi_event *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) void snd_midi_event_reset_encode(struct snd_midi_event *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void snd_midi_event_reset_decode(struct snd_midi_event *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) bool snd_midi_event_encode_byte(struct snd_midi_event *dev, unsigned char c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct snd_seq_event *ev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /* decode from event to bytes - return number of written bytes if success */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct snd_seq_event *ev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #endif /* __SOUND_SEQ_MIDI_EVENT_H */