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