mixer_us16x08.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __USB_MIXER_US16X08_H
  3. #define __USB_MIXER_US16X08_H
  4. #define SND_US16X08_MAX_CHANNELS 16
  5. /* define some bias, cause some alsa-mixers wont work with
  6. * negative ranges or if mixer-min != 0
  7. */
  8. #define SND_US16X08_NO_BIAS 0
  9. #define SND_US16X08_FADER_BIAS 127
  10. #define SND_US16X08_EQ_HIGHFREQ_BIAS 0x20
  11. #define SND_US16X08_COMP_THRESHOLD_BIAS 0x20
  12. #define SND_US16X08_COMP_ATTACK_BIAS 2
  13. #define SND_US16X08_COMP_RELEASE_BIAS 1
  14. /* get macro for components of kcontrol private_value */
  15. #define SND_US16X08_KCBIAS(x) (((x)->private_value >> 24) & 0xff)
  16. #define SND_US16X08_KCSTEP(x) (((x)->private_value >> 16) & 0xff)
  17. #define SND_US16X08_KCMIN(x) (((x)->private_value >> 8) & 0xff)
  18. #define SND_US16X08_KCMAX(x) (((x)->private_value >> 0) & 0xff)
  19. /* set macro for kcontrol private_value */
  20. #define SND_US16X08_KCSET(bias, step, min, max) \
  21. (((bias) << 24) | ((step) << 16) | ((min) << 8) | (max))
  22. /* the URB request/type to control Tascam mixers */
  23. #define SND_US16X08_URB_REQUEST 0x1D
  24. #define SND_US16X08_URB_REQUESTTYPE 0x40
  25. /* the URB params to retrieve meter ranges */
  26. #define SND_US16X08_URB_METER_REQUEST 0x1e
  27. #define SND_US16X08_URB_METER_REQUESTTYPE 0xc0
  28. #define MUA0(x, y) ((x)[(y) * 10 + 4])
  29. #define MUA1(x, y) ((x)[(y) * 10 + 5])
  30. #define MUA2(x, y) ((x)[(y) * 10 + 6])
  31. #define MUB0(x, y) ((x)[(y) * 10 + 7])
  32. #define MUB1(x, y) ((x)[(y) * 10 + 8])
  33. #define MUB2(x, y) ((x)[(y) * 10 + 9])
  34. #define MUC0(x, y) ((x)[(y) * 10 + 10])
  35. #define MUC1(x, y) ((x)[(y) * 10 + 11])
  36. #define MUC2(x, y) ((x)[(y) * 10 + 12])
  37. #define MUC3(x, y) ((x)[(y) * 10 + 13])
  38. /* Common Channel control IDs */
  39. #define SND_US16X08_ID_BYPASS 0x45
  40. #define SND_US16X08_ID_BUSS_OUT 0x44
  41. #define SND_US16X08_ID_PHASE 0x85
  42. #define SND_US16X08_ID_MUTE 0x83
  43. #define SND_US16X08_ID_FADER 0x81
  44. #define SND_US16X08_ID_PAN 0x82
  45. #define SND_US16X08_ID_METER 0xB1
  46. #define SND_US16X08_ID_EQ_BAND_COUNT 4
  47. #define SND_US16X08_ID_EQ_PARAM_COUNT 4
  48. /* EQ level IDs */
  49. #define SND_US16X08_ID_EQLOWLEVEL 0x01
  50. #define SND_US16X08_ID_EQLOWMIDLEVEL 0x02
  51. #define SND_US16X08_ID_EQHIGHMIDLEVEL 0x03
  52. #define SND_US16X08_ID_EQHIGHLEVEL 0x04
  53. /* EQ frequence IDs */
  54. #define SND_US16X08_ID_EQLOWFREQ 0x11
  55. #define SND_US16X08_ID_EQLOWMIDFREQ 0x12
  56. #define SND_US16X08_ID_EQHIGHMIDFREQ 0x13
  57. #define SND_US16X08_ID_EQHIGHFREQ 0x14
  58. /* EQ width IDs */
  59. #define SND_US16X08_ID_EQLOWMIDWIDTH 0x22
  60. #define SND_US16X08_ID_EQHIGHMIDWIDTH 0x23
  61. #define SND_US16X08_ID_EQENABLE 0x30
  62. #define EQ_STORE_BAND_IDX(x) ((x) & 0xf)
  63. #define EQ_STORE_PARAM_IDX(x) (((x) & 0xf0) >> 4)
  64. #define SND_US16X08_ID_ROUTE 0x00
  65. /* Compressor Ids */
  66. #define SND_US16X08_ID_COMP_BASE 0x32
  67. #define SND_US16X08_ID_COMP_THRESHOLD SND_US16X08_ID_COMP_BASE
  68. #define SND_US16X08_ID_COMP_RATIO (SND_US16X08_ID_COMP_BASE + 1)
  69. #define SND_US16X08_ID_COMP_ATTACK (SND_US16X08_ID_COMP_BASE + 2)
  70. #define SND_US16X08_ID_COMP_RELEASE (SND_US16X08_ID_COMP_BASE + 3)
  71. #define SND_US16X08_ID_COMP_GAIN (SND_US16X08_ID_COMP_BASE + 4)
  72. #define SND_US16X08_ID_COMP_SWITCH (SND_US16X08_ID_COMP_BASE + 5)
  73. #define SND_US16X08_ID_COMP_COUNT 6
  74. #define COMP_STORE_IDX(x) ((x) - SND_US16X08_ID_COMP_BASE)
  75. struct snd_us16x08_eq_store {
  76. u8 val[SND_US16X08_ID_EQ_BAND_COUNT][SND_US16X08_ID_EQ_PARAM_COUNT]
  77. [SND_US16X08_MAX_CHANNELS];
  78. };
  79. struct snd_us16x08_comp_store {
  80. u8 val[SND_US16X08_ID_COMP_COUNT][SND_US16X08_MAX_CHANNELS];
  81. };
  82. struct snd_us16x08_meter_store {
  83. int meter_level[SND_US16X08_MAX_CHANNELS];
  84. int master_level[2]; /* level of meter for master output */
  85. int comp_index; /* round trip channel selector */
  86. int comp_active_index; /* channel select from user space mixer */
  87. int comp_level[16]; /* compressor reduction level */
  88. struct snd_us16x08_comp_store *comp_store;
  89. };
  90. struct snd_us16x08_control_params {
  91. const struct snd_kcontrol_new *kcontrol_new;
  92. int control_id;
  93. int type;
  94. int num_channels;
  95. const char *name;
  96. int default_val;
  97. };
  98. #define snd_us16x08_switch_info snd_ctl_boolean_mono_info
  99. int snd_us16x08_controls_create(struct usb_mixer_interface *mixer);
  100. #endif /* __USB_MIXER_US16X08_H */