123 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef __USB_MIXER_US16X08_H3#define __USB_MIXER_US16X08_H4 5#define SND_US16X08_MAX_CHANNELS 166 7/* define some bias, cause some alsa-mixers wont work with8 * negative ranges or if mixer-min != 09 */10#define SND_US16X08_NO_BIAS 011#define SND_US16X08_FADER_BIAS 12712#define SND_US16X08_EQ_HIGHFREQ_BIAS 0x2013#define SND_US16X08_COMP_THRESHOLD_BIAS 0x2014#define SND_US16X08_COMP_ATTACK_BIAS 215#define SND_US16X08_COMP_RELEASE_BIAS 116 17/* get macro for components of kcontrol private_value */18#define SND_US16X08_KCBIAS(x) (((x)->private_value >> 24) & 0xff)19#define SND_US16X08_KCSTEP(x) (((x)->private_value >> 16) & 0xff)20#define SND_US16X08_KCMIN(x) (((x)->private_value >> 8) & 0xff)21#define SND_US16X08_KCMAX(x) (((x)->private_value >> 0) & 0xff)22/* set macro for kcontrol private_value */23#define SND_US16X08_KCSET(bias, step, min, max) \24 (((bias) << 24) | ((step) << 16) | ((min) << 8) | (max))25 26/* the URB request/type to control Tascam mixers */27#define SND_US16X08_URB_REQUEST 0x1D28#define SND_US16X08_URB_REQUESTTYPE 0x4029 30/* the URB params to retrieve meter ranges */31#define SND_US16X08_URB_METER_REQUEST 0x1e32#define SND_US16X08_URB_METER_REQUESTTYPE 0xc033 34#define MUA0(x, y) ((x)[(y) * 10 + 4])35#define MUA1(x, y) ((x)[(y) * 10 + 5])36#define MUA2(x, y) ((x)[(y) * 10 + 6])37#define MUB0(x, y) ((x)[(y) * 10 + 7])38#define MUB1(x, y) ((x)[(y) * 10 + 8])39#define MUB2(x, y) ((x)[(y) * 10 + 9])40#define MUC0(x, y) ((x)[(y) * 10 + 10])41#define MUC1(x, y) ((x)[(y) * 10 + 11])42#define MUC2(x, y) ((x)[(y) * 10 + 12])43#define MUC3(x, y) ((x)[(y) * 10 + 13])44 45/* Common Channel control IDs */46#define SND_US16X08_ID_BYPASS 0x4547#define SND_US16X08_ID_BUSS_OUT 0x4448#define SND_US16X08_ID_PHASE 0x8549#define SND_US16X08_ID_MUTE 0x8350#define SND_US16X08_ID_FADER 0x8151#define SND_US16X08_ID_PAN 0x8252#define SND_US16X08_ID_METER 0xB153 54#define SND_US16X08_ID_EQ_BAND_COUNT 455#define SND_US16X08_ID_EQ_PARAM_COUNT 456 57/* EQ level IDs */58#define SND_US16X08_ID_EQLOWLEVEL 0x0159#define SND_US16X08_ID_EQLOWMIDLEVEL 0x0260#define SND_US16X08_ID_EQHIGHMIDLEVEL 0x0361#define SND_US16X08_ID_EQHIGHLEVEL 0x0462 63/* EQ frequence IDs */64#define SND_US16X08_ID_EQLOWFREQ 0x1165#define SND_US16X08_ID_EQLOWMIDFREQ 0x1266#define SND_US16X08_ID_EQHIGHMIDFREQ 0x1367#define SND_US16X08_ID_EQHIGHFREQ 0x1468 69/* EQ width IDs */70#define SND_US16X08_ID_EQLOWMIDWIDTH 0x2271#define SND_US16X08_ID_EQHIGHMIDWIDTH 0x2372 73#define SND_US16X08_ID_EQENABLE 0x3074 75#define EQ_STORE_BAND_IDX(x) ((x) & 0xf)76#define EQ_STORE_PARAM_IDX(x) (((x) & 0xf0) >> 4)77 78#define SND_US16X08_ID_ROUTE 0x0079 80/* Compressor Ids */81#define SND_US16X08_ID_COMP_BASE 0x3282#define SND_US16X08_ID_COMP_THRESHOLD SND_US16X08_ID_COMP_BASE83#define SND_US16X08_ID_COMP_RATIO (SND_US16X08_ID_COMP_BASE + 1)84#define SND_US16X08_ID_COMP_ATTACK (SND_US16X08_ID_COMP_BASE + 2)85#define SND_US16X08_ID_COMP_RELEASE (SND_US16X08_ID_COMP_BASE + 3)86#define SND_US16X08_ID_COMP_GAIN (SND_US16X08_ID_COMP_BASE + 4)87#define SND_US16X08_ID_COMP_SWITCH (SND_US16X08_ID_COMP_BASE + 5)88#define SND_US16X08_ID_COMP_COUNT 689 90#define COMP_STORE_IDX(x) ((x) - SND_US16X08_ID_COMP_BASE)91 92struct snd_us16x08_eq_store {93 u8 val[SND_US16X08_ID_EQ_BAND_COUNT][SND_US16X08_ID_EQ_PARAM_COUNT]94 [SND_US16X08_MAX_CHANNELS];95};96 97struct snd_us16x08_comp_store {98 u8 val[SND_US16X08_ID_COMP_COUNT][SND_US16X08_MAX_CHANNELS];99};100 101struct snd_us16x08_meter_store {102 int meter_level[SND_US16X08_MAX_CHANNELS];103 int master_level[2]; /* level of meter for master output */104 int comp_index; /* round trip channel selector */105 int comp_active_index; /* channel select from user space mixer */106 int comp_level[16]; /* compressor reduction level */107 struct snd_us16x08_comp_store *comp_store;108};109 110struct snd_us16x08_control_params {111 const struct snd_kcontrol_new *kcontrol_new;112 int control_id;113 int type;114 int num_channels;115 const char *name;116 int default_val;117};118 119#define snd_us16x08_switch_info snd_ctl_boolean_mono_info120 121int snd_us16x08_controls_create(struct usb_mixer_interface *mixer);122#endif /* __USB_MIXER_US16X08_H */123