seq_oss_event.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #ifndef __SEQ_OSS_EVENT_H
  23. #define __SEQ_OSS_EVENT_H
  24. #include "seq_oss_device.h"
  25. #define SHORT_EVENT_SIZE 4
  26. #define LONG_EVENT_SIZE 8
  27. /* short event (4bytes) */
  28. struct evrec_short {
  29. unsigned char code;
  30. unsigned char parm1;
  31. unsigned char dev;
  32. unsigned char parm2;
  33. };
  34. /* short note events (4bytes) */
  35. struct evrec_note {
  36. unsigned char code;
  37. unsigned char chn;
  38. unsigned char note;
  39. unsigned char vel;
  40. };
  41. /* long timer events (8bytes) */
  42. struct evrec_timer {
  43. unsigned char code;
  44. unsigned char cmd;
  45. unsigned char dummy1, dummy2;
  46. unsigned int time;
  47. };
  48. /* long extended events (8bytes) */
  49. struct evrec_extended {
  50. unsigned char code;
  51. unsigned char cmd;
  52. unsigned char dev;
  53. unsigned char chn;
  54. unsigned char p1, p2, p3, p4;
  55. };
  56. /* long channel events (8bytes) */
  57. struct evrec_long {
  58. unsigned char code;
  59. unsigned char dev;
  60. unsigned char cmd;
  61. unsigned char chn;
  62. unsigned char p1, p2;
  63. unsigned short val;
  64. };
  65. /* channel voice events (8bytes) */
  66. struct evrec_voice {
  67. unsigned char code;
  68. unsigned char dev;
  69. unsigned char cmd;
  70. unsigned char chn;
  71. unsigned char note, parm;
  72. unsigned short dummy;
  73. };
  74. /* sysex events (8bytes) */
  75. struct evrec_sysex {
  76. unsigned char code;
  77. unsigned char dev;
  78. unsigned char buf[6];
  79. };
  80. /* event record */
  81. union evrec {
  82. struct evrec_short s;
  83. struct evrec_note n;
  84. struct evrec_long l;
  85. struct evrec_voice v;
  86. struct evrec_timer t;
  87. struct evrec_extended e;
  88. struct evrec_sysex x;
  89. unsigned int echo;
  90. unsigned char c[LONG_EVENT_SIZE];
  91. };
  92. #define ev_is_long(ev) ((ev)->s.code >= 128)
  93. #define ev_length(ev) ((ev)->s.code >= 128 ? LONG_EVENT_SIZE : SHORT_EVENT_SIZE)
  94. int snd_seq_oss_process_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev);
  95. int snd_seq_oss_process_timer_event(struct seq_oss_timer *rec, union evrec *q);
  96. int snd_seq_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
  97. #endif /* __SEQ_OSS_EVENT_H */