diff options
author | Eldad Zack <eldad@fogrefinery.com> | 2012-11-28 17:55:40 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-29 02:44:55 -0500 |
commit | 09d8e3a71d2bdde11b258a62043cb784891e6ad3 (patch) | |
tree | bdc8c995c8802321caebfad168af33d855e697c4 /sound/usb | |
parent | d50ed624e4106ae4e6d06b8bf7cefad6612e235d (diff) |
ALSA: usb-audio: Fast Track C400 mixer controls
Add a mixer quirks for the M-Audio Fast Track C400
and create the following:
* Volume controls
* Effect Type (reusing FTU controls)
* Effect Volume
* Effect Send/Return
* Effect Program
* Effect Feedback
Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/mixer_quirks.c | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index a614dabe82c7..bf28a1b723dc 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -1027,6 +1027,178 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, | |||
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | /* M-Audio Fast Track C400 */ | ||
1031 | /* C400 volume controls, this control needs a volume quirk, see mixer.c */ | ||
1032 | static int snd_c400_create_vol_ctls(struct usb_mixer_interface *mixer) | ||
1033 | { | ||
1034 | char name[64]; | ||
1035 | unsigned int cmask, offset; | ||
1036 | int out, chan, err; | ||
1037 | |||
1038 | const unsigned int id = 0x40; | ||
1039 | const int val_type = USB_MIXER_S16; | ||
1040 | const int control = 1; | ||
1041 | |||
1042 | for (chan = 0; chan < 10; chan++) { | ||
1043 | for (out = 0; out < 6; out++) { | ||
1044 | if (chan < 6) { | ||
1045 | snprintf(name, sizeof(name), | ||
1046 | "PCM%d-Out%d Playback Volume", | ||
1047 | chan + 1, out + 1); | ||
1048 | } else { | ||
1049 | snprintf(name, sizeof(name), | ||
1050 | "In%d-Out%d Playback Volume", | ||
1051 | chan - 5, out + 1); | ||
1052 | } | ||
1053 | |||
1054 | cmask = (out == 0) ? 0 : 1 << (out - 1); | ||
1055 | offset = chan * 6; | ||
1056 | err = snd_create_std_mono_ctl_offset(mixer, id, control, | ||
1057 | cmask, val_type, offset, name, | ||
1058 | &snd_usb_mixer_vol_tlv); | ||
1059 | if (err < 0) | ||
1060 | return err; | ||
1061 | } | ||
1062 | } | ||
1063 | |||
1064 | return 0; | ||
1065 | } | ||
1066 | |||
1067 | /* This control needs a volume quirk, see mixer.c */ | ||
1068 | static int snd_c400_create_effect_volume_ctl(struct usb_mixer_interface *mixer) | ||
1069 | { | ||
1070 | static const char name[] = "Effect Volume"; | ||
1071 | const unsigned int id = 0x43; | ||
1072 | const int val_type = USB_MIXER_U8; | ||
1073 | const unsigned int control = 3; | ||
1074 | const unsigned int cmask = 0; | ||
1075 | |||
1076 | return snd_create_std_mono_ctl(mixer, id, control, cmask, val_type, | ||
1077 | name, snd_usb_mixer_vol_tlv); | ||
1078 | } | ||
1079 | |||
1080 | /* This control needs a volume quirk, see mixer.c */ | ||
1081 | static int snd_c400_create_effect_duration_ctl(struct usb_mixer_interface *mixer) | ||
1082 | { | ||
1083 | static const char name[] = "Effect Duration"; | ||
1084 | const unsigned int id = 0x43; | ||
1085 | const int val_type = USB_MIXER_S16; | ||
1086 | const unsigned int control = 4; | ||
1087 | const unsigned int cmask = 0; | ||
1088 | |||
1089 | return snd_create_std_mono_ctl(mixer, id, control, cmask, val_type, | ||
1090 | name, snd_usb_mixer_vol_tlv); | ||
1091 | } | ||
1092 | |||
1093 | /* This control needs a volume quirk, see mixer.c */ | ||
1094 | static int snd_c400_create_effect_feedback_ctl(struct usb_mixer_interface *mixer) | ||
1095 | { | ||
1096 | static const char name[] = "Effect Feedback Volume"; | ||
1097 | const unsigned int id = 0x43; | ||
1098 | const int val_type = USB_MIXER_U8; | ||
1099 | const unsigned int control = 5; | ||
1100 | const unsigned int cmask = 0; | ||
1101 | |||
1102 | return snd_create_std_mono_ctl(mixer, id, control, cmask, val_type, | ||
1103 | name, NULL); | ||
1104 | } | ||
1105 | |||
1106 | static int snd_c400_create_effect_vol_ctls(struct usb_mixer_interface *mixer) | ||
1107 | { | ||
1108 | char name[64]; | ||
1109 | unsigned int cmask; | ||
1110 | int chan, err; | ||
1111 | |||
1112 | const unsigned int id = 0x42; | ||
1113 | const int val_type = USB_MIXER_S16; | ||
1114 | const int control = 1; | ||
1115 | |||
1116 | for (chan = 0; chan < 10; chan++) { | ||
1117 | if (chan < 6) { | ||
1118 | snprintf(name, sizeof(name), | ||
1119 | "Effect Send DOut%d", | ||
1120 | chan + 1); | ||
1121 | } else { | ||
1122 | snprintf(name, sizeof(name), | ||
1123 | "Effect Send AIn%d", | ||
1124 | chan - 5); | ||
1125 | } | ||
1126 | |||
1127 | cmask = (chan == 0) ? 0 : 1 << (chan - 1); | ||
1128 | err = snd_create_std_mono_ctl(mixer, id, control, | ||
1129 | cmask, val_type, name, | ||
1130 | &snd_usb_mixer_vol_tlv); | ||
1131 | if (err < 0) | ||
1132 | return err; | ||
1133 | } | ||
1134 | |||
1135 | return 0; | ||
1136 | } | ||
1137 | |||
1138 | static int snd_c400_create_effect_ret_vol_ctls(struct usb_mixer_interface *mixer) | ||
1139 | { | ||
1140 | char name[64]; | ||
1141 | unsigned int cmask; | ||
1142 | int chan, err; | ||
1143 | |||
1144 | const unsigned int id = 0x40; | ||
1145 | const int val_type = USB_MIXER_S16; | ||
1146 | const int control = 1; | ||
1147 | const int chan_id[6] = { 0, 7, 2, 9, 4, 0xb }; | ||
1148 | const unsigned int offset = 0x3c; | ||
1149 | /* { 0x3c, 0x43, 0x3e, 0x45, 0x40, 0x47 } */ | ||
1150 | |||
1151 | for (chan = 0; chan < 6; chan++) { | ||
1152 | snprintf(name, sizeof(name), | ||
1153 | "Effect Return %d", | ||
1154 | chan + 1); | ||
1155 | |||
1156 | cmask = (chan_id[chan] == 0) ? 0 : 1 << (chan_id[chan] - 1); | ||
1157 | err = snd_create_std_mono_ctl_offset(mixer, id, control, | ||
1158 | cmask, val_type, offset, name, | ||
1159 | &snd_usb_mixer_vol_tlv); | ||
1160 | if (err < 0) | ||
1161 | return err; | ||
1162 | } | ||
1163 | |||
1164 | return 0; | ||
1165 | } | ||
1166 | |||
1167 | static int snd_c400_create_mixer(struct usb_mixer_interface *mixer) | ||
1168 | { | ||
1169 | int err; | ||
1170 | |||
1171 | err = snd_c400_create_vol_ctls(mixer); | ||
1172 | if (err < 0) | ||
1173 | return err; | ||
1174 | |||
1175 | err = snd_c400_create_effect_vol_ctls(mixer); | ||
1176 | if (err < 0) | ||
1177 | return err; | ||
1178 | |||
1179 | err = snd_c400_create_effect_ret_vol_ctls(mixer); | ||
1180 | if (err < 0) | ||
1181 | return err; | ||
1182 | |||
1183 | err = snd_ftu_create_effect_switch(mixer, 2, 0x43); | ||
1184 | if (err < 0) | ||
1185 | return err; | ||
1186 | |||
1187 | err = snd_c400_create_effect_volume_ctl(mixer); | ||
1188 | if (err < 0) | ||
1189 | return err; | ||
1190 | |||
1191 | err = snd_c400_create_effect_duration_ctl(mixer); | ||
1192 | if (err < 0) | ||
1193 | return err; | ||
1194 | |||
1195 | err = snd_c400_create_effect_feedback_ctl(mixer); | ||
1196 | if (err < 0) | ||
1197 | return err; | ||
1198 | |||
1199 | return 0; | ||
1200 | } | ||
1201 | |||
1030 | /* | 1202 | /* |
1031 | * The mixer units for Ebox-44 are corrupt, and even where they | 1203 | * The mixer units for Ebox-44 are corrupt, and even where they |
1032 | * are valid they presents mono controls as L and R channels of | 1204 | * are valid they presents mono controls as L and R channels of |
@@ -1124,6 +1296,10 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) | |||
1124 | snd_audigy2nx_proc_read); | 1296 | snd_audigy2nx_proc_read); |
1125 | break; | 1297 | break; |
1126 | 1298 | ||
1299 | case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ | ||
1300 | err = snd_c400_create_mixer(mixer); | ||
1301 | break; | ||
1302 | |||
1127 | case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ | 1303 | case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ |
1128 | case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ | 1304 | case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ |
1129 | err = snd_ftu_create_mixer(mixer); | 1305 | err = snd_ftu_create_mixer(mixer); |