seq_virmidi.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
  26. /*
  27. * device file instance:
  28. * This instance is created at each time the midi device file is
  29. * opened. Each instance has its own input buffer and MIDI parser
  30. * (buffer), and is associated with the device instance.
  31. */
  32. typedef struct _snd_virmidi {
  33. struct list_head list;
  34. int seq_mode;
  35. int client;
  36. int port;
  37. unsigned int trigger: 1;
  38. snd_midi_event_t *parser;
  39. snd_seq_event_t event;
  40. snd_virmidi_dev_t *rdev;
  41. snd_rawmidi_substream_t *substream;
  42. } snd_virmidi_t;
  43. #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
  44. #define SNDRV_VIRMIDI_USE (1<<1)
  45. /*
  46. * device record:
  47. * Each virtual midi device has one device instance. It contains
  48. * common information and the linked-list of opened files,
  49. */
  50. struct _snd_virmidi_dev {
  51. snd_card_t *card; /* associated card */
  52. snd_rawmidi_t *rmidi; /* rawmidi device */
  53. int seq_mode; /* SNDRV_VIRMIDI_XXX */
  54. int device; /* sequencer device */
  55. int client; /* created/attached client */
  56. int port; /* created/attached port */
  57. unsigned int flags; /* SNDRV_VIRMIDI_* */
  58. rwlock_t filelist_lock;
  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(snd_card_t *card, int device, snd_rawmidi_t **rrmidi);
  74. #endif /* __SOUND_SEQ_VIRMIDI */