seq_virmidi.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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@perex.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 <sound/rawmidi.h>
  24. #include <sound/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 rw_semaphore filelist_sem;
  59. struct list_head filelist;
  60. };
  61. /* sequencer mode:
  62. * ATTACH = input/output events from midi device are routed to the
  63. * attached sequencer port. sequencer port is not created
  64. * by virmidi itself.
  65. * the input to rawmidi must be processed by passing the
  66. * incoming events via snd_virmidi_receive()
  67. * DISPATCH = input/output events are routed to subscribers.
  68. * sequencer port is created in virmidi.
  69. */
  70. #define SNDRV_VIRMIDI_SEQ_NONE 0
  71. #define SNDRV_VIRMIDI_SEQ_ATTACH 1
  72. #define SNDRV_VIRMIDI_SEQ_DISPATCH 2
  73. int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
  74. #endif /* __SOUND_SEQ_VIRMIDI */