rawmidi.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /**
  2. * \file include/rawmidi.h
  3. * \brief Application interface library for the ALSA driver
  4. * \author Jaroslav Kysela <perex@perex.cz>
  5. * \author Abramo Bagnara <abramo@alsa-project.org>
  6. * \author Takashi Iwai <tiwai@suse.de>
  7. * \date 1998-2001
  8. *
  9. * Application interface library for the ALSA driver
  10. */
  11. /*
  12. * This library is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU Lesser General Public License as
  14. * published by the Free Software Foundation; either version 2.1 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Lesser General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Lesser General Public
  23. * License along with this library; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. *
  26. */
  27. #ifndef __ALSA_RAWMIDI_H
  28. #define __ALSA_RAWMIDI_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /**
  33. * \defgroup RawMidi RawMidi Interface
  34. * The RawMidi Interface. See \ref rawmidi page for more details.
  35. * \{
  36. */
  37. /** dlsym version for interface entry callback */
  38. #define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
  39. /** RawMidi information container */
  40. typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
  41. /** RawMidi settings container */
  42. typedef struct _snd_rawmidi_params snd_rawmidi_params_t;
  43. /** RawMidi status container */
  44. typedef struct _snd_rawmidi_status snd_rawmidi_status_t;
  45. /** RawMidi stream (direction) */
  46. typedef enum _snd_rawmidi_stream {
  47. /** Output stream */
  48. SND_RAWMIDI_STREAM_OUTPUT = 0,
  49. /** Input stream */
  50. SND_RAWMIDI_STREAM_INPUT,
  51. SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
  52. } snd_rawmidi_stream_t;
  53. /** Append (flag to open mode) \hideinitializer */
  54. #define SND_RAWMIDI_APPEND 0x0001
  55. /** Non blocking mode (flag to open mode) \hideinitializer */
  56. #define SND_RAWMIDI_NONBLOCK 0x0002
  57. /** Write sync mode (Flag to open mode) \hideinitializer */
  58. #define SND_RAWMIDI_SYNC 0x0004
  59. /** RawMidi handle */
  60. typedef struct _snd_rawmidi snd_rawmidi_t;
  61. /** RawMidi type */
  62. typedef enum _snd_rawmidi_type {
  63. /** Kernel level RawMidi */
  64. SND_RAWMIDI_TYPE_HW,
  65. /** Shared memory client RawMidi (not yet implemented) */
  66. SND_RAWMIDI_TYPE_SHM,
  67. /** INET client RawMidi (not yet implemented) */
  68. SND_RAWMIDI_TYPE_INET,
  69. /** Virtual (sequencer) RawMidi */
  70. SND_RAWMIDI_TYPE_VIRTUAL
  71. } snd_rawmidi_type_t;
  72. int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
  73. const char *name, int mode);
  74. int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
  75. const char *name, int mode, snd_config_t *lconf);
  76. int snd_rawmidi_close(snd_rawmidi_t *rmidi);
  77. int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
  78. int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
  79. int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
  80. int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
  81. size_t snd_rawmidi_info_sizeof(void);
  82. /** \hideinitializer
  83. * \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
  84. * \param ptr returned pointer
  85. */
  86. #define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
  87. int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
  88. void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
  89. void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
  90. unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
  91. unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
  92. snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
  93. int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
  94. unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
  95. const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
  96. const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
  97. const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
  98. unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
  99. unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
  100. void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
  101. void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
  102. void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
  103. int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
  104. size_t snd_rawmidi_params_sizeof(void);
  105. /** \hideinitializer
  106. * \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
  107. * \param ptr returned pointer
  108. */
  109. #define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
  110. int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
  111. void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
  112. void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
  113. int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
  114. size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
  115. int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
  116. size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
  117. int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
  118. int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
  119. int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
  120. int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
  121. size_t snd_rawmidi_status_sizeof(void);
  122. /** \hideinitializer
  123. * \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
  124. * \param ptr returned pointer
  125. */
  126. #define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
  127. int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
  128. void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
  129. void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
  130. void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
  131. size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
  132. size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
  133. int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
  134. int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
  135. int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
  136. ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
  137. ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
  138. const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
  139. snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
  140. snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
  141. /** \} */
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145. #endif /* __RAWMIDI_H */