seq_virmidi.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __SOUND_SEQ_VIRMIDI_H
  2. #define __SOUND_SEQ_VIRMIDI_H
  3. /*
  4. * Virtual Raw MIDI client on Sequencer
  5. * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>,
  6. * Jaroslav Kysela <perex@suse.cz>
  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. #include "rawmidi.h"
  24. #include "seq_midi_event.h"
  25. /*
  26. * device file instance:
  27. * This instance is created at each time the midi device file is
  28. * opened. Each instance has its own input buffer and MIDI parser
  29. * (buffer), and is associated with the device instance.
  30. */
  31. struct snd_virmidi {
  32. struct list_head list;
  33. int seq_mode;
  34. int client;
  35. int port;
  36. unsigned int trigger: 1;
  37. struct snd_midi_event *parser;
  38. struct snd_seq_event event;
  39. struct snd_virmidi_dev *rdev;
  40. struct snd_rawmidi_substream *substream;
  41. };
  42. #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
  43. #define SNDRV_VIRMIDI_USE (1<<1)
  44. /*
  45. * device record:
  46. * Each virtual midi device has one device instance. It contains
  47. * common information and the linked-list of opened files,
  48. */
  49. struct snd_virmidi_dev {
  50. struct snd_card *card; /* associated card */
  51. struct snd_rawmidi *rmidi; /* rawmidi device */
  52. int seq_mode; /* SNDRV_VIRMIDI_XXX */
  53. int device; /* sequencer device */
  54. int client; /* created/attached client */
  55. int port; /* created/attached port */
  56. unsigned int flags; /* SNDRV_VIRMIDI_* */
  57. rwlock_t filelist_lock;
  58. struct list_head filelist;
  59. };
  60. /* sequencer mode:
  61. * ATTACH = input/output events from midi device are routed to the
  62. * attached sequencer port. sequencer port is not created
  63. * by virmidi itself.
  64. * the input to rawmidi must be processed by passing the
  65. * incoming events via snd_virmidi_receive()
  66. * DISPATCH = input/output events are routed to subscribers.
  67. * sequencer port is created in virmidi.
  68. */
  69. #define SNDRV_VIRMIDI_SEQ_NONE 0
  70. #define SNDRV_VIRMIDI_SEQ_ATTACH 1
  71. #define SNDRV_VIRMIDI_SEQ_DISPATCH 2
  72. int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
  73. #endif /* __SOUND_SEQ_VIRMIDI */