| 1 | /*****************************************************************************/cxx . . $ `<file>/hdlcutil/fl/xfsmmixer_main.cxx`/ |
| 2 | |
| 3 | /* |
| 4 | * xfsmmixer_main.c -- kernel soundcard radio modem driver mixer utility. |
| 5 | * |
| 6 | * Copyright (C) 1996,1997,2000 Thomas Sailer ([email protected]) |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA |
| 21 | * 02110-1301, USA. |
| 22 | * |
| 23 | * Please note that the GPL allows you to use the driver, NOT the radio. |
| 24 | * In order to use the radio, you need a license from the communications |
| 25 | * authority of your country. |
| 26 | * |
| 27 | * |
| 28 | * History: |
| 29 | * 0.1 14.12.1996 Started |
| 30 | * 0.2 11.05.1997 introduced hdrvcomm.h |
| 31 | * 0.3 05.01.2000 upgraded to fltk 1.0.7 |
| 32 | */ |
| 33 | |
| 34 | /*****************************************************************************/ |
| 35 | |
| 36 | #include <stdlib.h> |
| 37 | #include <stdio.h> |
| 38 | #include <unistd.h> |
| 39 | #include <string.h> |
| 40 | #include <net/if.h> |
| 41 | //#include <forms.h> |
| 42 | #include "hdrvcomm.h"cxx . . $ `<file>/hdlcutil/hdrvcomm.h`/ |
| 43 | #include "xfsmmixer.h"cxx . . $ `<file>/hdlcutil/fl/xfsmmixer.h`/ |
| 44 | |
| 45 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 46 | #include <scm-version.h>cxx . . $ `<file>/scm-version.h`/ |
| 47 | |
| 48 | /* ---------------------------------------------------------------------- */ |
| 49 | |
| 50 | static char *prognamecxx . . $ progname.; |
| 51 | static unsigned int mixdevicecxx . . $ mixdevice.; |
| 52 | |
| 53 | /* ---------------------------------------------------------------------- */ |
| 54 | |
| 55 | static int do_mix_ioctlcxx . . $ do_mix_ioctl(a4fd9b4509c1e7a7).(int cmd, struct sm_mixer_data *mixdat) |
| 56 | { |
| 57 | struct sm_ioctl par; |
| 58 | int i; |
| 59 | |
| 60 | par.cmd = cmd; |
| 61 | par.data.mix = *mixdat; |
| 62 | i = hdrvc_sm_ioctl(cmd, &par); |
| 63 | *mixdat = par.data.mix; |
| 64 | return i; |
| 65 | } |
| 66 | |
| 67 | /* ---------------------------------------------------------------------- */ |
| 68 | |
| 69 | static unsigned char get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(unsigned char addr) |
| 70 | { |
| 71 | int i; |
| 72 | struct sm_mixer_data mixdat; |
| 73 | |
| 74 | mixdat.reg = addr; |
| 75 | if ((i = do_mix_ioctlcxx . . $ do_mix_ioctl(a4fd9b4509c1e7a7).(SMCTL_GETMIXERcxx . . $ `hdlcutil/soundmodem.h:82:9`!, &mixdat)) < 0) { |
| 76 | perror("do_mix_ioctl: SMCTL_GETMIXER"); |
| 77 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 78 | } |
| 79 | if (!i) |
| 80 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "warning: mixer device %u register %u not " |
| 81 | "accessible for reading!\n", mixdat.mixer_type, |
| 82 | addr); |
| 83 | if (mixdat.mixer_type != mixdevicecxx . . $ mixdevice.) { |
| 84 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error: mixer type changed !?\n"); |
| 85 | exitcxx . . $ exit(44ed87f96534fad7).(2); |
| 86 | } |
| 87 | return mixdat.data; |
| 88 | } |
| 89 | |
| 90 | /* ---------------------------------------------------------------------- */ |
| 91 | |
| 92 | static void set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(unsigned char addr, unsigned char data) |
| 93 | { |
| 94 | struct sm_mixer_data mixdat; |
| 95 | |
| 96 | mixdat.reg = addr; |
| 97 | mixdat.data = data; |
| 98 | mixdat.mixer_type = mixdevicecxx . . $ mixdevice.; |
| 99 | if (do_mix_ioctlcxx . . $ do_mix_ioctl(a4fd9b4509c1e7a7).(SMCTL_SETMIXERcxx . . $ `hdlcutil/soundmodem.h:83:9`!, &mixdat) < 0) { |
| 100 | perror("do_mix_ioctl: SMCTL_SETMIXER"); |
| 101 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /* ---------------------------------------------------------------------- */ |
| 106 | |
| 107 | void update_ad1848cxx . . $ update_ad1848(692bf3e9e3c0137a).(Fl_Widgetcxx . . $ Fl_Widget# *widget, void *udata) |
| 108 | { |
| 109 | unsigned char mdata; |
| 110 | float mval; |
| 111 | |
| 112 | mdata = 0; |
| 113 | if (ad1848_srcl_linecxx . . $ ad1848_srcl_line.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 114 | mdata = 0x00; |
| 115 | else if (ad1848_srcl_aux1cxx . . $ ad1848_srcl_aux1.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 116 | mdata = 0x40; |
| 117 | else if (ad1848_srcl_miccxx . . $ ad1848_srcl_mic.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 118 | mdata = 0x80; |
| 119 | else if (ad1848_srcl_daccxx . . $ ad1848_srcl_dac.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 120 | mdata = 0xc0; |
| 121 | mval = ad1848_inlcxx . . $ ad1848_inl.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 122 | if (mdata == 0x80 && mval >= 20) { |
| 123 | mval -= 20; |
| 124 | mdata |= 0x20; |
| 125 | } |
| 126 | mval *= 0.666666; |
| 127 | if (mval > 15) |
| 128 | mval = 15; |
| 129 | mdata |= (int)mval; |
| 130 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x00, mdata); |
| 131 | mdata = 0; |
| 132 | if (ad1848_srcr_linecxx . . $ ad1848_srcr_line.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 133 | mdata = 0x00; |
| 134 | else if (ad1848_srcr_aux1cxx . . $ ad1848_srcr_aux1.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 135 | mdata = 0x40; |
| 136 | else if (ad1848_srcr_miccxx . . $ ad1848_srcr_mic.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 137 | mdata = 0x80; |
| 138 | else if (ad1848_srcr_daccxx . . $ ad1848_srcr_dac.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 139 | mdata = 0xc0; |
| 140 | mval = ad1848_inrcxx . . $ ad1848_inr.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 141 | if (mdata == 0x80 && mval >= 20) { |
| 142 | mval -= 20; |
| 143 | mdata |= 0x20; |
| 144 | } |
| 145 | mval *= 0.666666; |
| 146 | if (mval > 15) |
| 147 | mval = 15; |
| 148 | mdata |= (int)mval; |
| 149 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x01, mdata); |
| 150 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x02, 0x80); |
| 151 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x03, 0x80); |
| 152 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x04, 0x80); |
| 153 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x05, 0x80); |
| 154 | mval = ad1848_outlcxx . . $ ad1848_outl.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 155 | if (mval < -95) |
| 156 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x06, 0x80); |
| 157 | else |
| 158 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x06, (unsigned char)(mval * (-0.66666666))); |
| 159 | mval = ad1848_outrcxx . . $ ad1848_outr.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 160 | if (mval < -95) |
| 161 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x07, 0x80); |
| 162 | else |
| 163 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x07, (unsigned char)(mval * (-0.66666666))); |
| 164 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x0d, 0x00); |
| 165 | } |
| 166 | |
| 167 | /* ---------------------------------------------------------------------- */ |
| 168 | |
| 169 | void update_ct1335cxx . . $ update_ct1335(692bf3e9e3c0137a).(Fl_Widgetcxx . . $ Fl_Widget# *widget, void *udata) |
| 170 | { |
| 171 | float mval; |
| 172 | |
| 173 | mval = ct1335_outcxx . . $ ct1335_out.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).() * (7.0 / 46.0); |
| 174 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x02, ((((int)(mval)) + 7) << 1)); |
| 175 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x06, 0x00); |
| 176 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x08, 0x00); |
| 177 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x0a, 0x06); |
| 178 | } |
| 179 | |
| 180 | /* ---------------------------------------------------------------------- */ |
| 181 | |
| 182 | void update_ct1345cxx . . $ update_ct1345(692bf3e9e3c0137a).(Fl_Widgetcxx . . $ Fl_Widget# *widget, void *udata) |
| 183 | { |
| 184 | unsigned char mdata; |
| 185 | double mval; |
| 186 | |
| 187 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x04, 0xee); |
| 188 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x0a, 0x00); |
| 189 | mdata = 0x20; |
| 190 | if (ct1345_src_miccxx . . $ ct1345_src_mic.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 191 | mdata = 0x20; |
| 192 | else if (ct1345_src_cdcxx . . $ ct1345_src_cd.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 193 | mdata = 0x22; |
| 194 | else if (ct1345_src_linecxx . . $ ct1345_src_line.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 195 | mdata = 0x26; |
| 196 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x0c, mdata); |
| 197 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x0e, 0x20); |
| 198 | mval = ct1345_outlcxx . . $ ct1345_outl.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).() * (7.0 / 46.0); |
| 199 | mdata = (((int)(mval))+7) << 5; |
| 200 | mval = ct1345_outrcxx . . $ ct1345_outr.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).() * (7.0 / 46.0); |
| 201 | mdata |= (((int)(mval))+7) << 1; |
| 202 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x22, mdata); |
| 203 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x26, 0x00); |
| 204 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x28, 0x00); |
| 205 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x2e, 0x00); |
| 206 | } |
| 207 | |
| 208 | /* ---------------------------------------------------------------------- */ |
| 209 | |
| 210 | void update_ct1745cxx . . $ update_ct1745(692bf3e9e3c0137a).(Fl_Widgetcxx . . $ Fl_Widget# *widget, void *udata) |
| 211 | { |
| 212 | unsigned char mdata; |
| 213 | float mval; |
| 214 | |
| 215 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x3c, 0); /* output src: only voice and pcspk */ |
| 216 | mval = ct1745_treblecxx . . $ ct1745_treble.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 217 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x44, ((int)mval)<<4); /* treble.l */ |
| 218 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x45, ((int)mval)<<4); /* treble.r */ |
| 219 | mval = ct1745_basscxx . . $ ct1745_bass.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 220 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x46, ((int)mval)<<4); /* bass.l */ |
| 221 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x47, ((int)mval)<<4); /* bass.r */ |
| 222 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x3b, 0); /* PC speaker vol -18dB */ |
| 223 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x43, 1); /* mic: agc off, fixed 20dB gain */ |
| 224 | mval = ct1745_outlcxx . . $ ct1745_outl.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 225 | mdata = 0; |
| 226 | while (mval > 0) { |
| 227 | mval -= 6; |
| 228 | mdata += 0x40; |
| 229 | } |
| 230 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x41, mdata); /* output gain */ |
| 231 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x30, 0xf8); /* master vol */ |
| 232 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x32, ((int)(mval * 0.5) + 31) << 3); /* voice vol */ |
| 233 | mval = ct1745_outrcxx . . $ ct1745_outr.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 234 | mdata = 0; |
| 235 | while (mval > 0) { |
| 236 | mval -= 6; |
| 237 | mdata += 0x40; |
| 238 | } |
| 239 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x42, mdata); /* output gain */ |
| 240 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x31, 0xf8); /* master vol */ |
| 241 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x33, ((int)(mval * 0.5) + 31) << 3); /* voice vol */ |
| 242 | mval = ct1745_inlcxx . . $ ct1745_inl.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 243 | mdata = 0; |
| 244 | while (mval > 0) { |
| 245 | mval -= 6; |
| 246 | mdata += 0x40; |
| 247 | } |
| 248 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x3f, mdata); /* input gain */ |
| 249 | mdata = ((int)(mval * 0.5) + 31) << 3; |
| 250 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x34, mdata); /* midi vol */ |
| 251 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x36, mdata); /* cd vol */ |
| 252 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x38, mdata); /* line vol */ |
| 253 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x3a, mdata); /* mic vol */ |
| 254 | mval = ct1745_inrcxx . . $ ct1745_inr.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).(); |
| 255 | mdata = 0; |
| 256 | while (mval > 0) { |
| 257 | mval -= 6; |
| 258 | mdata += 0x40; |
| 259 | } |
| 260 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x40, mdata); /* input gain */ |
| 261 | mdata = ((int)(mval * 0.5) + 31) << 3; |
| 262 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x35, mdata); /* midi vol */ |
| 263 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x37, mdata); /* cd vol */ |
| 264 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x39, mdata); /* line vol */ |
| 265 | mdata = 0; |
| 266 | if (ct1745_srcl_miccxx . . $ ct1745_srcl_mic.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 267 | mdata |= 0x01; |
| 268 | if (ct1745_srcl_cdlcxx . . $ ct1745_srcl_cdl.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 269 | mdata |= 0x04; |
| 270 | if (ct1745_srcl_cdrcxx . . $ ct1745_srcl_cdr.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 271 | mdata |= 0x02; |
| 272 | if (ct1745_srcl_linelcxx . . $ ct1745_srcl_linel.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 273 | mdata |= 0x10; |
| 274 | if (ct1745_srcl_linercxx . . $ ct1745_srcl_liner.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 275 | mdata |= 0x08; |
| 276 | if (ct1745_srcl_midilcxx . . $ ct1745_srcl_midil.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 277 | mdata |= 0x40; |
| 278 | if (ct1745_srcl_midircxx . . $ ct1745_srcl_midir.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 279 | mdata |= 0x20; |
| 280 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x3d, mdata); /* input sources left */ |
| 281 | mdata = 0; |
| 282 | if (ct1745_srcr_miccxx . . $ ct1745_srcr_mic.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 283 | mdata |= 0x01; |
| 284 | if (ct1745_srcr_cdlcxx . . $ ct1745_srcr_cdl.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 285 | mdata |= 0x04; |
| 286 | if (ct1745_srcr_cdrcxx . . $ ct1745_srcr_cdr.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 287 | mdata |= 0x02; |
| 288 | if (ct1745_srcr_linelcxx . . $ ct1745_srcr_linel.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 289 | mdata |= 0x10; |
| 290 | if (ct1745_srcr_linercxx . . $ ct1745_srcr_liner.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 291 | mdata |= 0x08; |
| 292 | if (ct1745_srcr_midilcxx . . $ ct1745_srcr_midil.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 293 | mdata |= 0x40; |
| 294 | if (ct1745_srcr_midircxx . . $ ct1745_srcr_midir.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).()) |
| 295 | mdata |= 0x20; |
| 296 | set_mixer_regcxx . . $ set_mixer_reg(8fbe6856f5410d23).(0x3e, mdata); /* input sources right*/ |
| 297 | } |
| 298 | |
| 299 | /* ---------------------------------------------------------------------- */ |
| 300 | |
| 301 | void cb_quitcxx . . $ cb_quit(a1c60d4e2a3bbb68).(Fl_Buttoncxx . . $ Fl_Button# *, long) |
| 302 | { |
| 303 | exitcxx . . $ exit(44ed87f96534fad7). (0); |
| 304 | } |
| 305 | |
| 306 | /* ---------------------------------------------------------------------- */ |
| 307 | |
| 308 | static const char *usage_strcxx . . $ usage_str. = |
| 309 | "[-i smif]\n" |
| 310 | " -i: specify the name of the soundmodem kernel driver interface\n\n"; |
| 311 | |
| 312 | /* ---------------------------------------------------------------------- */ |
| 313 | |
| 314 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 315 | { |
| 316 | int c, i; |
| 317 | struct sm_mixer_data mixdat; |
| 318 | unsigned char mdata; |
| 319 | |
| 320 | prognamecxx . . $ progname. = *argv; |
| 321 | printf("%s: Version " FULL_VERcxx . . $ `scm-version.h:6:9`! "; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", prognamecxx . . $ progname.); |
| 322 | hdrvc_args(&argc, argv, "sm0"); |
| 323 | for (i = 1; i < argc; ) { |
| 324 | c = i; |
| 325 | Flcxx . . $ Fl#::argcxx . . $ Fl#arg(8593696dd6f7d2b6).(argc, argv, c); |
| 326 | if (c <= 0) { |
| 327 | i++; |
| 328 | continue; |
| 329 | } |
| 330 | memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *)); |
| 331 | argc -= c; |
| 332 | } |
| 333 | #if 0 |
| 334 | while ((ret = getopt(argc, argv, "")) != -1) { |
| 335 | switch (ret) { |
| 336 | default: |
| 337 | printf("usage: %s %s", progname, usage_str); |
| 338 | exit(-1); |
| 339 | } |
| 340 | } |
| 341 | #endif |
| 342 | hdrvc_init(); |
| 343 | /* |
| 344 | * set mixer |
| 345 | */ |
| 346 | mixdat.reg = 0; |
| 347 | if (do_mix_ioctlcxx . . $ do_mix_ioctl(a4fd9b4509c1e7a7).(SMCTL_GETMIXERcxx . . $ `hdlcutil/soundmodem.h:82:9`!, &mixdat) < 0) { |
| 348 | perror("do_mix_ioctl: SMCTL_GETMIXER"); |
| 349 | mixdevicecxx . . $ mixdevice. = SM_MIXER_INVALIDcxx . . $ `hdlcutil/soundmodem.h:71:9`!; |
| 350 | } else |
| 351 | mixdevicecxx . . $ mixdevice. = mixdat.mixer_type; |
| 352 | switch (mixdevicecxx . . $ mixdevice.) { |
| 353 | case SM_MIXER_INVALIDcxx . . $ `hdlcutil/soundmodem.h:71:9`!: |
| 354 | printf("invalid mixer device\n"); |
| 355 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 356 | |
| 357 | case SM_MIXER_AD1848cxx . . $ `hdlcutil/soundmodem.h:72:9`!: |
| 358 | case SM_MIXER_CRYSTALcxx . . $ `hdlcutil/soundmodem.h:73:9`!: |
| 359 | printf("Mixer device: %s\n", mixdevicecxx . . $ mixdevice. == SM_MIXER_CRYSTALcxx . . $ `hdlcutil/soundmodem.h:73:9`! ? |
| 360 | "CS423x" : "AD1848"); |
| 361 | create_form_ad1848cxx . . $ create_form_ad1848(80327a7a60f718d1).(); |
| 362 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0); |
| 363 | ad1848_inlcxx . . $ ad1848_inl.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(1.5); |
| 364 | ad1848_inlcxx . . $ ad1848_inl.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(42.5, 0); |
| 365 | ad1848_inlcxx . . $ ad1848_inl.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((((mdata & 0xe0) == 0xa0) ? 20 : 0) + (mdata & 0xf) * 1.5); |
| 366 | ad1848_srcl_linecxx . . $ ad1848_srcl_line.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0x00); |
| 367 | ad1848_srcl_aux1cxx . . $ ad1848_srcl_aux1.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0x40); |
| 368 | ad1848_srcl_miccxx . . $ ad1848_srcl_mic.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0x80); |
| 369 | ad1848_srcl_daccxx . . $ ad1848_srcl_dac.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0xc0); |
| 370 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(1); |
| 371 | ad1848_inrcxx . . $ ad1848_inr.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(1.5); |
| 372 | ad1848_inrcxx . . $ ad1848_inr.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(42.5, 0); |
| 373 | ad1848_inrcxx . . $ ad1848_inr.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((((mdata & 0xe0) == 0xa0) ? 20 : 0) + (mdata & 0xf) * 1.5); |
| 374 | ad1848_srcr_linecxx . . $ ad1848_srcr_line.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0x00); |
| 375 | ad1848_srcr_aux1cxx . . $ ad1848_srcr_aux1.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0x40); |
| 376 | ad1848_srcr_miccxx . . $ ad1848_srcr_mic.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0x80); |
| 377 | ad1848_srcr_daccxx . . $ ad1848_srcr_dac.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 0xc0) == 0xc0); |
| 378 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(6); |
| 379 | ad1848_outlcxx . . $ ad1848_outl.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(1.5); |
| 380 | ad1848_outlcxx . . $ ad1848_outl.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -100); |
| 381 | ad1848_outlcxx . . $ ad1848_outl.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((mdata & 0x80) ? -100 : (mdata & 0x3f) * -1.5); |
| 382 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(7); |
| 383 | ad1848_outrcxx . . $ ad1848_outr.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(1.5); |
| 384 | ad1848_outrcxx . . $ ad1848_outr.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -100); |
| 385 | ad1848_outrcxx . . $ ad1848_outr.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((mdata & 0x80) ? -100 : (mdata & 0x3f) * -1.5); |
| 386 | mixer_ad1848cxx . . $ mixer_ad1848.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).(); |
| 387 | break; |
| 388 | |
| 389 | case SM_MIXER_CT1335cxx . . $ `hdlcutil/soundmodem.h:74:9`!: |
| 390 | printf("Mixer device: CT1335\n"); |
| 391 | create_form_ct1335cxx . . $ create_form_ct1335(80327a7a60f718d1).(); |
| 392 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x2); |
| 393 | ct1335_outcxx . . $ ct1335_out.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(46.0/7.0); |
| 394 | ct1335_outcxx . . $ ct1335_out.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -46); |
| 395 | ct1335_outcxx . . $ ct1335_out.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((((int)((mdata >> 1) & 7)) - 7) * (46.0/7.0)); |
| 396 | mixer_ct1335cxx . . $ mixer_ct1335.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).(); |
| 397 | break; |
| 398 | |
| 399 | case SM_MIXER_CT1345cxx . . $ `hdlcutil/soundmodem.h:75:9`!: |
| 400 | printf("Mixer device: CT1345\n"); |
| 401 | create_form_ct1345cxx . . $ create_form_ct1345(80327a7a60f718d1).(); |
| 402 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x22); |
| 403 | ct1345_outlcxx . . $ ct1345_outl.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(46.0/7.0); |
| 404 | ct1345_outlcxx . . $ ct1345_outl.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -46); |
| 405 | ct1345_outlcxx . . $ ct1345_outl.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((((int)((mdata >> 5) & 7)) - 7) * (46.0/7.0)); |
| 406 | ct1345_outrcxx . . $ ct1345_outr.->stepcxx . . $ Fl_Valuator#step(ba8836b59fb42830).(46.0/7.0); |
| 407 | ct1345_outrcxx . . $ ct1345_outr.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -46); |
| 408 | ct1345_outrcxx . . $ ct1345_outr.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((((int)((mdata >> 1) & 7)) - 7) * (46.0/7.0)); |
| 409 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0xc); |
| 410 | ct1345_src_miccxx . . $ ct1345_src_mic.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 6) == 0 || (mdata & 6) == 4); |
| 411 | ct1345_src_cdcxx . . $ ct1345_src_cd.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 6) == 2); |
| 412 | ct1345_src_linecxx . . $ ct1345_src_line.->valuecxx . . $ Fl_Button#value(7864480464b09eea).((mdata & 6) == 6); |
| 413 | mixer_ct1345cxx . . $ mixer_ct1345.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).(); |
| 414 | break; |
| 415 | |
| 416 | case SM_MIXER_CT1745cxx . . $ `hdlcutil/soundmodem.h:76:9`!: |
| 417 | printf("Mixer device: CT1745\n"); |
| 418 | create_form_ct1745cxx . . $ create_form_ct1745(80327a7a60f718d1).(); |
| 419 | ct1745_outlcxx . . $ ct1745_outl.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(2); |
| 420 | ct1745_outlcxx . . $ ct1745_outl.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -62); |
| 421 | ct1745_outlcxx . . $ ct1745_outl.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(((int)((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x32) >> 3) & 0x1f) - 31) * 2 + |
| 422 | ((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x41) >> 6) & 0x3) * 6); |
| 423 | ct1745_outrcxx . . $ ct1745_outr.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(2); |
| 424 | ct1745_outrcxx . . $ ct1745_outr.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -62); |
| 425 | ct1745_outrcxx . . $ ct1745_outr.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(((int)((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x33) >> 3) & 0x1f) - 31) * 2 + |
| 426 | ((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x42) >> 6) & 0x3) * 6); |
| 427 | ct1745_inlcxx . . $ ct1745_inl.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(2); |
| 428 | ct1745_inlcxx . . $ ct1745_inl.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -62); |
| 429 | ct1745_inlcxx . . $ ct1745_inl.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(((int)((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x38) >> 3) & 0x1f) - 31) * 2 + |
| 430 | ((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x3f) >> 6) & 0x3) * 6); |
| 431 | ct1745_inrcxx . . $ ct1745_inr.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(2); |
| 432 | ct1745_inrcxx . . $ ct1745_inr.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, -62); |
| 433 | ct1745_inrcxx . . $ ct1745_inr.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(((int)((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x39) >> 3) & 0x1f) - 31) * 2 + |
| 434 | ((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x40) >> 6) & 0x3) * 6); |
| 435 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x3d); |
| 436 | ct1745_srcl_miccxx . . $ ct1745_srcl_mic.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 1)); |
| 437 | ct1745_srcl_cdlcxx . . $ ct1745_srcl_cdl.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 4)); |
| 438 | ct1745_srcl_cdrcxx . . $ ct1745_srcl_cdr.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 2)); |
| 439 | ct1745_srcl_linelcxx . . $ ct1745_srcl_linel.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 0x10)); |
| 440 | ct1745_srcl_linercxx . . $ ct1745_srcl_liner.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 8)); |
| 441 | ct1745_srcl_midilcxx . . $ ct1745_srcl_midil.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 0x40)); |
| 442 | ct1745_srcl_midircxx . . $ ct1745_srcl_midir.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 0x20)); |
| 443 | mdata = get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x3e); |
| 444 | ct1745_srcr_miccxx . . $ ct1745_srcr_mic.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 1)); |
| 445 | ct1745_srcr_cdlcxx . . $ ct1745_srcr_cdl.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 4)); |
| 446 | ct1745_srcr_cdrcxx . . $ ct1745_srcr_cdr.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 2)); |
| 447 | ct1745_srcr_linelcxx . . $ ct1745_srcr_linel.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 0x10)); |
| 448 | ct1745_srcr_linercxx . . $ ct1745_srcr_liner.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 8)); |
| 449 | ct1745_srcr_midilcxx . . $ ct1745_srcr_midil.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 0x40)); |
| 450 | ct1745_srcr_midircxx . . $ ct1745_srcr_midir.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(mdata & 0x20)); |
| 451 | ct1745_treblecxx . . $ ct1745_treble.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(1); |
| 452 | ct1745_treblecxx . . $ ct1745_treble.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(7, -8); |
| 453 | ct1745_treblecxx . . $ ct1745_treble.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x44) >> 4) & 0xf); |
| 454 | ct1745_basscxx . . $ ct1745_bass.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(1); |
| 455 | ct1745_basscxx . . $ ct1745_bass.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(7, -8); |
| 456 | ct1745_basscxx . . $ ct1745_bass.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).((get_mixer_regcxx . . $ get_mixer_reg(50106d451684defa).(0x46) >> 4) & 0xf); |
| 457 | mixer_ct1745cxx . . $ mixer_ct1745.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).(); |
| 458 | break; |
| 459 | |
| 460 | default: |
| 461 | printf("unknown mixer device %d\n", mixdevicecxx . . $ mixdevice.); |
| 462 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 463 | } |
| 464 | Flcxx . . $ Fl#::runcxx . . $ Fl#run(b126dc7c1de90089).(); |
| 465 | exitcxx . . $ exit(44ed87f96534fad7).(0); |
| 466 | } |