mixer_abst.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * \file include/mixer_abst.h
  3. * \brief Mixer abstract implementation interface library for the ALSA library
  4. * \author Jaroslav Kysela <perex@perex.cz>
  5. * \date 2005
  6. *
  7. * Mixer abstact implementation interface library for the ALSA library
  8. */
  9. /*
  10. * This library is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU Lesser General Public License as
  12. * published by the Free Software Foundation; either version 2.1 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. */
  25. #ifndef __ALSA_MIXER_ABST_H
  26. #define __ALSA_MIXER_ABST_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /**
  31. * \defgroup Mixer_Abstract Mixer Abstact Module Interface
  32. * The mixer abstact module interface.
  33. * \{
  34. */
  35. #define SM_PLAY 0
  36. #define SM_CAPT 1
  37. #define SM_CAP_GVOLUME (1<<1)
  38. #define SM_CAP_GSWITCH (1<<2)
  39. #define SM_CAP_PVOLUME (1<<3)
  40. #define SM_CAP_PVOLUME_JOIN (1<<4)
  41. #define SM_CAP_PSWITCH (1<<5)
  42. #define SM_CAP_PSWITCH_JOIN (1<<6)
  43. #define SM_CAP_CVOLUME (1<<7)
  44. #define SM_CAP_CVOLUME_JOIN (1<<8)
  45. #define SM_CAP_CSWITCH (1<<9)
  46. #define SM_CAP_CSWITCH_JOIN (1<<10)
  47. #define SM_CAP_CSWITCH_EXCL (1<<11)
  48. #define SM_CAP_PENUM (1<<12)
  49. #define SM_CAP_CENUM (1<<13)
  50. /* SM_CAP_* 24-31 => private for module use */
  51. #define SM_OPS_IS_ACTIVE 0
  52. #define SM_OPS_IS_MONO 1
  53. #define SM_OPS_IS_CHANNEL 2
  54. #define SM_OPS_IS_ENUMERATED 3
  55. #define SM_OPS_IS_ENUMCNT 4
  56. #define sm_selem(x) ((sm_selem_t *)((x)->private_data))
  57. #define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops
  58. typedef struct _sm_selem {
  59. snd_mixer_selem_id_t *id;
  60. struct sm_elem_ops *ops;
  61. unsigned int caps;
  62. unsigned int capture_group;
  63. } sm_selem_t;
  64. typedef struct _sm_class_basic {
  65. char *device;
  66. snd_ctl_t *ctl;
  67. snd_hctl_t *hctl;
  68. snd_ctl_card_info_t *info;
  69. } sm_class_basic_t;
  70. struct sm_elem_ops {
  71. int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val);
  72. int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
  73. int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max);
  74. int (*get_dB_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
  75. int (*ask_vol_dB)(snd_mixer_elem_t *elem, int dir, long value, long *dbValue);
  76. int (*ask_dB_vol)(snd_mixer_elem_t *elem, int dir, long dbValue, long *value, int xdir);
  77. int (*get_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
  78. int (*get_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
  79. int (*set_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value);
  80. int (*set_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value, int xdir);
  81. int (*get_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int *value);
  82. int (*set_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value);
  83. int (*enum_item_name)(snd_mixer_elem_t *elem, unsigned int item, size_t maxlen, char *buf);
  84. int (*get_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp);
  85. int (*set_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int item);
  86. };
  87. int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
  88. int snd_mixer_sbasic_info(const snd_mixer_class_t *class, sm_class_basic_t *info);
  89. void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class);
  90. void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data);
  91. void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class));
  92. /** \} */
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif /* __ALSA_MIXER_ABST_H */