1 /* 2 * OSS compatible sequencer driver 3 * 4 * seq_oss_event.h - OSS event queue record 5 * 6 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 #ifndef __SEQ_OSS_EVENT_H 24 #define __SEQ_OSS_EVENT_H 25 26 #include "seq_oss_device.h" 27 28 #define SHORT_EVENT_SIZE 4 29 #define LONG_EVENT_SIZE 8 30 31 /* short event (4bytes) */ 32 struct evrec_short { 33 unsigned char code; 34 unsigned char parm1; 35 unsigned char dev; 36 unsigned char parm2; 37 }; 38 39 /* short note events (4bytes) */ 40 struct evrec_note { 41 unsigned char code; 42 unsigned char chn; 43 unsigned char note; 44 unsigned char vel; 45 }; 46 47 /* long timer events (8bytes) */ 48 struct evrec_timer { 49 unsigned char code; 50 unsigned char cmd; 51 unsigned char dummy1, dummy2; 52 unsigned int time; 53 }; 54 55 /* long extended events (8bytes) */ 56 struct evrec_extended { 57 unsigned char code; 58 unsigned char cmd; 59 unsigned char dev; 60 unsigned char chn; 61 unsigned char p1, p2, p3, p4; 62 }; 63 64 /* long channel events (8bytes) */ 65 struct evrec_long { 66 unsigned char code; 67 unsigned char dev; 68 unsigned char cmd; 69 unsigned char chn; 70 unsigned char p1, p2; 71 unsigned short val; 72 }; 73 74 /* channel voice events (8bytes) */ 75 struct evrec_voice { 76 unsigned char code; 77 unsigned char dev; 78 unsigned char cmd; 79 unsigned char chn; 80 unsigned char note, parm; 81 unsigned short dummy; 82 }; 83 84 /* sysex events (8bytes) */ 85 struct evrec_sysex { 86 unsigned char code; 87 unsigned char dev; 88 unsigned char buf[6]; 89 }; 90 91 /* event record */ 92 union evrec { 93 struct evrec_short s; 94 struct evrec_note n; 95 struct evrec_long l; 96 struct evrec_voice v; 97 struct evrec_timer t; 98 struct evrec_extended e; 99 struct evrec_sysex x; 100 unsigned int echo; 101 unsigned char c[LONG_EVENT_SIZE]; 102 }; 103 104 #define ev_is_long(ev) ((ev)->s.code >= 128) 105 #define ev_length(ev) ((ev)->s.code >= 128 ? LONG_EVENT_SIZE : SHORT_EVENT_SIZE) 106 107 int snd_seq_oss_process_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev); 108 int snd_seq_oss_process_timer_event(struct seq_oss_timer *rec, union evrec *q); 109 int snd_seq_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop); 110 111 112 #endif /* __SEQ_OSS_EVENT_H */ 113