[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | lcdlbls.c -- MIDAS-VII front panel support functions
|
---|
| 4 | Version 48 -- 1989-12-19 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define ROMPOK 1 /* non-zero enables the ROMP switch */
|
---|
| 9 |
|
---|
[b28a12e] | 10 | #include "ram.h"
|
---|
[e225e77] | 11 |
|
---|
[f40a309] | 12 | #define ARTIVAL(x) (x << 5)
|
---|
| 13 | #define SL2GAIN(x) (sl2gain[(x >> 11) + 16])
|
---|
| 14 |
|
---|
| 15 | #if ROMPOK
|
---|
| 16 | #define ROMPFN trapper /* ROMP switch table entry */
|
---|
| 17 | #else
|
---|
[60288f5] | 18 | #define ROMPFN l_none /* ROMP switch table entry */
|
---|
[f40a309] | 19 | #endif
|
---|
| 20 |
|
---|
| 21 | #define PCHMAX 21920L /* maximum pitch value */
|
---|
| 22 |
|
---|
| 23 | /* initialized stuff */
|
---|
| 24 |
|
---|
| 25 | /* BarType -- LCD slider bar graph type table -- 0 = bottom, 1 = centered */
|
---|
| 26 |
|
---|
[7258c6a] | 27 | int16_t BarType[14] = { 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0 };
|
---|
[f40a309] | 28 |
|
---|
[7258c6a] | 29 | int16_t artitab[] = { /* articulation pot initialization values */
|
---|
[f40a309] | 30 |
|
---|
| 31 | ARTIVAL(500), /* locn */
|
---|
| 32 | ARTIVAL(0), /* level */
|
---|
| 33 | ARTIVAL(0), /* ind 1 */
|
---|
| 34 | ARTIVAL(0), /* ind 2 */
|
---|
| 35 | ARTIVAL(0), /* ind 3 */
|
---|
| 36 | ARTIVAL(500), /* frq 1 */
|
---|
| 37 | ARTIVAL(500), /* frq 2 */
|
---|
| 38 | ARTIVAL(500), /* frq 3 */
|
---|
| 39 | ARTIVAL(500), /* frq 4 */
|
---|
| 40 | ARTIVAL(0), /* ind 4 */
|
---|
| 41 | ARTIVAL(0), /* ind 5 */
|
---|
| 42 | ARTIVAL(0), /* ind 6 */
|
---|
| 43 | ARTIVAL(500), /* filtr */
|
---|
| 44 | ARTIVAL(0) /* reson */
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | /* arpar[] -- articulation parameter map */
|
---|
[9519422] | 48 | /* sigtab[ 25 26 27 28 29 30 31 32 33 34 35 36 37 38] */
|
---|
[f40a309] | 49 |
|
---|
[7258c6a] | 50 | int16_t arpar[] = { 4, 2, 9, 11, 12, 1, 3, 5, 7, 13, 14, 15, 10, 6};
|
---|
[f40a309] | 51 |
|
---|
[7258c6a] | 52 | int16_t sl2gain[32] = { /* slider value to EQ gain conversion table */
|
---|
[f40a309] | 53 |
|
---|
| 54 | -12, -12, -12, -12, -12, -11, -10, -9 ,-8 ,-7, -6, -5, -4, -3, -2, -1,
|
---|
| 55 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 12
|
---|
| 56 | };
|
---|
| 57 |
|
---|
[c3aee8a] | 58 | uint16_t vmasks[16] = { /* variable resolution masks */
|
---|
[f40a309] | 59 |
|
---|
| 60 | 0x8000, 0xC000, 0xE000, 0xF000,
|
---|
| 61 | 0xF800, 0xFC00, 0xFE00, 0xFF00,
|
---|
| 62 | 0xFF80, 0xFFC0, 0xFFE0, 0xFFF0,
|
---|
| 63 | 0xFFF8, 0xFFFC, 0xFFFE, 0xFFFF
|
---|
| 64 | };
|
---|
| 65 |
|
---|
[7258c6a] | 66 | int16_t src2var[14] = { /* source number to analog variable number map */
|
---|
[f40a309] | 67 |
|
---|
| 68 | -1, -1, 3, -1, -1, -1, 5, -1, 4, -1, -1, 0, 1, 2 };
|
---|
| 69 |
|
---|
[7258c6a] | 70 | int8_t *potlbls[] = { /* LCD pot labels */
|
---|
[f40a309] | 71 |
|
---|
| 72 | /* Pot: 25 26 27 28 29 30 31 32 33 34 35 36 37 38 */
|
---|
| 73 |
|
---|
| 74 | /* 0 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
|
---|
| 75 | /* 1 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
|
---|
| 76 | /* 2 */ " Aux Depth Rate Inten CV 1 CV 2 CV 3 CV 4 ",
|
---|
| 77 | /* 3 */ " 50 150 400 1k 2.5k 6k 15k 50 150 400 1k 2.5k 6k 15k ",
|
---|
| 78 | /* 4 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
|
---|
| 79 | /* 5 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
|
---|
| 80 | /* 6 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
|
---|
| 81 | /* 7 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson"
|
---|
| 82 | };
|
---|
| 83 |
|
---|
| 84 | #if ROMPOK
|
---|
[7258c6a] | 85 | int8_t *swtlbls[] = { /* LCD switch labels -- ROMP ENABLED */
|
---|
[f40a309] | 86 |
|
---|
| 87 | /* 0 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load Other Voice Init ",
|
---|
| 88 | /* 1 */ " Voice Init ",
|
---|
| 89 | /* 2 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load EQ Voice Init ",
|
---|
| 90 | /* 3 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load Prmtr Voice Init ",
|
---|
| 91 | /* 4 */ " +00 Deflt",
|
---|
| 92 | /* 5 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load Other Voice Deflt",
|
---|
| 93 | /* 6 */ "Quiet ROMP Lamp Clock P/R ",
|
---|
| 94 | /* 7 */ "Quiet ROMP Lamp Load "
|
---|
| 95 | };
|
---|
| 96 | #else
|
---|
| 97 | char *swtlbls[] = { /* LCD switch labels -- ROMP DISABLED */
|
---|
| 98 |
|
---|
| 99 | /* 0 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load Other Voice Init ",
|
---|
| 100 | /* 1 */ " Voice Init ",
|
---|
| 101 | /* 2 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load EQ Voice Init ",
|
---|
| 102 | /* 3 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load Prmtr Voice Init ",
|
---|
| 103 | /* 4 */ " +00 Deflt",
|
---|
| 104 | /* 5 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load Other Voice Deflt",
|
---|
| 105 | /* 6 */ "Quiet Lamp Clock P/R ",
|
---|
| 106 | /* 7 */ "Quiet Lamp Load "
|
---|
| 107 | };
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
[7258c6a] | 110 | int8_t *aslbls[] = { /* Assignment select key labels */
|
---|
[f40a309] | 111 |
|
---|
| 112 | "Asgmt", /* 0 */
|
---|
| 113 | " +00 ", /* 1 */
|
---|
| 114 | " +20 ", /* 2 */
|
---|
| 115 | " +40 ", /* 3 */
|
---|
| 116 | " +60 ", /* 4 */
|
---|
| 117 | " +80 " /* 5 */
|
---|
| 118 | };
|
---|
| 119 |
|
---|
[60288f5] | 120 | LPF t_prmtr[] = { /* switch assignments for LS_PRMTR */
|
---|
[f40a309] | 121 |
|
---|
| 122 | quiet, /* 0: Quiet */
|
---|
| 123 | ROMPFN, /* 1: ROMP */
|
---|
| 124 |
|
---|
| 125 | setlamp, /* 2: Lamp */
|
---|
| 126 | l_clock, /* 3: Clock */
|
---|
| 127 | rpctl, /* 4: R/P */
|
---|
| 128 |
|
---|
| 129 | l_goto, /* 5: Go To */
|
---|
| 130 | l_inst, /* 6: Instr */
|
---|
| 131 | l_asgn, /* 7: Asgmt */
|
---|
| 132 | l_load, /* 8: Load */
|
---|
| 133 |
|
---|
[60288f5] | 134 | l_none, /* 9: -unused- */
|
---|
| 135 | l_none, /* 10: -unused- */
|
---|
[f40a309] | 136 | l_other, /* 11: Other */
|
---|
| 137 |
|
---|
| 138 | l_prmtr, /* 12: Prmtr */
|
---|
| 139 | l_init /* 13: Init */
|
---|
| 140 | };
|
---|
| 141 |
|
---|
[60288f5] | 142 | LPF t_voice[] = { /* switch assignments for LS_VOICE */
|
---|
[f40a309] | 143 |
|
---|
| 144 | l_voice, /* 0: toggle voice status */
|
---|
| 145 | l_voice, /* 1: toggle voice status */
|
---|
| 146 |
|
---|
| 147 | l_voice, /* 2: toggle voice status */
|
---|
| 148 | l_voice, /* 3: toggle voice status */
|
---|
| 149 | l_voice, /* 4: toggle voice status */
|
---|
| 150 |
|
---|
| 151 | l_voice, /* 5: toggle voice status */
|
---|
| 152 | l_voice, /* 6: toggle voice status */
|
---|
| 153 | l_voice, /* 7: toggle voice status */
|
---|
| 154 | l_voice, /* 8: toggle voice status */
|
---|
| 155 |
|
---|
| 156 | l_voice, /* 9: toggle voice status */
|
---|
| 157 | l_voice, /* 10: toggle voice status */
|
---|
| 158 | l_voice, /* 11: toggle voice status */
|
---|
| 159 |
|
---|
| 160 | l_prmtr, /* 12: Prmtr */
|
---|
| 161 | l_init /* 13: Init */
|
---|
| 162 | };
|
---|
| 163 |
|
---|
[60288f5] | 164 | LPF t_other[] = { /* switch assignments for LS_OTHER */
|
---|
[f40a309] | 165 |
|
---|
| 166 | quiet, /* 0: Quiet */
|
---|
| 167 | ROMPFN, /* 1: ROMP */
|
---|
| 168 |
|
---|
| 169 | setlamp, /* 2: Lamp */
|
---|
| 170 | l_clock, /* 3: Clock */
|
---|
| 171 | rpctl, /* 4: R/P */
|
---|
| 172 |
|
---|
| 173 | l_goto, /* 5: Go To */
|
---|
| 174 | l_inst, /* 6: Instr */
|
---|
| 175 | l_asgn, /* 7: Asgmt */
|
---|
| 176 | l_load, /* 8: Load */
|
---|
| 177 |
|
---|
[60288f5] | 178 | l_none, /* 9: -unused- */
|
---|
| 179 | l_none, /* 10: -unused- */
|
---|
[f40a309] | 180 | l_eq, /* 11: EQ */
|
---|
| 181 |
|
---|
| 182 | l_prmtr, /* 12: Prmtr */
|
---|
| 183 | l_init /* 13: Init */
|
---|
| 184 | };
|
---|
| 185 |
|
---|
[60288f5] | 186 | LPF t_eq[] = { /* switch assignments for LS_EQ */
|
---|
[f40a309] | 187 |
|
---|
| 188 | quiet, /* 0: Quiet */
|
---|
| 189 | ROMPFN, /* 1: ROMP */
|
---|
| 190 |
|
---|
| 191 | setlamp, /* 2: Lamp */
|
---|
| 192 | l_clock, /* 3: Clock */
|
---|
| 193 | rpctl, /* 4: R/P */
|
---|
| 194 |
|
---|
| 195 | l_goto, /* 5: Go To */
|
---|
| 196 | l_inst, /* 6: Instr */
|
---|
| 197 | l_asgn, /* 7: Asgmt */
|
---|
| 198 | l_load, /* 8: Load */
|
---|
| 199 |
|
---|
[60288f5] | 200 | l_none, /* 9: -unused- */
|
---|
| 201 | l_none, /* 10: -unused- */
|
---|
[f40a309] | 202 | l_eq, /* 11: Prmtr */
|
---|
| 203 |
|
---|
| 204 | l_prmtr, /* 12: Voice */
|
---|
| 205 | l_init /* 13: Init */
|
---|
| 206 | };
|
---|
| 207 |
|
---|
[60288f5] | 208 | LPF t_inst[] = { /* switch assignments for LS_INST */
|
---|
[f40a309] | 209 |
|
---|
| 210 | l_group, /* 0: toggle group status */
|
---|
| 211 | l_group, /* 1: toggle group status */
|
---|
| 212 |
|
---|
| 213 | l_group, /* 2: toggle group status */
|
---|
| 214 | l_group, /* 3: toggle group status */
|
---|
| 215 | l_group, /* 4: toggle group status */
|
---|
| 216 |
|
---|
| 217 | l_group, /* 5: toggle group status */
|
---|
| 218 | l_group, /* 6: toggle group status */
|
---|
| 219 | l_group, /* 7: toggle group status */
|
---|
| 220 | l_group, /* 8: toggle group status */
|
---|
| 221 |
|
---|
| 222 | l_group, /* 9: toggle group status */
|
---|
| 223 | l_group, /* 10: toggle group status */
|
---|
| 224 | l_group, /* 11: toggle group status */
|
---|
| 225 |
|
---|
| 226 | l_inst, /* 12: 01-20 / 21-40 */
|
---|
| 227 | l_dflt /* 13: Deflt */
|
---|
| 228 | };
|
---|
| 229 |
|
---|
[60288f5] | 230 | LPF t_libr[] = { /* switch assignments for LS_LIBR */
|
---|
[f40a309] | 231 |
|
---|
| 232 | quiet, /* 0: Quiet */
|
---|
| 233 | ROMPFN, /* 1: ROMP */
|
---|
| 234 |
|
---|
| 235 | setlamp, /* 2: Lamp */
|
---|
| 236 | l_clock, /* 3: Clock */
|
---|
| 237 | rpctl, /* 4: R/P */
|
---|
| 238 |
|
---|
[60288f5] | 239 | l_none, /* 5: -unused- */
|
---|
| 240 | l_none, /* 6: -unused- */
|
---|
| 241 | l_none, /* 7: -unused- */
|
---|
| 242 | l_none, /* 8: -unused- */
|
---|
[f40a309] | 243 |
|
---|
[60288f5] | 244 | l_none, /* 9: -unused- */
|
---|
| 245 | l_none, /* 10: -unused- */
|
---|
| 246 | l_none, /* 11: -unused- */
|
---|
[f40a309] | 247 |
|
---|
[60288f5] | 248 | l_none, /* 12: -unused- */
|
---|
| 249 | l_none /* 13: -unused- */
|
---|
[f40a309] | 250 | };
|
---|
| 251 |
|
---|
[60288f5] | 252 | LPF t_ngrp[] = { /* switch assignments for LS_NGRP */
|
---|
[f40a309] | 253 |
|
---|
| 254 | quiet, /* 0: Quiet */
|
---|
| 255 | ROMPFN, /* 1: ROMP */
|
---|
| 256 |
|
---|
| 257 | setlamp, /* 2: Lamp */
|
---|
| 258 | l_clock, /* 3: Clock */
|
---|
| 259 | rpctl, /* 4: R/P */
|
---|
| 260 |
|
---|
[60288f5] | 261 | l_none, /* 5: -unused- */
|
---|
| 262 | l_none, /* 6: -unused- */
|
---|
| 263 | l_none, /* 7: -unused- */
|
---|
| 264 | l_none, /* 8: -unused- */
|
---|
[f40a309] | 265 |
|
---|
[60288f5] | 266 | l_none, /* 9: -unused- */
|
---|
| 267 | l_none, /* 10: -unused- */
|
---|
| 268 | l_none, /* 11: -unused- */
|
---|
[f40a309] | 269 |
|
---|
[60288f5] | 270 | l_none, /* 12: -unused- */
|
---|
| 271 | l_none /* 13: -unused- */
|
---|
[f40a309] | 272 | };
|
---|
| 273 |
|
---|
[60288f5] | 274 | LPF t_load[] = { /* switch assignments for LS_LOAD */
|
---|
[f40a309] | 275 |
|
---|
| 276 | quiet, /* 0: Quiet */
|
---|
| 277 | ROMPFN, /* 1: ROMP */
|
---|
| 278 |
|
---|
| 279 | setlamp, /* 2: Lamp */
|
---|
[60288f5] | 280 | l_none, /* 3: -unused- */
|
---|
| 281 | l_none, /* 4: -unused- */
|
---|
[f40a309] | 282 |
|
---|
[60288f5] | 283 | l_none, /* 5: -unused- */
|
---|
| 284 | l_none, /* 6: -unused- */
|
---|
| 285 | l_none, /* 7: -unused- */
|
---|
[f40a309] | 286 | l_load, /* 8: Load */
|
---|
| 287 |
|
---|
[60288f5] | 288 | l_none, /* 9: -unused- */
|
---|
| 289 | l_none, /* 10: -unused- */
|
---|
| 290 | l_none, /* 11: -unused- */
|
---|
[f40a309] | 291 |
|
---|
[60288f5] | 292 | l_none, /* 12: -unused- */
|
---|
| 293 | l_none /* 13: -unused- */
|
---|
[f40a309] | 294 | };
|
---|
| 295 |
|
---|
[60288f5] | 296 | /*
|
---|
| 297 | =============================================================================
|
---|
| 298 | l_none() -- null function
|
---|
| 299 | =============================================================================
|
---|
| 300 | */
|
---|
| 301 |
|
---|
[7258c6a] | 302 | void l_none(int16_t _1, int16_t _2)
|
---|
[60288f5] | 303 | {
|
---|
| 304 | }
|
---|
| 305 |
|
---|
[f40a309] | 306 | /*
|
---|
| 307 | =============================================================================
|
---|
| 308 | quiet() -- quiet the instrument
|
---|
| 309 | =============================================================================
|
---|
| 310 | */
|
---|
| 311 |
|
---|
[7258c6a] | 312 | void quiet(int16_t _1, int16_t _2)
|
---|
[f40a309] | 313 | {
|
---|
[7258c6a] | 314 | register int16_t vce;
|
---|
[f40a309] | 315 |
|
---|
| 316 | for (vce = 0; vce < 12; vce++) /* for each voice ... */
|
---|
| 317 | sendval(vce, 2, 0); /* ... set level = 0 */
|
---|
| 318 |
|
---|
| 319 | memsetw(seqflag, 0, 16); /* stop the sequences */
|
---|
| 320 | memsetw(seqtime, 0, 16); /* ... */
|
---|
| 321 |
|
---|
| 322 | memsetw(trstate, 0, 16); /* reset the triggers */
|
---|
| 323 |
|
---|
| 324 | seqdupd = 0xFFFF; /* request display update */
|
---|
| 325 |
|
---|
| 326 | stmproc(NULL_DEF); /* trigger the blank definer */
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | /*
|
---|
| 330 | =============================================================================
|
---|
| 331 | rpctl() -- toggle record/play switch
|
---|
| 332 | =============================================================================
|
---|
| 333 | */
|
---|
| 334 |
|
---|
[7258c6a] | 335 | void rpctl(int16_t stat, int16_t _2)
|
---|
[f40a309] | 336 | {
|
---|
| 337 | if (NOT stat)
|
---|
| 338 | return;
|
---|
| 339 |
|
---|
| 340 | recsw = NOT recsw;
|
---|
| 341 | dsrpmod();
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | /*
|
---|
| 345 | =============================================================================
|
---|
| 346 | trapper() -- trap to ROMP
|
---|
| 347 | =============================================================================
|
---|
| 348 | */
|
---|
| 349 |
|
---|
[7258c6a] | 350 | void trapper(int16_t stat, int16_t _2)
|
---|
[f40a309] | 351 | {
|
---|
| 352 | if (stat)
|
---|
| 353 | xtrap15();
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 | /*
|
---|
| 357 | =============================================================================
|
---|
| 358 | l_clock() -- process 'Clock' switch
|
---|
| 359 | =============================================================================
|
---|
| 360 | */
|
---|
| 361 |
|
---|
[7258c6a] | 362 | void l_clock(int16_t stat, int16_t _2)
|
---|
[f40a309] | 363 | {
|
---|
| 364 | if (NOT stat)
|
---|
| 365 | return;
|
---|
| 366 |
|
---|
| 367 | clkset(NOT clkrun);
|
---|
| 368 | dclkmd();
|
---|
| 369 | }
|
---|
| 370 |
|
---|
| 371 | /*
|
---|
| 372 | =============================================================================
|
---|
| 373 | ulamp() -- underline lamp if forced on
|
---|
| 374 | =============================================================================
|
---|
| 375 | */
|
---|
| 376 |
|
---|
[0580615] | 377 | void ulamp(void)
|
---|
[f40a309] | 378 | {
|
---|
| 379 | if ((sliders EQ LS_VOICE) OR (sliders EQ LS_INST))
|
---|
| 380 | return;
|
---|
| 381 |
|
---|
| 382 | point = GLCplot; /* setup to draw line */
|
---|
| 383 | GLCcurs(G_ON);
|
---|
| 384 |
|
---|
| 385 | if (lampsw)
|
---|
| 386 | lseg (LAMP_XL, LAMP_Y, LAMP_XR, LAMP_Y, 1);
|
---|
| 387 | else
|
---|
| 388 | lseg (LAMP_XL, LAMP_Y, LAMP_XR, LAMP_Y, 0);
|
---|
| 389 |
|
---|
| 390 | GLCcurs(G_OFF);
|
---|
| 391 | }
|
---|
| 392 |
|
---|
| 393 | /*
|
---|
| 394 | =============================================================================
|
---|
| 395 | preio() -- turn off LCD backlight before disk I/O
|
---|
| 396 | =============================================================================
|
---|
| 397 | */
|
---|
| 398 |
|
---|
[0580615] | 399 | void preio(void)
|
---|
[f40a309] | 400 | {
|
---|
[7258c6a] | 401 | int16_t oldipl;
|
---|
[f40a309] | 402 |
|
---|
| 403 | oldipl = setipl(TIM_DI);
|
---|
| 404 |
|
---|
| 405 | lampio = lampsw;
|
---|
| 406 | iotime = lcdtime;
|
---|
| 407 | lampsw = FALSE;
|
---|
| 408 | io_leds = 0x1F;
|
---|
| 409 |
|
---|
| 410 | setipl(oldipl);
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | /*
|
---|
| 414 | =============================================================================
|
---|
| 415 | postio() -- restore LCD backlight state after disk I/O
|
---|
| 416 | =============================================================================
|
---|
| 417 | */
|
---|
| 418 |
|
---|
[0580615] | 419 | void postio(void)
|
---|
[f40a309] | 420 | {
|
---|
[7258c6a] | 421 | int16_t oldipl;
|
---|
[f40a309] | 422 |
|
---|
| 423 | oldipl = setipl(TIM_DI);
|
---|
| 424 |
|
---|
| 425 | lampsw = lampio;
|
---|
| 426 |
|
---|
| 427 | if (iotime OR lampsw) {
|
---|
| 428 |
|
---|
| 429 | lcdtime = lcdontm;
|
---|
| 430 | io_leds = 0x9F;
|
---|
| 431 | }
|
---|
| 432 |
|
---|
| 433 | setipl(oldipl);
|
---|
| 434 | }
|
---|
| 435 |
|
---|
| 436 | /*
|
---|
| 437 | =============================================================================
|
---|
| 438 | setlamp() -- toggle LCD backlight mode
|
---|
| 439 | =============================================================================
|
---|
| 440 | */
|
---|
| 441 |
|
---|
[7258c6a] | 442 | void setlamp(int16_t stat, int16_t _2)
|
---|
[f40a309] | 443 | {
|
---|
[7258c6a] | 444 | register int16_t oldi;
|
---|
[f40a309] | 445 |
|
---|
| 446 | if (NOT stat) /* only act on key closures */
|
---|
| 447 | return;
|
---|
| 448 |
|
---|
| 449 | oldi = setipl(TIM_DI); /* disable interrupts to keep out the timer */
|
---|
| 450 |
|
---|
| 451 | lcdtime = lcdontm; /* set the LCD backlight timer */
|
---|
| 452 |
|
---|
| 453 | if (lampsw) {
|
---|
| 454 |
|
---|
| 455 | lampsw = FALSE; /* enable LCD timeouts */
|
---|
| 456 | io_leds = 0x1F; /* turn off the LCD backlight */
|
---|
| 457 |
|
---|
| 458 | } else {
|
---|
| 459 |
|
---|
| 460 | lampsw = TRUE; /* disable LCD timeouts */
|
---|
| 461 | io_leds = 0x9F; /* turn on the LCD backlight */
|
---|
| 462 | }
|
---|
| 463 |
|
---|
| 464 | setipl(oldi); /* turn interrupts back on */
|
---|
| 465 |
|
---|
| 466 | ulamp(); /* update underline on lamp key label */
|
---|
| 467 | }
|
---|
| 468 |
|
---|
| 469 | /*
|
---|
| 470 | =============================================================================
|
---|
| 471 | lcd_on() -- turn on the LCD backlight
|
---|
| 472 | =============================================================================
|
---|
| 473 | */
|
---|
| 474 |
|
---|
[0580615] | 475 | void lcd_on(void)
|
---|
[f40a309] | 476 | {
|
---|
[7258c6a] | 477 | register int16_t oldi;
|
---|
[f40a309] | 478 |
|
---|
| 479 | oldi = setipl(TIM_DI); /* disable interrupts to keep out the timer */
|
---|
| 480 |
|
---|
| 481 | lcdtime = lcdontm; /* set the LCD backlight timer */
|
---|
| 482 | io_leds = 0x9F; /* turn on the LCD backlight */
|
---|
| 483 |
|
---|
| 484 | setipl(oldi); /* turn interrupts back on */
|
---|
| 485 | }
|
---|
| 486 |
|
---|
| 487 | /*
|
---|
| 488 | =============================================================================
|
---|
| 489 | loadkey() -- process data keys in load mode
|
---|
| 490 | =============================================================================
|
---|
| 491 | */
|
---|
| 492 |
|
---|
[7258c6a] | 493 | void loadkey(int16_t key)
|
---|
[f40a309] | 494 | {
|
---|
| 495 | if (NOT astat)
|
---|
| 496 | return;
|
---|
| 497 |
|
---|
| 498 | if (loadsw) { /* if it's load time */
|
---|
| 499 |
|
---|
| 500 | if (key < 7) { /* ... and the key is valid */
|
---|
| 501 |
|
---|
| 502 | loadem(key + 'A'); /* ... load the files */
|
---|
| 503 |
|
---|
| 504 | loadsw = FALSE;
|
---|
| 505 | ltagged = FALSE;
|
---|
| 506 | d_key = olddkey;
|
---|
| 507 | x_key = oldxkey;
|
---|
| 508 | e_key = oldekey;
|
---|
| 509 | m_key = oldmkey;
|
---|
| 510 | pkctrl = oldpk;
|
---|
| 511 | sliders = oldsl;
|
---|
| 512 | swpt = oldsw;
|
---|
| 513 | lcdlbls();
|
---|
| 514 | }
|
---|
| 515 |
|
---|
| 516 | return;
|
---|
| 517 | }
|
---|
| 518 | }
|
---|
| 519 |
|
---|
| 520 | /*
|
---|
| 521 | =============================================================================
|
---|
| 522 | pcancel() -- cancel panel modes
|
---|
| 523 | =============================================================================
|
---|
| 524 | */
|
---|
| 525 |
|
---|
[7258c6a] | 526 | void pcancel(int16_t pm)
|
---|
[f40a309] | 527 | {
|
---|
| 528 | point = GLCplot; /* setup to plot on LCD */
|
---|
| 529 | GLCcurs(G_ON);
|
---|
| 530 |
|
---|
| 531 | if ((pm NE 0) AND asmode) {
|
---|
| 532 |
|
---|
| 533 | /* cancel assignment mode */
|
---|
| 534 |
|
---|
[9519422] | 535 | asmode = 0;
|
---|
[f40a309] | 536 | pkctrl = oldpk;
|
---|
| 537 | swpt = oldsw;
|
---|
| 538 | lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
|
---|
| 539 | }
|
---|
| 540 |
|
---|
| 541 | if ((pm NE 1) AND (gomode NE GO_NULL)) {
|
---|
| 542 |
|
---|
| 543 | /* cancel Go To mode */
|
---|
| 544 |
|
---|
| 545 | gomode = GO_NULL;
|
---|
| 546 | pkctrl = oldpk;
|
---|
| 547 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
|
---|
| 548 | }
|
---|
| 549 |
|
---|
| 550 | if ((pm NE 2) AND (ismode NE IS_NULL)) {
|
---|
| 551 |
|
---|
| 552 | /* cancel instrument select mode */
|
---|
| 553 |
|
---|
| 554 | ismode = IS_NULL;
|
---|
| 555 | pkctrl = oldpk;
|
---|
| 556 | sliders = oldsl;
|
---|
| 557 | swpt = oldsw;
|
---|
| 558 | lcdlbls();
|
---|
| 559 | }
|
---|
| 560 |
|
---|
| 561 | GLCcurs(G_OFF);
|
---|
| 562 | setleds();
|
---|
| 563 | }
|
---|
| 564 |
|
---|
| 565 | /*
|
---|
| 566 | =============================================================================
|
---|
| 567 | l_load() -- process "Load" key
|
---|
| 568 | =============================================================================
|
---|
| 569 | */
|
---|
| 570 |
|
---|
[7258c6a] | 571 | void l_load(int16_t stat, int16_t _2)
|
---|
[f40a309] | 572 | {
|
---|
| 573 | if (NOT stat)
|
---|
| 574 | return;
|
---|
| 575 |
|
---|
| 576 | pcancel(3); /* cancel panel selections */
|
---|
| 577 | lcancel(3); /* cancel librarian selections */
|
---|
| 578 |
|
---|
| 579 | point = GLCplot; /* setup to plot on LCD */
|
---|
| 580 | GLCcurs(G_ON);
|
---|
| 581 |
|
---|
| 582 | if (loadsw) { /* if load is selected, deselect */
|
---|
| 583 |
|
---|
| 584 | d_key = olddkey;
|
---|
| 585 | e_key = oldekey;
|
---|
| 586 | m_key = oldmkey;
|
---|
| 587 | x_key = oldxkey;
|
---|
| 588 |
|
---|
| 589 | pkctrl = oldpk;
|
---|
| 590 | sliders = oldsl;
|
---|
| 591 | swpt = oldsw;
|
---|
| 592 |
|
---|
| 593 | loadsw = FALSE;
|
---|
| 594 |
|
---|
| 595 | lcdlbls();
|
---|
[fa38804] | 596 |
|
---|
[f40a309] | 597 | } else { /* setup for load mode */
|
---|
| 598 |
|
---|
| 599 | clkset(0); /* stop the clock */
|
---|
| 600 |
|
---|
| 601 | if (ltagged) { /* cancel tag mode */
|
---|
| 602 |
|
---|
| 603 | dslslot(tagslot, exp_c(LCFBX01), loadrow);
|
---|
| 604 | ltagged = FALSE;
|
---|
| 605 | }
|
---|
| 606 |
|
---|
| 607 | if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
|
---|
| 608 | oldpk = pkctrl;
|
---|
| 609 |
|
---|
| 610 | if (sliders NE LS_LOAD)
|
---|
| 611 | oldsl = sliders;
|
---|
| 612 |
|
---|
| 613 | pkctrl = PK_LOAD;
|
---|
| 614 | sliders = LS_LOAD;
|
---|
| 615 | oldsw = swpt;
|
---|
[6dd74a9] | 616 | swpt = &t_load;
|
---|
[f40a309] | 617 |
|
---|
| 618 | olddkey = d_key;
|
---|
| 619 | oldxkey = x_key;
|
---|
| 620 | oldekey = e_key;
|
---|
| 621 | oldmkey = m_key;
|
---|
| 622 | d_key = loadkey;
|
---|
| 623 | x_key = l_load;
|
---|
| 624 | e_key = l_load;
|
---|
| 625 | m_key = l_load;
|
---|
| 626 |
|
---|
| 627 | loadsw = TRUE;
|
---|
| 628 |
|
---|
| 629 | lcdlbls();
|
---|
| 630 | lseg(LOAD_XL, LOAD_Y, LOAD_XR, LOAD_Y, 1);
|
---|
| 631 | }
|
---|
| 632 |
|
---|
| 633 | GLCcurs(G_OFF);
|
---|
| 634 | setleds();
|
---|
| 635 | }
|
---|
| 636 |
|
---|
| 637 | /*
|
---|
| 638 | =============================================================================
|
---|
| 639 | lcdlbls() -- put up the labels on the LCD display
|
---|
| 640 | =============================================================================
|
---|
| 641 | */
|
---|
| 642 |
|
---|
[0580615] | 643 | void lcdlbls(void)
|
---|
[f40a309] | 644 | {
|
---|
[7258c6a] | 645 | register int16_t i, barval;
|
---|
| 646 | int8_t buf[8];
|
---|
| 647 | int8_t dsp[86];
|
---|
[f40a309] | 648 |
|
---|
| 649 | point = GLCplot; /* set up to plot on the LCD */
|
---|
| 650 |
|
---|
| 651 | GLCinit(); /* clear the LCD display */
|
---|
| 652 | GLCcurs(G_ON);
|
---|
| 653 |
|
---|
| 654 | /* label the switches */
|
---|
| 655 |
|
---|
| 656 | switch (sliders) {
|
---|
| 657 |
|
---|
| 658 | case LS_PRMTR: /* parameter articulation */
|
---|
| 659 | case LS_OTHER: /* other stuff */
|
---|
| 660 | case LS_EQ: /* equalization */
|
---|
| 661 |
|
---|
| 662 | GLCtext(0, 1, swtlbls[sliders]);
|
---|
| 663 |
|
---|
| 664 | switch (gomode) {
|
---|
| 665 |
|
---|
| 666 | case GO_SECT:
|
---|
| 667 |
|
---|
| 668 | GLCtext(0, 31, "Sectn");
|
---|
| 669 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
|
---|
| 670 | break;
|
---|
| 671 |
|
---|
| 672 | case GO_SCOR:
|
---|
| 673 |
|
---|
| 674 | GLCtext(0, 31, "Score");
|
---|
| 675 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
|
---|
| 676 | break;
|
---|
| 677 |
|
---|
| 678 | default:
|
---|
| 679 |
|
---|
| 680 | GLCtext(0, 31, "Go To");
|
---|
| 681 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
|
---|
| 682 | break;
|
---|
| 683 | }
|
---|
| 684 |
|
---|
| 685 | break;
|
---|
[fa38804] | 686 |
|
---|
[f40a309] | 687 | case LS_VOICE: /* voice selection */
|
---|
| 688 |
|
---|
| 689 | dsp[0] = '\0';
|
---|
| 690 |
|
---|
| 691 | for (i = 0; i < 12; i++) {
|
---|
| 692 |
|
---|
| 693 | sprintf(buf, "%c%2d %c ",
|
---|
| 694 | (articen[i] ? '\176' : ' '), i + 1,
|
---|
| 695 | (articen[i] ? '\177' : ' '));
|
---|
| 696 |
|
---|
| 697 | strcat(dsp, buf);
|
---|
| 698 | }
|
---|
| 699 |
|
---|
| 700 | strcat(dsp, "Voice Init ");
|
---|
| 701 |
|
---|
| 702 | GLCtext(0, 1, dsp);
|
---|
| 703 | break;
|
---|
| 704 |
|
---|
| 705 | case LS_INST: /* instrument selection */
|
---|
| 706 |
|
---|
| 707 | dsp[0] = '\0';
|
---|
| 708 |
|
---|
| 709 | for (i = 0; i < 12; i++) {
|
---|
| 710 |
|
---|
| 711 | sprintf(buf, "%c%2d %c ",
|
---|
| 712 | (grpsel[i] ? '\176' : ' '), i + 1,
|
---|
| 713 | (grpsel[i] ? '\177' : ' '));
|
---|
| 714 |
|
---|
| 715 | strcat(dsp, buf);
|
---|
| 716 | }
|
---|
| 717 |
|
---|
| 718 | if (ismode EQ IS_HORC)
|
---|
| 719 | strcat(dsp, " +20 "); /* hi orc */
|
---|
| 720 | else
|
---|
| 721 | strcat(dsp, " +00 "); /* lo orc */
|
---|
| 722 |
|
---|
| 723 | strcat(dsp, " Deflt");
|
---|
| 724 |
|
---|
| 725 | GLCtext(0, 1, dsp);
|
---|
| 726 | break;
|
---|
| 727 |
|
---|
| 728 | case LS_LIBR:
|
---|
| 729 | case LS_NGRP:
|
---|
| 730 | case LS_LOAD:
|
---|
| 731 |
|
---|
| 732 | GLCtext(0, 1, swtlbls[sliders]);
|
---|
| 733 | break;
|
---|
| 734 | }
|
---|
| 735 |
|
---|
[fa38804] | 736 |
|
---|
[f40a309] | 737 | GLCtext(7, 1, potlbls[sliders]); /* label the pots */
|
---|
| 738 |
|
---|
| 739 | for (i = 0; i < 13; i++)
|
---|
| 740 | lseg(39 + (i * 36), 0, 39 + (i * 36), 63, 1);
|
---|
| 741 |
|
---|
| 742 | switch (sliders) { /* draw the slider bars */
|
---|
| 743 |
|
---|
| 744 | case LS_PRMTR: /* parameter articulation */
|
---|
| 745 | case LS_VOICE: /* voice articulation enable */
|
---|
| 746 | case LS_INST: /* instrument select */
|
---|
| 747 | case LS_LIBR: /* library select */
|
---|
| 748 | case LS_NGRP: /* group select */
|
---|
| 749 | case LS_LOAD: /* load select */
|
---|
| 750 |
|
---|
| 751 | for (i = 0; i < 14; i++) {
|
---|
| 752 |
|
---|
| 753 | if (BarType[i]) {
|
---|
| 754 |
|
---|
| 755 | barval = (((BGprmtr[i] >> 5) - 500) << 6) / 252;
|
---|
| 756 | BarCset(i, barval);
|
---|
| 757 |
|
---|
| 758 | } else {
|
---|
| 759 |
|
---|
| 760 | barval = BGprmtr[i] / 252;
|
---|
| 761 | BarBset(i, barval);
|
---|
| 762 | }
|
---|
| 763 | }
|
---|
| 764 |
|
---|
| 765 | break;
|
---|
| 766 |
|
---|
| 767 | case LS_OTHER:
|
---|
[9519422] | 768 |
|
---|
[f40a309] | 769 | for (i = 0; i < 14; i++)
|
---|
| 770 | BarBset(i, (BGother[i] / 252));
|
---|
| 771 |
|
---|
| 772 | break;
|
---|
| 773 |
|
---|
| 774 | case LS_EQ:
|
---|
| 775 |
|
---|
| 776 | for (i = 0; i < 14; i++)
|
---|
| 777 | BarCset(i, BGeq[i]);
|
---|
| 778 |
|
---|
| 779 | break;
|
---|
| 780 |
|
---|
| 781 | default:
|
---|
| 782 |
|
---|
| 783 | break;
|
---|
| 784 | }
|
---|
| 785 |
|
---|
| 786 | GLCcurs(G_OFF);
|
---|
| 787 | dsrpmod();
|
---|
| 788 | dclkmd();
|
---|
| 789 | ulamp();
|
---|
| 790 | }
|
---|
| 791 |
|
---|
| 792 | /*
|
---|
| 793 | =============================================================================
|
---|
| 794 | selasg() -- select assignment table
|
---|
| 795 | =============================================================================
|
---|
| 796 | */
|
---|
| 797 |
|
---|
[7258c6a] | 798 | void selasg(int16_t n)
|
---|
[f40a309] | 799 | {
|
---|
| 800 | register struct s_entry *ep;
|
---|
| 801 |
|
---|
| 802 | getasg(curasg = n); /* set the assignment */
|
---|
| 803 |
|
---|
| 804 | if (recsw) { /* if we're recording ... */
|
---|
| 805 |
|
---|
| 806 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_ASGN, -1, -1))) {
|
---|
| 807 |
|
---|
| 808 | ep->e_data1 = n; /* update old event */
|
---|
| 809 |
|
---|
| 810 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
| 811 |
|
---|
| 812 | ep->e_type = EV_ASGN; /* create new event */
|
---|
| 813 | ep->e_data1 = n;
|
---|
| 814 | ep->e_time = t_cur;
|
---|
| 815 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 816 | eh_ins(ep, EH_ASGN);
|
---|
| 817 |
|
---|
| 818 | if (ndisp EQ 2) { /* if the score is up ... */
|
---|
| 819 |
|
---|
| 820 | ctrsw = TRUE;
|
---|
| 821 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 822 | scupd();
|
---|
| 823 | }
|
---|
| 824 | }
|
---|
| 825 | }
|
---|
| 826 |
|
---|
| 827 | asmode = 0; /* drop out of assignment mode */
|
---|
| 828 | pkctrl = oldpk; /* restore previous mode */
|
---|
| 829 | swpt = oldsw;
|
---|
| 830 |
|
---|
| 831 | point = GLCplot; /* update the LCD */
|
---|
| 832 | GLCcurs(G_ON);
|
---|
| 833 | lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
|
---|
| 834 | GLCtext(0, 1, swtlbls[sliders]);
|
---|
| 835 | GLCcurs(G_OFF);
|
---|
| 836 |
|
---|
| 837 | mpcupd(); /* update the video display ... */
|
---|
| 838 | setleds(); /* ... and the LEDs */
|
---|
| 839 | }
|
---|
| 840 |
|
---|
| 841 | /*
|
---|
| 842 | =============================================================================
|
---|
| 843 | l_adfl() -- select default assignment table
|
---|
| 844 | =============================================================================
|
---|
| 845 | */
|
---|
| 846 |
|
---|
[7258c6a] | 847 | void l_adfl(int16_t stat, int16_t _2)
|
---|
[f40a309] | 848 | {
|
---|
| 849 | if (NOT stat)
|
---|
| 850 | return;
|
---|
| 851 |
|
---|
| 852 | selasg(0);
|
---|
| 853 | }
|
---|
| 854 |
|
---|
| 855 | /*
|
---|
| 856 | =============================================================================
|
---|
| 857 | l_asgn() -- select assignment
|
---|
| 858 | =============================================================================
|
---|
| 859 | */
|
---|
| 860 |
|
---|
[7258c6a] | 861 | void l_asgn(int16_t stat, int16_t _2)
|
---|
[f40a309] | 862 | {
|
---|
| 863 | if (NOT stat) /* only do this on key closure */
|
---|
| 864 | return;
|
---|
| 865 |
|
---|
| 866 | point = GLCplot; /* set up to plot on the LCD */
|
---|
| 867 | GLCcurs(G_ON);
|
---|
| 868 |
|
---|
| 869 | if (ismode NE IS_NULL) { /* cancel instrument select mode */
|
---|
| 870 |
|
---|
| 871 | ismode = IS_NULL;
|
---|
| 872 | pkctrl = oldpk;
|
---|
| 873 | sliders = oldsl;
|
---|
| 874 | swpt = oldsw;
|
---|
| 875 | lcdlbls();
|
---|
| 876 | }
|
---|
| 877 |
|
---|
| 878 | if (gomode NE GO_NULL) { /* cancel Go To mode */
|
---|
| 879 |
|
---|
| 880 | gomode = GO_NULL;
|
---|
| 881 | pkctrl = oldpk;
|
---|
| 882 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
|
---|
| 883 | }
|
---|
[fa38804] | 884 |
|
---|
[f40a309] | 885 | switch (asmode) {
|
---|
| 886 |
|
---|
| 887 | case 0: /* initial actuation */
|
---|
| 888 |
|
---|
| 889 | if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
|
---|
| 890 | oldpk = pkctrl;
|
---|
| 891 |
|
---|
| 892 | asmode = (curasg ? ((curasg - 1) / 20) : 0) + 1;
|
---|
| 893 | pkctrl = PK_ASGN;
|
---|
| 894 | memcpy(aswtbl, swpt, sizeof t_prmtr);
|
---|
| 895 | oldsw = swpt;
|
---|
[6dd74a9] | 896 | swpt = &aswtbl;
|
---|
[f40a309] | 897 | aswtbl[13] = l_adfl;
|
---|
| 898 | lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 1);
|
---|
| 899 | GLCtext(0, 79, "Deflt");
|
---|
| 900 | break;
|
---|
| 901 |
|
---|
| 902 | case 1: /* +00 -- 01..20 to +20 */
|
---|
| 903 | case 2: /* +20 -- 21..40 to +40 */
|
---|
| 904 | case 3: /* +40 -- 41..60 to +60 */
|
---|
| 905 | case 4: /* +60 -- 61..80 to +80 */
|
---|
| 906 |
|
---|
| 907 | ++asmode;
|
---|
| 908 | break;
|
---|
| 909 |
|
---|
| 910 | case 5: /* +80 -- 81..99 to +00 */
|
---|
| 911 |
|
---|
| 912 | asmode = 1;
|
---|
| 913 | break;
|
---|
| 914 |
|
---|
| 915 | }
|
---|
| 916 |
|
---|
| 917 | GLCtext(0, 43, aslbls[asmode]);
|
---|
| 918 | GLCcurs(G_OFF);
|
---|
| 919 | setleds();
|
---|
| 920 | }
|
---|
| 921 |
|
---|
| 922 | /*
|
---|
| 923 | =============================================================================
|
---|
| 924 | l_inst() -- set select instrument mode
|
---|
| 925 | =============================================================================
|
---|
| 926 | */
|
---|
| 927 |
|
---|
[7258c6a] | 928 | void l_inst(int16_t stat, int16_t _2)
|
---|
[f40a309] | 929 | {
|
---|
| 930 | if (NOT stat)
|
---|
| 931 | return;
|
---|
| 932 |
|
---|
| 933 | point = GLCplot; /* set up to plot on the LCD */
|
---|
| 934 | GLCcurs(G_ON);
|
---|
| 935 |
|
---|
| 936 | if (asmode) { /* cancel assignment mode */
|
---|
| 937 |
|
---|
[9519422] | 938 | asmode = 0;
|
---|
[f40a309] | 939 | pkctrl = oldpk;
|
---|
| 940 | swpt = oldsw;
|
---|
| 941 | lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
|
---|
| 942 | }
|
---|
| 943 |
|
---|
| 944 | if (gomode NE GO_NULL) { /* cancel Go To mode */
|
---|
| 945 |
|
---|
| 946 | gomode = GO_NULL;
|
---|
| 947 | pkctrl = oldpk;
|
---|
| 948 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
|
---|
| 949 | }
|
---|
| 950 |
|
---|
| 951 | GLCcurs(G_OFF);
|
---|
[fa38804] | 952 |
|
---|
[f40a309] | 953 | switch (ismode) {
|
---|
| 954 |
|
---|
| 955 | case IS_NULL: /* select +00 -- low orchestra */
|
---|
| 956 |
|
---|
| 957 | if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
|
---|
| 958 | oldpk = pkctrl;
|
---|
| 959 |
|
---|
| 960 | if (sliders NE LS_INST)
|
---|
| 961 | oldsl = sliders;
|
---|
| 962 |
|
---|
| 963 | oldsw = swpt;
|
---|
[6dd74a9] | 964 | swpt = &t_inst;
|
---|
[f40a309] | 965 | pkctrl = PK_INST;
|
---|
| 966 | ismode = IS_LORC;
|
---|
| 967 | sliders = LS_INST;
|
---|
| 968 | lcdlbls();
|
---|
| 969 | break;
|
---|
| 970 |
|
---|
| 971 | case IS_LORC: /* select +20 -- high orchestra */
|
---|
| 972 |
|
---|
| 973 | ismode = IS_HORC;
|
---|
| 974 | GLCcurs(G_ON);
|
---|
| 975 | GLCtext(0, 73, " +20 ");
|
---|
| 976 | GLCcurs(G_OFF);
|
---|
| 977 | break;
|
---|
| 978 |
|
---|
| 979 | case IS_HORC: /* deselect */
|
---|
| 980 | default:
|
---|
| 981 |
|
---|
| 982 | ismode = IS_NULL;
|
---|
| 983 | pkctrl = oldpk;
|
---|
| 984 | sliders = oldsl;
|
---|
| 985 | swpt = oldsw;
|
---|
| 986 | lcdlbls();
|
---|
| 987 | break;
|
---|
| 988 | }
|
---|
| 989 |
|
---|
| 990 | setleds();
|
---|
| 991 | }
|
---|
| 992 |
|
---|
| 993 | /*
|
---|
| 994 | =============================================================================
|
---|
| 995 | selins() -- select an instrument
|
---|
| 996 | =============================================================================
|
---|
| 997 | */
|
---|
| 998 |
|
---|
[7258c6a] | 999 | void selins(int16_t ival)
|
---|
[f40a309] | 1000 | {
|
---|
[7258c6a] | 1001 | register int16_t n;
|
---|
[f40a309] | 1002 | register struct s_entry *ep;
|
---|
| 1003 |
|
---|
| 1004 | for (n = 0; n < 12; n++) {
|
---|
| 1005 |
|
---|
| 1006 | if (FALSE EQ grpsel[n])
|
---|
| 1007 | continue;
|
---|
| 1008 |
|
---|
| 1009 | ins2grp[n] = ival | (ins2grp[n] & 0xFF00);
|
---|
| 1010 | setv2gi(n);
|
---|
| 1011 |
|
---|
| 1012 | if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
|
---|
| 1013 |
|
---|
| 1014 | if (E_NULL NE (ep = findev(p_cur, t_cur, EV_INST, n, -1))) {
|
---|
| 1015 |
|
---|
| 1016 | ep->e_data2 = ival;
|
---|
| 1017 |
|
---|
| 1018 | } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
|
---|
| 1019 |
|
---|
| 1020 | ep->e_type = EV_INST;
|
---|
| 1021 | ep->e_data1 = n;
|
---|
| 1022 | ep->e_data2 = ival;
|
---|
| 1023 | ep->e_time = t_cur;
|
---|
| 1024 | p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
|
---|
| 1025 | eh_ins(ep, EH_INST);
|
---|
| 1026 |
|
---|
| 1027 | if (ndisp EQ 2) {
|
---|
| 1028 |
|
---|
| 1029 | ctrsw = TRUE;
|
---|
| 1030 | se_disp(ep, D_FWD, gdstbc, 1);
|
---|
| 1031 | scupd();
|
---|
| 1032 | }
|
---|
| 1033 | }
|
---|
| 1034 | }
|
---|
| 1035 | }
|
---|
| 1036 |
|
---|
| 1037 | setinst();
|
---|
| 1038 |
|
---|
[fa38804] | 1039 |
|
---|
[f40a309] | 1040 | ismode = IS_NULL;
|
---|
| 1041 | pkctrl = oldpk;
|
---|
| 1042 | sliders = oldsl;
|
---|
| 1043 | swpt = oldsw;
|
---|
| 1044 | lcdlbls();
|
---|
| 1045 | setleds();
|
---|
| 1046 | mpcupd();
|
---|
| 1047 | }
|
---|
| 1048 |
|
---|
| 1049 | /*
|
---|
| 1050 | =============================================================================
|
---|
| 1051 | l_dflt() -- select default isntrument
|
---|
| 1052 | =============================================================================
|
---|
| 1053 | */
|
---|
| 1054 |
|
---|
[7258c6a] | 1055 | void l_dflt(int16_t stat, int16_t _2)
|
---|
[f40a309] | 1056 | {
|
---|
| 1057 | if (NOT stat)
|
---|
| 1058 | return;
|
---|
| 1059 |
|
---|
| 1060 | selins(0);
|
---|
| 1061 | }
|
---|
| 1062 |
|
---|
| 1063 | /*
|
---|
| 1064 | =============================================================================
|
---|
| 1065 | l_goto() -- go to (section / score)
|
---|
| 1066 | =============================================================================
|
---|
| 1067 | */
|
---|
| 1068 |
|
---|
[7258c6a] | 1069 | void l_goto(int16_t stat, int16_t _2)
|
---|
[f40a309] | 1070 | {
|
---|
| 1071 | if (NOT stat) /* only do this on key closure */
|
---|
| 1072 | return;
|
---|
| 1073 |
|
---|
| 1074 | point = GLCplot; /* set up to plot on the LCD */
|
---|
| 1075 | GLCcurs(G_ON);
|
---|
| 1076 |
|
---|
| 1077 | if (asmode) { /* cancel assignment mode */
|
---|
| 1078 |
|
---|
[9519422] | 1079 | asmode = 0;
|
---|
[f40a309] | 1080 | pkctrl = oldpk;
|
---|
| 1081 | swpt = oldsw;
|
---|
| 1082 | lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
|
---|
| 1083 | }
|
---|
| 1084 |
|
---|
| 1085 | if (ismode NE IS_NULL) { /* cancel instrument select mode */
|
---|
| 1086 |
|
---|
| 1087 | ismode = IS_NULL;
|
---|
| 1088 | sliders = oldsl;
|
---|
| 1089 | pkctrl = oldpk;
|
---|
| 1090 | swpt = oldsw;
|
---|
| 1091 | lcdlbls();
|
---|
| 1092 | }
|
---|
| 1093 |
|
---|
| 1094 | recsw = FALSE; /* force play mode */
|
---|
| 1095 | dsrpmod();
|
---|
[fa38804] | 1096 |
|
---|
[f40a309] | 1097 | switch (gomode) { /* select Go To mode */
|
---|
| 1098 |
|
---|
| 1099 | case GO_NULL:
|
---|
| 1100 |
|
---|
| 1101 | if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
|
---|
| 1102 | oldpk = pkctrl;
|
---|
| 1103 |
|
---|
| 1104 | pkctrl = PK_GOTO;
|
---|
| 1105 | gomode = GO_SECT;
|
---|
| 1106 | GLCtext(0, 31, "Sectn");
|
---|
| 1107 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
|
---|
| 1108 | break;
|
---|
| 1109 |
|
---|
| 1110 | case GO_SECT:
|
---|
| 1111 |
|
---|
| 1112 | gomode = GO_SCOR;
|
---|
| 1113 | GLCtext(0, 31, "Score");
|
---|
| 1114 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
|
---|
| 1115 | break;
|
---|
| 1116 |
|
---|
| 1117 | case GO_SCOR:
|
---|
| 1118 | default:
|
---|
| 1119 |
|
---|
| 1120 | pkctrl = oldpk;
|
---|
| 1121 | gomode = GO_NULL;
|
---|
| 1122 | GLCtext(0, 31, "Go To");
|
---|
| 1123 | lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
|
---|
| 1124 | break;
|
---|
| 1125 | }
|
---|
| 1126 |
|
---|
| 1127 | GLCcurs(G_OFF);
|
---|
| 1128 | setleds();
|
---|
| 1129 | }
|
---|
| 1130 |
|
---|
| 1131 | /*
|
---|
| 1132 | =============================================================================
|
---|
| 1133 | newpps() -- send out new polyphonic pressure source value
|
---|
| 1134 | =============================================================================
|
---|
| 1135 | */
|
---|
| 1136 |
|
---|
[7258c6a] | 1137 | void newpps(int16_t trg, int16_t grp, int16_t src, int16_t ival)
|
---|
[f40a309] | 1138 | {
|
---|
| 1139 | register struct sment *smf, *smp;
|
---|
[7258c6a] | 1140 | register uint16_t *fpu;
|
---|
| 1141 | register int32_t ltmp;
|
---|
| 1142 | register int16_t val;
|
---|
| 1143 | register int16_t vce;
|
---|
| 1144 | int16_t gs, oldi;
|
---|
[f40a309] | 1145 |
|
---|
| 1146 | gs = (grp << 4) | src; /* calculate group/source index */
|
---|
| 1147 | fpu = io_fpu + FPU_OFNC; /* point at FPU base */
|
---|
| 1148 | valents[gs].val = ival; /* update value in table */
|
---|
| 1149 | smp = smf = (struct sment *)&valents[gs];
|
---|
| 1150 |
|
---|
[fa38804] | 1151 |
|
---|
[f40a309] | 1152 | while (smf NE (smp = smp->nxt)) { /* for each function ... */
|
---|
| 1153 |
|
---|
| 1154 | vce = (smp->vp >> 4) & 0x0F; /* extract voice number */
|
---|
| 1155 |
|
---|
| 1156 | if (vce2trg[vce] EQ trg) { /* for each key that matches ... */
|
---|
| 1157 |
|
---|
| 1158 | switch (smp->vp & 0x000F) {
|
---|
| 1159 |
|
---|
| 1160 | case 1: /* frq 1 */
|
---|
| 1161 | case 3: /* frq 2 */
|
---|
| 1162 | case 5: /* frq 3 */
|
---|
| 1163 | case 7: /* frq 4 */
|
---|
| 1164 |
|
---|
| 1165 | val = ival >> 3;
|
---|
| 1166 | break;
|
---|
| 1167 |
|
---|
| 1168 | case 10: /* filtr */
|
---|
| 1169 |
|
---|
[7258c6a] | 1170 | ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
|
---|
[f40a309] | 1171 |
|
---|
[7258c6a] | 1172 | if (ltmp > (int32_t)VALMAX)
|
---|
| 1173 | ltmp = (int32_t)VALMAX;
|
---|
| 1174 | else if (ltmp < (int32_t)VALMIN)
|
---|
| 1175 | ltmp = (int32_t)VALMIN;
|
---|
[f40a309] | 1176 |
|
---|
[7258c6a] | 1177 | val = (int16_t)ltmp;
|
---|
[f40a309] | 1178 | break;
|
---|
| 1179 |
|
---|
| 1180 | default:
|
---|
| 1181 |
|
---|
| 1182 | val = ival;
|
---|
| 1183 | }
|
---|
| 1184 |
|
---|
| 1185 | oldi = setipl(FPU_DI);
|
---|
| 1186 |
|
---|
| 1187 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
| 1188 |
|
---|
| 1189 | *(fpu + (smp->vp << 4) + FPU_TCV1) = val;
|
---|
| 1190 |
|
---|
| 1191 | setipl(oldi);
|
---|
| 1192 |
|
---|
| 1193 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 1194 |
|
---|
| 1195 | }
|
---|
| 1196 | }
|
---|
| 1197 | }
|
---|
| 1198 |
|
---|
| 1199 | /*
|
---|
| 1200 | =============================================================================
|
---|
| 1201 | newsv() -- send out new source value if it's changed
|
---|
| 1202 | =============================================================================
|
---|
| 1203 | */
|
---|
| 1204 |
|
---|
[7258c6a] | 1205 | int16_t newsv(int16_t grp, int16_t src, int16_t ival)
|
---|
[f40a309] | 1206 | {
|
---|
| 1207 | register struct sment *smf, *smp;
|
---|
[7258c6a] | 1208 | register uint16_t *fpu;
|
---|
| 1209 | register int32_t ltmp;
|
---|
| 1210 | register int16_t val;
|
---|
| 1211 | register int16_t gs;
|
---|
| 1212 | register int16_t oldi;
|
---|
| 1213 | int16_t vmask, var;
|
---|
[f40a309] | 1214 |
|
---|
| 1215 | gs = (grp << 4) | src; /* calculate grp/src index */
|
---|
| 1216 |
|
---|
| 1217 | if (-1 NE (var = src2var[src])) { /* see if its a variable */
|
---|
| 1218 |
|
---|
| 1219 | vmask = vmasks[anrs[var][grp]]; /* setup resolution mask */
|
---|
| 1220 |
|
---|
| 1221 | /* see if we have a change in the selected significant bits */
|
---|
| 1222 |
|
---|
| 1223 | if (((val = valents[gs].val) & vmask) EQ (ival & vmask)) {
|
---|
| 1224 |
|
---|
| 1225 | /* make sure we always see a change to zero */
|
---|
| 1226 |
|
---|
| 1227 | if (NOT ((ival EQ 0) AND val)) /* if not becoming zero */
|
---|
| 1228 | return(FALSE); /* ... it didn't change enough */
|
---|
| 1229 | }
|
---|
| 1230 | }
|
---|
| 1231 |
|
---|
| 1232 | fpu = io_fpu + FPU_OFNC; /* point to FPU */
|
---|
| 1233 |
|
---|
| 1234 | valents[gs].val = ival; /* update value in table */
|
---|
| 1235 |
|
---|
| 1236 | smf = (struct sment *)&valents[gs]; /* point at value table */
|
---|
| 1237 | smp = smf;
|
---|
| 1238 |
|
---|
[fa38804] | 1239 |
|
---|
[f40a309] | 1240 | while (smf NE (smp = smp->nxt)) { /* update functions */
|
---|
| 1241 |
|
---|
| 1242 | switch (smp->vp & 0x000F) {
|
---|
| 1243 |
|
---|
| 1244 | case 1: /* frq 1 */
|
---|
| 1245 | case 3: /* frq 2 */
|
---|
| 1246 | case 5: /* frq 3 */
|
---|
| 1247 | case 7: /* frq 4 */
|
---|
| 1248 |
|
---|
| 1249 | val = ival >> 3;
|
---|
| 1250 | break;
|
---|
| 1251 |
|
---|
| 1252 | case 10: /* filtr */
|
---|
| 1253 |
|
---|
[7258c6a] | 1254 | ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
|
---|
[f40a309] | 1255 |
|
---|
[7258c6a] | 1256 | if (ltmp > (int32_t)VALMAX)
|
---|
| 1257 | ltmp = (int32_t)VALMAX;
|
---|
| 1258 | else if (ltmp < (int32_t)VALMIN)
|
---|
| 1259 | ltmp = (int32_t)VALMIN;
|
---|
[f40a309] | 1260 |
|
---|
[7258c6a] | 1261 | val = (int16_t)ltmp;
|
---|
[f40a309] | 1262 | break;
|
---|
| 1263 |
|
---|
| 1264 | default:
|
---|
| 1265 |
|
---|
| 1266 | val = ival;
|
---|
| 1267 | }
|
---|
| 1268 |
|
---|
| 1269 | oldi = setipl(FPU_DI);
|
---|
| 1270 |
|
---|
| 1271 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
| 1272 |
|
---|
| 1273 | *(fpu + (smp->vp << 4) + FPU_TCV1) = val;
|
---|
| 1274 |
|
---|
| 1275 | setipl(oldi);
|
---|
| 1276 |
|
---|
| 1277 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 1278 |
|
---|
| 1279 | }
|
---|
| 1280 |
|
---|
| 1281 | return(TRUE);
|
---|
| 1282 | }
|
---|
| 1283 |
|
---|
| 1284 | /*
|
---|
| 1285 | =============================================================================
|
---|
| 1286 | setsv() -- unconditionally send out new source value
|
---|
| 1287 | =============================================================================
|
---|
| 1288 | */
|
---|
| 1289 |
|
---|
[7258c6a] | 1290 | void setsv(int16_t grp, int16_t src, int16_t ival)
|
---|
[f40a309] | 1291 | {
|
---|
| 1292 | register struct sment *smf, *smp;
|
---|
[7258c6a] | 1293 | register uint16_t *fpu;
|
---|
| 1294 | register int32_t ltmp;
|
---|
| 1295 | register int16_t val;
|
---|
| 1296 | register int16_t gs;
|
---|
| 1297 | register int16_t oldi;
|
---|
[f40a309] | 1298 |
|
---|
| 1299 | gs = (grp << 4) | src; /* calculate grp/src index */
|
---|
| 1300 | fpu = io_fpu + FPU_OFNC; /* point to FPU */
|
---|
| 1301 |
|
---|
| 1302 | valents[gs].val = ival; /* update value in table */
|
---|
| 1303 |
|
---|
| 1304 | smf = (struct sment *)&valents[gs]; /* point at value table */
|
---|
| 1305 | smp = smf;
|
---|
| 1306 |
|
---|
[fa38804] | 1307 |
|
---|
[f40a309] | 1308 | while (smf NE (smp = smp->nxt)) { /* update functions */
|
---|
| 1309 |
|
---|
| 1310 | switch (smp->vp & 0x000F) {
|
---|
| 1311 |
|
---|
| 1312 | case 1: /* frq 1 */
|
---|
| 1313 | case 3: /* frq 2 */
|
---|
| 1314 | case 5: /* frq 3 */
|
---|
| 1315 | case 7: /* frq 4 */
|
---|
| 1316 |
|
---|
| 1317 | val = ival >> 3;
|
---|
| 1318 | break;
|
---|
| 1319 |
|
---|
| 1320 | case 10: /* filtr */
|
---|
| 1321 |
|
---|
[7258c6a] | 1322 | ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
|
---|
[f40a309] | 1323 |
|
---|
[7258c6a] | 1324 | if (ltmp > (int32_t)VALMAX)
|
---|
| 1325 | ltmp = (int32_t)VALMAX;
|
---|
| 1326 | else if (ltmp < (int32_t)VALMIN)
|
---|
| 1327 | ltmp = (int32_t)VALMIN;
|
---|
[f40a309] | 1328 |
|
---|
[7258c6a] | 1329 | val = (int16_t)ltmp;
|
---|
[f40a309] | 1330 | break;
|
---|
| 1331 |
|
---|
| 1332 | default:
|
---|
| 1333 |
|
---|
| 1334 | val = ival;
|
---|
| 1335 | }
|
---|
| 1336 |
|
---|
| 1337 | oldi = setipl(FPU_DI);
|
---|
| 1338 |
|
---|
| 1339 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
| 1340 |
|
---|
| 1341 | *(fpu + (smp->vp << 4) + FPU_TCV1) = val;
|
---|
| 1342 |
|
---|
| 1343 | setipl(oldi);
|
---|
| 1344 |
|
---|
| 1345 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 1346 |
|
---|
| 1347 | }
|
---|
| 1348 | }
|
---|
| 1349 |
|
---|
| 1350 | /*
|
---|
| 1351 | =============================================================================
|
---|
| 1352 | l_prmtr() -- set parameter articulation status
|
---|
| 1353 | =============================================================================
|
---|
| 1354 | */
|
---|
| 1355 |
|
---|
[7258c6a] | 1356 | void l_prmtr(int16_t stat, int16_t sig)
|
---|
[f40a309] | 1357 | {
|
---|
| 1358 | if (NOT stat)
|
---|
| 1359 | return;
|
---|
| 1360 |
|
---|
| 1361 | switch (sliders) {
|
---|
| 1362 |
|
---|
| 1363 | case LS_PRMTR:
|
---|
| 1364 | case LS_OTHER:
|
---|
| 1365 | case LS_EQ:
|
---|
| 1366 |
|
---|
| 1367 | sliders = LS_VOICE;
|
---|
[6dd74a9] | 1368 | swpt = &t_voice;
|
---|
[f40a309] | 1369 | break;
|
---|
| 1370 |
|
---|
| 1371 | case LS_VOICE:
|
---|
| 1372 | default:
|
---|
| 1373 |
|
---|
| 1374 | sliders = LS_PRMTR;
|
---|
[6dd74a9] | 1375 | swpt = &t_prmtr;
|
---|
[f40a309] | 1376 | break;
|
---|
| 1377 | }
|
---|
| 1378 |
|
---|
| 1379 | lcdlbls();
|
---|
| 1380 | setleds();
|
---|
| 1381 | }
|
---|
| 1382 |
|
---|
| 1383 | /*
|
---|
| 1384 | =============================================================================
|
---|
| 1385 | l_voice() -- set voice selection status
|
---|
| 1386 | =============================================================================
|
---|
| 1387 | */
|
---|
| 1388 |
|
---|
[7258c6a] | 1389 | void l_voice(int16_t stat, int16_t vce)
|
---|
[f40a309] | 1390 | {
|
---|
[7258c6a] | 1391 | register int16_t ap, j, par;
|
---|
| 1392 | register uint16_t *fpu;
|
---|
[f40a309] | 1393 |
|
---|
[7258c6a] | 1394 | int8_t buf[8];
|
---|
[f40a309] | 1395 |
|
---|
| 1396 | if (NOT stat)
|
---|
| 1397 | return;
|
---|
| 1398 |
|
---|
| 1399 | articen[vce] = NOT articen[vce]; /* toggle voice enable */
|
---|
| 1400 |
|
---|
| 1401 | sprintf(buf, "%c%2d %c", (articen[vce] ? '\176' : ' '), vce + 1,
|
---|
| 1402 | (articen[vce] ? '\177' : ' '));
|
---|
| 1403 |
|
---|
| 1404 | GLCcurs(G_ON);
|
---|
| 1405 | GLCtext(0, (1 + (6 * vce)), buf);
|
---|
| 1406 | GLCcurs(G_OFF);
|
---|
| 1407 |
|
---|
| 1408 | if (articen[vce]) { /* turn articulation on if voice is enabled */
|
---|
| 1409 |
|
---|
| 1410 | for (ap = 0; ap < 14; ap++) {
|
---|
| 1411 |
|
---|
| 1412 | par = arpar[ap];
|
---|
| 1413 | sendart(vce, par, lastart[par]);
|
---|
| 1414 | }
|
---|
| 1415 |
|
---|
| 1416 | } else { /* ... or turn it off if voice is disabled */
|
---|
| 1417 |
|
---|
| 1418 | fpu = io_fpu + FPU_OFNC + (vce << 8);
|
---|
| 1419 |
|
---|
| 1420 | for (j = 1; j < 16; j++)
|
---|
| 1421 | *(fpu + (j << 4) + FPU_TSF2) = 0;
|
---|
| 1422 | }
|
---|
| 1423 | }
|
---|
| 1424 |
|
---|
| 1425 | /*
|
---|
| 1426 | =============================================================================
|
---|
| 1427 | l_group() -- set group selection status
|
---|
| 1428 | =============================================================================
|
---|
| 1429 | */
|
---|
| 1430 |
|
---|
[7258c6a] | 1431 | void l_group(int16_t stat, int16_t grp)
|
---|
[f40a309] | 1432 | {
|
---|
[7258c6a] | 1433 | int8_t buf[8];
|
---|
[f40a309] | 1434 |
|
---|
| 1435 | if (NOT stat)
|
---|
| 1436 | return;
|
---|
| 1437 |
|
---|
| 1438 | grpsel[grp] = NOT grpsel[grp]; /* toggle voice enable */
|
---|
| 1439 |
|
---|
| 1440 | sprintf(buf, "%c%2d %c", (grpsel[grp] ? '\176' : ' '), grp + 1,
|
---|
| 1441 | (grpsel[grp] ? '\177' : ' '));
|
---|
| 1442 |
|
---|
| 1443 | GLCcurs(G_ON);
|
---|
| 1444 | GLCtext(0, (1 + (6 * grp)), buf);
|
---|
| 1445 | GLCcurs(G_OFF);
|
---|
| 1446 | }
|
---|
| 1447 |
|
---|
| 1448 | /*
|
---|
| 1449 | =============================================================================
|
---|
| 1450 | l_other -- set aux function status
|
---|
| 1451 | =============================================================================
|
---|
| 1452 | */
|
---|
| 1453 |
|
---|
[7258c6a] | 1454 | void l_other(int16_t stat, int16_t sig)
|
---|
[f40a309] | 1455 | {
|
---|
| 1456 | if (NOT stat)
|
---|
| 1457 | return;
|
---|
| 1458 |
|
---|
| 1459 | sliders = LS_OTHER;
|
---|
[6dd74a9] | 1460 | swpt = &t_other;
|
---|
[f40a309] | 1461 |
|
---|
| 1462 | lcdlbls();
|
---|
| 1463 | }
|
---|
| 1464 |
|
---|
| 1465 | /*
|
---|
| 1466 | =============================================================================
|
---|
| 1467 | l_eq -- set eq mode
|
---|
| 1468 | =============================================================================
|
---|
| 1469 | */
|
---|
| 1470 |
|
---|
[7258c6a] | 1471 | void l_eq(int16_t stat, int16_t sig)
|
---|
[f40a309] | 1472 | {
|
---|
| 1473 | if (NOT stat)
|
---|
| 1474 | return;
|
---|
| 1475 |
|
---|
| 1476 | if (sliders EQ LS_EQ) {
|
---|
| 1477 |
|
---|
| 1478 | sliders = LS_PRMTR;
|
---|
[6dd74a9] | 1479 | swpt = &t_prmtr;
|
---|
[f40a309] | 1480 |
|
---|
| 1481 | } else {
|
---|
| 1482 |
|
---|
| 1483 | sliders = LS_EQ;
|
---|
[6dd74a9] | 1484 | swpt = &t_eq;
|
---|
[f40a309] | 1485 | }
|
---|
| 1486 |
|
---|
| 1487 | lcdlbls();
|
---|
| 1488 | }
|
---|
| 1489 |
|
---|
| 1490 | /*
|
---|
| 1491 | =============================================================================
|
---|
| 1492 | artclr() -- clear the articulation pot values
|
---|
| 1493 | =============================================================================
|
---|
| 1494 | */
|
---|
| 1495 |
|
---|
[0580615] | 1496 | void artclr(void)
|
---|
[f40a309] | 1497 | {
|
---|
[7258c6a] | 1498 | register int16_t i;
|
---|
[f40a309] | 1499 |
|
---|
| 1500 | for (i = 0; i < 14; i++)
|
---|
| 1501 | lastart[arpar[i]] = artitab[i];
|
---|
| 1502 | }
|
---|
| 1503 |
|
---|
| 1504 | /*
|
---|
| 1505 | =============================================================================
|
---|
| 1506 | l_init() -- initialize articulation values (reset the sliders)
|
---|
| 1507 | =============================================================================
|
---|
| 1508 | */
|
---|
| 1509 |
|
---|
[7258c6a] | 1510 | void l_init(int16_t stat, int16_t sig)
|
---|
[f40a309] | 1511 | {
|
---|
[7258c6a] | 1512 | register uint16_t *fpu;
|
---|
| 1513 | register int16_t barval, i, j;
|
---|
| 1514 | int8_t buf[16];
|
---|
[f40a309] | 1515 |
|
---|
| 1516 | if (NOT stat)
|
---|
| 1517 | return;
|
---|
| 1518 |
|
---|
| 1519 | fpu = io_fpu + FPU_OFNC;
|
---|
| 1520 |
|
---|
| 1521 | switch (sliders) {
|
---|
| 1522 |
|
---|
| 1523 | case LS_PRMTR:
|
---|
| 1524 | case LS_VOICE:
|
---|
| 1525 | case LS_INST:
|
---|
| 1526 | case LS_LIBR:
|
---|
| 1527 | case LS_NGRP:
|
---|
| 1528 | case LS_LOAD:
|
---|
| 1529 |
|
---|
| 1530 | /* clear all but spares in voices 1..12 */
|
---|
| 1531 |
|
---|
| 1532 | for (i = 0; i < 12; i++)
|
---|
| 1533 | for (j = 1; j < 16; j++)
|
---|
| 1534 | *(fpu + (i << 8) + (j << 4) + FPU_TSF2) = 0;
|
---|
| 1535 |
|
---|
| 1536 | artclr();
|
---|
| 1537 |
|
---|
| 1538 | for (i = 0; i < 14; i++) {
|
---|
| 1539 |
|
---|
| 1540 | BGprmtr[i] = artitab[i];
|
---|
| 1541 |
|
---|
| 1542 | if (BarType[i]) {
|
---|
| 1543 |
|
---|
| 1544 | barval = (((artitab[i] >> 5) - 500) << 6) / 252;
|
---|
| 1545 | BarCset(i, barval);
|
---|
| 1546 |
|
---|
| 1547 | } else {
|
---|
| 1548 |
|
---|
| 1549 | barval = artitab[i] / 252;
|
---|
| 1550 | BarBset(i, barval);
|
---|
| 1551 | }
|
---|
| 1552 | }
|
---|
| 1553 |
|
---|
| 1554 | break;
|
---|
| 1555 |
|
---|
| 1556 | case LS_OTHER:
|
---|
| 1557 |
|
---|
| 1558 | /* clear spares in voices 2..12 */
|
---|
| 1559 |
|
---|
| 1560 | for (i = 1; i < 12; i++)
|
---|
| 1561 | *(fpu + (i << 8) + FPU_TSF2) = 0;
|
---|
| 1562 |
|
---|
| 1563 | for (i = 0; i < 14; i++)
|
---|
| 1564 | BarBset(i, BGother[i] = 0);
|
---|
| 1565 |
|
---|
| 1566 | break;
|
---|
| 1567 |
|
---|
| 1568 | case LS_EQ:
|
---|
| 1569 |
|
---|
| 1570 | for (i = 0; i < 14; i++) {
|
---|
| 1571 |
|
---|
| 1572 | sendeq(i, gain2eq(0));
|
---|
| 1573 | BarCset(i, BGeq[i] = 0);
|
---|
| 1574 | }
|
---|
| 1575 |
|
---|
| 1576 | break;
|
---|
| 1577 | }
|
---|
| 1578 | }
|
---|
| 1579 |
|
---|
| 1580 | /*
|
---|
| 1581 | =============================================================================
|
---|
| 1582 | sendart() -- send out an articulation value
|
---|
| 1583 | =============================================================================
|
---|
| 1584 | */
|
---|
| 1585 |
|
---|
[7258c6a] | 1586 | void sendart(int16_t vce, int16_t par, int16_t ival)
|
---|
[f40a309] | 1587 | {
|
---|
[7258c6a] | 1588 | register uint16_t *fpu;
|
---|
| 1589 | register int16_t val, oldi, mult;
|
---|
| 1590 | int16_t nop;
|
---|
[f40a309] | 1591 |
|
---|
| 1592 | lastart[par] = ival;
|
---|
| 1593 |
|
---|
| 1594 | fpu = io_fpu + FPU_OFNC + (vce << 8) + (par << 4);
|
---|
| 1595 | mult = 0x7FFF;
|
---|
| 1596 |
|
---|
| 1597 | switch (par) {
|
---|
| 1598 |
|
---|
| 1599 | case 1: /* freq 1 */
|
---|
| 1600 | case 3: /* freq 2 */
|
---|
| 1601 | case 5: /* freq 3 */
|
---|
| 1602 | case 7: /* freq 4 */
|
---|
| 1603 |
|
---|
| 1604 | val = addpch(ival, 0);
|
---|
| 1605 | break;
|
---|
| 1606 |
|
---|
| 1607 | case 10: /* filter */
|
---|
| 1608 |
|
---|
| 1609 | val = ((ival >> 5) - 500) << 5;
|
---|
| 1610 | break;
|
---|
| 1611 |
|
---|
| 1612 | case 2: /* level */
|
---|
| 1613 |
|
---|
| 1614 | val = ival;
|
---|
| 1615 | mult = 0xFFFF;
|
---|
| 1616 | break;
|
---|
| 1617 |
|
---|
| 1618 | case 4: /* location */
|
---|
| 1619 |
|
---|
| 1620 | val = ((ival >> 5) - 500) << 5;
|
---|
| 1621 | mult = 0xFFFF;
|
---|
| 1622 | break;
|
---|
| 1623 |
|
---|
| 1624 | default:
|
---|
| 1625 |
|
---|
| 1626 | val = ival;
|
---|
| 1627 | }
|
---|
| 1628 |
|
---|
| 1629 | oldi = setipl(FPU_DI);
|
---|
| 1630 |
|
---|
| 1631 | /* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
|
---|
| 1632 |
|
---|
| 1633 | *(fpu + FPU_TCV2) = val;
|
---|
| 1634 | ++nop; ++nop; ++nop;
|
---|
| 1635 | *(fpu + FPU_TSF2) = mult;
|
---|
| 1636 |
|
---|
| 1637 | setipl(oldi);
|
---|
| 1638 |
|
---|
| 1639 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 1640 |
|
---|
| 1641 | }
|
---|
| 1642 |
|
---|
| 1643 | /*
|
---|
| 1644 | =============================================================================
|
---|
| 1645 | doslide() -- update a changed slider value
|
---|
| 1646 | =============================================================================
|
---|
| 1647 | */
|
---|
| 1648 |
|
---|
[0580615] | 1649 | void doslide(void)
|
---|
[f40a309] | 1650 | {
|
---|
[7258c6a] | 1651 | register int16_t arp, bar, barval, i, slval;
|
---|
[f40a309] | 1652 |
|
---|
| 1653 | slval = ART_VAL(aval); /* scaled articulation value */
|
---|
| 1654 | bar = asig - 25; /* bar number */
|
---|
| 1655 |
|
---|
| 1656 | switch (sliders) {
|
---|
| 1657 |
|
---|
| 1658 | case LS_PRMTR: /* parameter articulation */
|
---|
| 1659 | case LS_VOICE:
|
---|
| 1660 | case LS_INST:
|
---|
| 1661 | case LS_LIBR:
|
---|
| 1662 | case LS_NGRP:
|
---|
| 1663 | case LS_LOAD:
|
---|
| 1664 |
|
---|
| 1665 | BGprmtr[bar] = slval;
|
---|
| 1666 | arp = arpar[bar];
|
---|
| 1667 |
|
---|
| 1668 | for (i = 0; i < 12; i++)
|
---|
| 1669 | if (articen[i])
|
---|
| 1670 | sendart(i, arp, slval);
|
---|
| 1671 |
|
---|
| 1672 | if (BarType[bar]) { /* center-zero bar */
|
---|
| 1673 |
|
---|
| 1674 | barval = (((slval >> 5) - 500) << 6) / 252;
|
---|
| 1675 | BarCadj(bar, barval);
|
---|
| 1676 |
|
---|
| 1677 | } else { /* bottom-zero bar */
|
---|
| 1678 |
|
---|
| 1679 | barval = slval / 252;
|
---|
| 1680 | BarBadj(bar, barval);
|
---|
| 1681 | }
|
---|
| 1682 |
|
---|
| 1683 | return;
|
---|
[fa38804] | 1684 |
|
---|
[f40a309] | 1685 | case LS_OTHER: /* aux, dome, cv control */
|
---|
| 1686 |
|
---|
| 1687 | switch (asig) {
|
---|
| 1688 |
|
---|
| 1689 | case 26: /* aux mod */
|
---|
| 1690 | sendart(9, 0, slval);
|
---|
| 1691 | break;
|
---|
| 1692 |
|
---|
| 1693 | case 27: /* depth */
|
---|
| 1694 | sendart(3, 0, slval);
|
---|
| 1695 | break;
|
---|
| 1696 |
|
---|
| 1697 | case 28: /* rate */
|
---|
| 1698 | sendart(2, 0, slval);
|
---|
| 1699 | break;
|
---|
| 1700 |
|
---|
| 1701 | case 29: /* intensity */
|
---|
| 1702 | sendart(1, 0, slval);
|
---|
| 1703 | break;
|
---|
| 1704 |
|
---|
| 1705 | case 30: /* cv1 */
|
---|
| 1706 | sendart(11, 0, slval);
|
---|
| 1707 | break;
|
---|
| 1708 |
|
---|
| 1709 | case 31: /* cv2 */
|
---|
| 1710 | sendart(10, 0, slval);
|
---|
| 1711 | break;
|
---|
| 1712 |
|
---|
| 1713 | case 32: /* cv3 */
|
---|
| 1714 | sendart(6, 0, slval);
|
---|
| 1715 | break;
|
---|
| 1716 |
|
---|
| 1717 | case 33: /* cv4 */
|
---|
| 1718 | sendart(8, 0, slval);
|
---|
| 1719 | break;
|
---|
| 1720 |
|
---|
| 1721 | default:
|
---|
| 1722 | slval = 0; /* force unused pots to stay zero */
|
---|
| 1723 | break;
|
---|
| 1724 | }
|
---|
| 1725 |
|
---|
| 1726 | BGother[bar] = slval;
|
---|
| 1727 | barval = slval / 252;
|
---|
| 1728 | BarBadj(bar, barval);
|
---|
| 1729 |
|
---|
| 1730 | return;
|
---|
| 1731 |
|
---|
[fa38804] | 1732 |
|
---|
[f40a309] | 1733 | case LS_EQ: /* eq control */
|
---|
| 1734 |
|
---|
| 1735 | barval = (((slval >> 5) - 500) << 6) / 252;
|
---|
| 1736 | BGeq[bar] = barval;
|
---|
| 1737 | sendeq(bar, gain2eq(SL2GAIN(slval)));
|
---|
| 1738 | BarCadj(bar, barval);
|
---|
| 1739 |
|
---|
| 1740 | return;
|
---|
| 1741 |
|
---|
| 1742 | default:
|
---|
| 1743 | return;
|
---|
| 1744 | }
|
---|
| 1745 | }
|
---|
| 1746 |
|
---|
| 1747 | /*
|
---|
| 1748 | =============================================================================
|
---|
| 1749 | settmpo() -- set the tempo
|
---|
| 1750 | =============================================================================
|
---|
| 1751 | */
|
---|
| 1752 |
|
---|
[7258c6a] | 1753 | void settmpo(int16_t val)
|
---|
[f40a309] | 1754 | {
|
---|
[7258c6a] | 1755 | register int16_t timeval;
|
---|
[f40a309] | 1756 |
|
---|
| 1757 | tmpoval = val;
|
---|
| 1758 | timeval = ( ( (tmpomlt + 50) * tmpoval) / 100);
|
---|
[7258c6a] | 1759 | timeval = (int16_t)( (192000L / timeval) - 1);
|
---|
[f40a309] | 1760 | TIME_T2H = timeval >> 8;
|
---|
| 1761 | TIME_T2L = timeval & 0x00FF;
|
---|
| 1762 | }
|
---|
| 1763 |
|
---|
| 1764 | /*
|
---|
| 1765 | =============================================================================
|
---|
| 1766 | settune() -- send the fine tuning from tuneval to the FPU
|
---|
| 1767 | =============================================================================
|
---|
| 1768 | */
|
---|
| 1769 |
|
---|
[0580615] | 1770 | void settune(void)
|
---|
[f40a309] | 1771 | {
|
---|
[7258c6a] | 1772 | register int16_t oldi, i, grp;
|
---|
| 1773 | register uint16_t *fpu;
|
---|
| 1774 | register int32_t trval, trmax;
|
---|
| 1775 | int16_t nop;
|
---|
[f40a309] | 1776 |
|
---|
| 1777 | trmax = PCHMAX;
|
---|
| 1778 |
|
---|
| 1779 | oldi = setsr(0x2200);
|
---|
| 1780 |
|
---|
| 1781 | /* +++++++++++++++++++++++ FPU interrupts disabled ++++++++++++++++++++++++++ */
|
---|
| 1782 |
|
---|
| 1783 | for (i = 0; i < 12; i++) {
|
---|
| 1784 |
|
---|
| 1785 | if (-1 NE (grp = vce2grp[i])) {
|
---|
| 1786 |
|
---|
[7258c6a] | 1787 | trval = (int32_t)tuneval + ((int32_t)s_trns[grp - 1] << 1);
|
---|
[f40a309] | 1788 |
|
---|
| 1789 | if (trval > trmax)
|
---|
| 1790 | trval = trmax;
|
---|
| 1791 |
|
---|
| 1792 | } else {
|
---|
| 1793 |
|
---|
[7258c6a] | 1794 | trval = (int32_t)tuneval;
|
---|
[f40a309] | 1795 | }
|
---|
| 1796 |
|
---|
| 1797 | fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0010; /* freq 1 */
|
---|
| 1798 |
|
---|
[7258c6a] | 1799 | *(fpu + FPU_TCV3) = (uint16_t)(0x0000FFFFL & trval);
|
---|
[f40a309] | 1800 | ++nop; ++nop; ++nop;
|
---|
| 1801 | *(fpu + FPU_TSF3) = 0x7FFF;
|
---|
| 1802 | }
|
---|
| 1803 |
|
---|
| 1804 | setsr(oldi);
|
---|
| 1805 |
|
---|
| 1806 | /* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
|
---|
| 1807 |
|
---|
| 1808 | }
|
---|
[6262b5c] | 1809 |
|
---|