1 /* 2 globals.h - general static definitions 3 4 Copyright 2018-2021, Will Godfrey 5 6 This file is part of yoshimi, which is free software: you can redistribute 7 it and/or modify it under the terms of the GNU Library General Public 8 License as published by the Free Software Foundation; either version 2 of 9 the License, or (at your option) any later version. 10 11 yoshimi is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 FOR A PARTICULAR PURPOSE. See the GNU General Public License (version 2 or 14 later for more details. 15 16 You should have received a copy of the GNU General Public License along with 17 yoshimi; if not, write to the Free Software Foundation, Inc., 51 Franklin 18 Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef GLOBALS_H 22 #define GLOBALS_H 23 24 #include <cstdint> 25 #include <cstddef> 26 #include <string> 27 28 /* 29 * For test purposes where you want guaranteed identical results, enable the 30 * #define below. 31 * Be aware this does strange things to both subSynth and padSynth as they 32 * actually *require* randomness to produce normal sounds. 33 */ 34 //#define NORANDOM ON 35 36 // math 37 #define PI 3.1415926536f 38 #define TWOPI 6.28318530718f 39 #define HALFPI 1.57079632679f 40 #define LOG_2 0.693147181f 41 42 /* 43 * we only use 23 bits as with 24 there is risk of 44 * an overflow when making float/int conversions 45 */ 46 #define Fmul2I 1073741823 47 #define Cshift2I 23 48 49 // many of the following are for convenience and consistency 50 // changing them is likely to have unpredicable consequences 51 52 // sizes 53 #define COMMAND_SIZE 252 54 #define MAX_HISTORY 25 55 #define MAX_PRESETS 1000 56 #define MAX_PRESET_DIRS 128 57 #define MAX_BANK_ROOT_DIRS 128 58 #define MAX_BANKS_IN_ROOT 128 59 #define MAX_INSTRUMENTS_IN_BANK 160 60 #define MAX_AD_HARMONICS 128 61 #define MAX_SUB_HARMONICS 64 62 #define PAD_MAX_SAMPLES 96 63 #define NUM_MIDI_PARTS 64 64 #define PART_NORMAL 0 65 #define PART_MONO 1 66 #define PART_LEGATO 2 67 #define MIDI_NOT_LEGATO 3 68 #define MIDI_LEGATO 4 69 #define NUM_MIDI_CHANNELS 16 70 #define MIDI_LEARN_BLOCK 400 71 #define MAX_ENVELOPE_POINTS 40 72 #define MIN_ENVELOPE_DB -60 73 #define MAX_RESONANCE_POINTS 256 74 #define MAX_KEY_SHIFT 36 75 #define MIN_KEY_SHIFT -36 76 #define A_MIN 30.0f 77 #define A_DEF 440.0f 78 #define A_MAX 1100.0f 79 80 // The number of discrete steps we use for the LFO BPM frequency. Make sure to 81 // update LFO_BPM_LCM as well, if this is updated. 82 #define LFO_BPM_STEPS 33 83 // The Least Common Multiple of all the possible LFO fractions. 84 #define LFO_BPM_LCM 720720 85 86 #define MIN_OSCIL_SIZE 256 // MAX_AD_HARMONICS * 2 87 #define MAX_OSCIL_SIZE 16384 88 #define MIN_BUFFER_SIZE 16 89 #define MAX_BUFFER_SIZE 8192 90 #define NO_MSG 255 // these two may become different 91 #define UNUSED 255 92 93 // GUI colours 94 #define ADD_COLOUR 0xdfafbf00 95 #define BASE_COLOUR 0xbfbfbf00 96 #define SUB_COLOUR 0xafcfdf00 97 #define PAD_COLOUR 0xcfdfaf00 98 #define YOSHI_COLOUR 0x0000e100 99 #define EXTOSC_COLOUR 0x8fbfdf00 100 #define EXTVOICE_COLOUR 0x9fdf8f00 101 #define MODOFF_COLOUR 0x80808000 102 103 // these were previously (pointlessly) user configurable 104 #define NUM_VOICES 8 105 #define POLIPHONY 60 106 #define PART_DEFAULT_LIMIT 20 107 #define NUM_SYS_EFX 4 108 #define NUM_INS_EFX 8 109 #define NUM_PART_EFX 3 110 #define NUM_KIT_ITEMS 16 111 #define FADEIN_ADJUSTMENT_SCALE 20 112 #define MAX_EQ_BANDS 8 // MAX_EQ_BANDS must be less than 20 113 #define MAX_FILTER_STAGES 5 114 #define FF_MAX_VOWELS 6 115 #define FF_MAX_FORMANTS 12 116 #define FF_MAX_SEQUENCE 8 117 118 #define DEFAULT_NAME "Simple Sound" 119 #define UNTITLED "No Title" 120 121 #define DEFAULT_AUDIO alsa_audio 122 #define DEFAULT_MIDI alsa_midi 123 124 #define FORCED_EXIT 16 125 126 namespace _SYS_ 127 { 128 // float to bool done this way to ensure consistency 129 // we are always using positive values F2B(float value)130 inline bool F2B(float value) {return value > 0.5f;} 131 132 enum mute {Idle, Pending, Fading, Active, Complete, Request, Immediate}; 133 134 // session types and stages 135 enum type {Normal, Default, JackFirst, JackSecond, StartupFirst, StartupSecond, InProgram, RestoreConf}; 136 137 // Log types 138 const char LogNormal = 0; 139 const char LogError = 1; 140 const char LogNotSerious = 2; 141 } 142 143 /* 144 * for many of the following, where they are in groups the 145 * group order must not change, but the actual values can 146 * and new entries can be added between the group ends 147 * 148 * *** WARNING *** 149 * 150 * The above is no longer completely true! 151 * Controller numbers in particular must not change if 152 * these might be recorded in MIDI-learn files. The same 153 * applies to voice numbers in 'engine' - use existing 154 * gaps for new controls instead. 155 * 156 * Generally any controls/features that can't be learned 157 * should be safe to move. 158 */ 159 160 namespace TOPLEVEL // usage TOPLEVEL::section::vector 161 { 162 enum section : unsigned char { 163 part1 = 0, // nothing must come 164 part64 = 63, // between these two 165 166 copyPaste = 72, // 48 (not yet!) 167 vector = 192, // CO 168 midiLearn = 216, // D8 169 midiIn, 170 scales = 232, // E8 171 main = 240, // F0 172 systemEffects, 173 insertEffects, 174 bank = 244, // F4 175 config = 248, // F8 176 message = 250 // FA 177 }; 178 179 namespace type { 180 enum { 181 // bits 0, 1 as values 182 Adjust = 0, // return value adjusted within limits 183 Minimum, // return this value 184 Maximum, // return this value 185 Default, // return this value 186 // remaining used bit-wise 187 Limits, // read limits shown above 188 Error = 8, 189 LearnRequest = 16, 190 Learnable = 32, 191 Write = 64, 192 Integer = 128 // false = float 193 }; 194 } 195 196 namespace action { 197 enum { 198 // bits 0 to 3 199 toAll = 0, // except MIDI 200 fromMIDI, 201 fromCLI, 202 fromGUI, 203 // space for any other sources 204 noAction = 15, // internal use 205 // remaining used bit-wise 206 forceUpdate = 32, 207 loop = 64, // internal use 208 lowPrio = 128, 209 muteAndLoop = 192 210 }; 211 } 212 213 enum control : unsigned char { 214 // insert any new entries here 215 216 /* 217 * the following values must never appear in any other sections 218 */ 219 unrecognised = 253, // FD 220 textMessage, 221 forceExit // this is effective from *any* section! 222 }; 223 224 enum msgResponse : unsigned char { 225 refreshBankDefaults, 226 cancelBankDefaults, 227 cancelMidiLearn 228 // any other value = no response 229 // but there may still be a message 230 }; 231 232 // inserts are here as they are split between many 233 // sections but must remain distinct. 234 enum insert : unsigned char { 235 LFOgroup = 0, 236 filterGroup, 237 envelopeGroup, 238 envelopePoints, // this should be split in two 239 envelopePointChange, 240 oscillatorGroup, // 5 241 harmonicAmplitude, 242 harmonicPhaseBandwidth, // this should also be split in two 243 resonanceGroup, 244 resonanceGraphInsert, // 9 245 systemEffectSend = 16, 246 partEffectSelect, 247 kitGroup = 32 248 }; 249 250 enum insertType : unsigned char { 251 amplitude = 0, 252 frequency, 253 filter, 254 bandwidth 255 }; 256 257 enum XML : unsigned char { // file and history types 258 Instrument = 0, // individual externally sourced Instruments 259 Patch, // full instrument Patch Sets 260 Scale, // complete Microtonal settings 261 State, // entire system State 262 Vector, // per channel Vector settings 263 MLearn, // learned MIDI CC lists 264 Presets, // parts of instruments or effects 265 266 // not XML but there for consistency 267 PadSample, 268 ScalaTune, 269 ScalaMap, 270 Dir, // for filer, any directory request 271 272 // only file types from here onwards 273 Config, 274 MasterConfig, 275 Bank, 276 History 277 }; 278 } 279 280 namespace CONFIG // usage CONFIG::control::oscillatorSize 281 { 282 enum control : unsigned char { 283 oscillatorSize = 0, 284 bufferSize, 285 padSynthInterpolation, 286 virtualKeyboardLayout, 287 XMLcompressionLevel, 288 reportsDestination, 289 logTextSize, 290 savedInstrumentFormat, 291 defaultStateStart = 16, 292 hideNonFatalErrors, 293 showSplash, 294 logInstrumentLoadTimes, 295 logXMLheaders, 296 saveAllXMLdata, 297 enableGUI, 298 enableCLI, 299 enableAutoInstance, 300 enableSinglePath, 301 enableHighlight, // in banks 302 historyLock, 303 exposeStatus, // CLI only 304 305 // start of engine controls 306 jackMidiSource = 32, 307 jackPreferredMidi, 308 jackServer, 309 jackPreferredAudio, 310 jackAutoConnectAudio, 311 alsaMidiSource = 48, 312 alsaPreferredMidi, 313 alsaMidiType, 314 alsaAudioDevice, 315 alsaPreferredAudio, 316 alsaSampleRate, 317 readAudio, 318 readMIDI, 319 320 // end of engine controls 321 addPresetRootDir = 60, 322 removePresetRootDir, 323 currentPresetRoot, 324 bankRootCC = 65, 325 bankCC = 67, 326 enableProgramChange, 327 extendedProgramChangeCC = 71, 328 ignoreResetAllCCs, 329 logIncomingCCs, 330 showLearnEditor, 331 enableNRPNs, 332 saveCurrentConfig = 80 333 }; 334 } 335 336 namespace BANK // usage BANK::control:: 337 { 338 enum control : unsigned char { 339 // instrument selection done in 'part' 340 // actual control should probably be here 341 readInstrumentName = 0, // in bank, by ID 342 findInstrumentName, // next in list or '*' if at end 343 renameInstrument, // in bank 344 saveInstrument, // to bank 345 deleteInstrument, // from bank 346 selectFirstInstrumentToSwap, 347 selectSecondInstrumentAndSwap, 348 lastSeenInBank, 349 350 selectBank = 16, // in root, by ID or read ID + name 351 renameBank, // or read just the name 352 createBank, 353 deleteBank, // not yet - currently 'remove' at top level 354 findBankSize, 355 selectFirstBankToSwap, 356 selectSecondBankAndSwap, 357 importBank, // not yet (currently done in main) 358 exportBank, // not yet (currently done in main) 359 360 selectRoot = 32, // by ID - also reads the current one 361 changeRootId, // change ID of current root 362 addNamedRoot, // link or create if not already there 363 deselectRoot, // remove reference, but don't touch contents 364 installBanks, 365 refreshDefaults 366 }; 367 } 368 369 namespace VECTOR // usage VECTOR::control::name 370 { 371 enum control : unsigned char { 372 undefined = 0, 373 name = 8, 374 Xcontroller = 16, 375 XleftInstrument, 376 XrightInstrument, 377 Xfeature0, // volume 378 Xfeature1, // default panning 379 Xfeature2, // default filter cutoff 380 Xfeature3, // default modulation 381 Ycontroller = 32, 382 YupInstrument, 383 YdownInstrument, 384 Yfeature0, // volume 385 Yfeature1, // default panning 386 Yfeature2, // default filter cutoff 387 Yfeature3, // default modulation 388 erase = 96 389 }; 390 } 391 392 namespace COPYPASTE // usage COPYPASTE::control::toClipboard 393 { 394 enum control : unsigned char { 395 toClipboard = 0, 396 toFile, 397 fromClipboard, 398 fromFile 399 }; 400 } 401 402 namespace MIDILEARN // usage MIDILEARN::control::block 403 { 404 enum control : unsigned char { 405 block = 0, 406 limit, 407 mute, 408 nrpn, // auto 409 sevenBit, 410 minimum, 411 maximum, 412 ignoreMove, 413 deleteLine, 414 nrpnDetected, 415 showGUI = 14, 416 hideGUI, 417 CCorChannel = 16, // should probably split these 418 findSize = 20, // not used yet 419 sendLearnMessage, // currently GUI only 420 sendRefreshRequest, // currently GUI only 421 reportActivity = 24, 422 clearAll = 96, 423 loadList = 241, 424 loadFromRecent, 425 saveList = 245, 426 cancelLearn = 250, 427 learned 428 }; 429 } 430 431 namespace MIDI // usage MIDI::control::noteOn 432 { 433 enum control : unsigned char { 434 noteOn = 0, 435 noteOff, 436 controller, 437 instrument = 7, 438 bankChange = 8 439 }; 440 // the following are actual MIDI numbers 441 // not to be confused with part controls! 442 enum CC : unsigned short int { 443 bankSelectMSB = 0, 444 modulation, 445 breath, 446 dataMSB = 6, 447 volume, 448 panning = 10, 449 expression, 450 bankSelectLSB = 32, 451 dataLSB = 38, 452 sustain = 64, 453 portamento, 454 legato = 68, 455 filterQ = 71, 456 filterCutoff = 74, 457 bandwidth, 458 fmamp, 459 resonanceCenter, 460 resonanceBandwidth, 461 dataINC = 96, 462 dataDEC, 463 nrpnLSB, 464 nrpnMSB, 465 allSoundOff = 120, 466 resetAllControllers, 467 allNotesOff = 123, 468 469 pitchWheelInner = 128, 470 channelPressureInner, 471 keyPressureInner, 472 soloType, 473 soloCC, 474 475 pitchWheel = 640, 476 channelPressure, 477 keyPressure, 478 479 programchange = 999, 480 481 maxNRPN = 0x7fff, 482 identNRPN = 0x8000, 483 null 484 }; 485 486 enum SoloType : unsigned char { 487 Disabled = 0, 488 Row, 489 Column, 490 Loop, 491 TwoWay, 492 Channel 493 }; 494 } 495 496 namespace SCALES // usage SCALES::control::refFrequency 497 { 498 enum control : unsigned char { 499 enableMicrotonal = 0, 500 refFrequency, 501 refNote, 502 invertScale, 503 invertedScaleCenter, 504 scaleShift, 505 enableKeyboardMap = 16, 506 lowKey, 507 middleKey, 508 highKey, 509 tuning = 32, 510 clearAll, 511 retune, // GUI only 512 // all the above directly alter the tuning. retune must be the last 513 514 keyboardMap, 515 importScl = 48, 516 importKbm, 517 exportScl, // not yet 518 exportKbm, // not yet 519 name = 64, 520 comment 521 }; 522 } 523 524 namespace MAIN // usage MAIN::control::volume 525 { 526 enum control : unsigned char { 527 mono = 0, 528 volume, 529 partNumber = 14, 530 availableParts, 531 panLawType, 532 detune = 32, 533 keyShift = 35, 534 reseed = 40, 535 soloType = 48, 536 soloCC, 537 538 exportBank = 60, // some of these should be in 'bank' 539 importBank, 540 deleteBank, 541 542 loadInstrumentFromBank = 76, 543 loadInstrumentByName, 544 saveNamedInstrument, 545 loadNamedPatchset, 546 saveNamedPatchset, 547 loadNamedVector = 84, 548 saveNamedVector, 549 loadNamedScale = 88, 550 saveNamedScale, 551 loadNamedState = 92, 552 saveNamedState, 553 readLastSeen, 554 loadFileFromList, 555 defaultPart, 556 exportPadSynthSamples, 557 masterReset, 558 masterResetAndMlearn, 559 openManual = 100, 560 startInstance = 104, 561 stopInstance, 562 stopSound = 128, 563 readPartPeak = 200, // now does L/R 564 readMainLRpeak, 565 readMainLRrms 566 }; 567 568 enum panningType : unsigned char { 569 cut = 0, 570 normal, 571 boost 572 }; 573 574 } 575 576 namespace PART // usage PART::control::volume 577 { 578 enum control : unsigned char { 579 enable = 0, 580 enableAdd, 581 enableSub, 582 enablePad, 583 enableKitLine, 584 volume, 585 velocitySense, 586 panning, 587 velocityOffset, 588 midiChannel, 589 keyMode, 590 channelATset, 591 keyATset, 592 portamento, 593 kitItemMute, 594 minNote, 595 maxNote, 596 minToLastKey, 597 maxToLastKey, 598 resetMinMaxKey, 599 kitEffectNum = 24, 600 maxNotes = 33, 601 keyShift = 35, 602 partToSystemEffect1 = 40, 603 partToSystemEffect2, 604 partToSystemEffect3, 605 partToSystemEffect4, 606 humanise = 48, 607 humanvelocity, 608 drumMode = 57, 609 kitMode, 610 effectNumber = 64, 611 effectType, 612 effectDestination, 613 effectBypass, 614 padsynthParameters = 104, 615 audioDestination = 120, 616 617 // start of controllers 618 volumeRange = 128, 619 volumeEnable, 620 panningWidth, 621 modWheelDepth, 622 exponentialModWheel, 623 bandwidthDepth, 624 exponentialBandwidth, 625 expressionEnable, 626 FMamplitudeEnable, 627 sustainPedalEnable, 628 pitchWheelRange, 629 filterQdepth, 630 filterCutoffDepth, 631 breathControlEnable, 632 resonanceCenterFrequencyDepth = 144, 633 resonanceBandwidthDepth, 634 portamentoTime = 160, 635 portamentoTimeStretch, 636 portamentoThreshold, 637 portamentoThresholdType, 638 enableProportionalPortamento, 639 proportionalPortamentoRate, 640 proportionalPortamentoDepth, 641 receivePortamento = 168, 642 // end of controllers 643 644 // start of midi controls 645 midiModWheel = 192, 646 midiBreath, 647 midiExpression, 648 midiSustain, 649 midiPortamento, 650 midiFilterQ, 651 midiFilterCutoff, 652 midiBandwidth, 653 midiFMamp, 654 midiResonanceCenter, 655 midiResonanceBandwidth, 656 // end of midi controls 657 658 instrumentCopyright = 220, 659 instrumentComments, 660 instrumentName, 661 instrumentType, 662 defaultInstrumentCopyright, // this needs to be split into two for load/save 663 resetAllControllers, // this needs to bump up 1 to make space 664 partBusy = 252 // internally generated - read only 665 }; 666 667 enum kitType : unsigned char { 668 Off = 0, 669 Multi, 670 Single, 671 CrossFade 672 }; 673 674 enum engine : unsigned char { 675 addSynth = 0, 676 subSynth, 677 padSynth, 678 679 // addVoice and addMod must be consecutive 680 addVoice1 = 128, 681 addVoice2, 682 addVoice3, 683 addVoice4, 684 addVoice5, 685 addVoice6, 686 addVoice7, 687 addVoice8, 688 addMod1 = 192, 689 addMod2, 690 addMod3, 691 addMod4, 692 addMod5, 693 addMod6, 694 addMod7, 695 addMod8 696 }; 697 698 namespace aftertouchType { 699 enum { // all powers of 2 handled bit-wise 700 off = 0, 701 filterCutoff, 702 filterCutoffDown, 703 filterQ = 4, 704 filterQdown = 8, 705 pitchBend = 16, 706 pitchBendDown = 32, 707 volume = 64, 708 modulation = 128 // this MUST be the highest bit 709 }; 710 } 711 712 namespace envelope 713 { 714 enum groupmode : int { 715 amplitudeLin = 1, 716 amplitudeLog, 717 frequency, 718 filter, 719 bandwidth 720 }; 721 } 722 } 723 724 namespace ADDSYNTH // usage ADDSYNTH::control::volume 725 { 726 enum control : unsigned char { 727 volume = 0, 728 velocitySense, 729 panning, 730 enableRandomPan, 731 randomWidth, 732 733 detuneFrequency = 32, 734 octave = 35, 735 detuneType, // L35 cents, L10 cents, E100 cents, E1200 cents 736 coarseDetune, 737 relativeBandwidth = 39, 738 739 stereo = 112, 740 randomGroup, 741 742 dePop = 120, 743 punchStrength, 744 punchDuration, 745 punchStretch, 746 punchVelocity 747 }; 748 } 749 750 namespace ADDVOICE // usage ADDVOICE::control::volume 751 { 752 enum control : unsigned char { 753 enableVoice = 0, 754 volume, 755 velocitySense, 756 panning, 757 enableRandomPan, 758 randomWidth, 759 invertPhase, 760 enableAmplitudeEnvelope, 761 enableAmplitudeLFO, 762 763 modulatorType = 16, // Off, Morph, Ring, PM, FM, PWM 764 externalModulator, // -1 local, 'n' voice 765 766 detuneFrequency = 32, 767 equalTemperVariation, 768 baseFrequencyAs440Hz, 769 octave, 770 detuneType, // Default, L35 cents, L10 cents, E100 cents, E1200 cents 771 coarseDetune, 772 pitchBendAdjustment, 773 pitchBendOffset, 774 775 enableFrequencyEnvelope = 40, 776 enableFrequencyLFO, 777 778 unisonFrequencySpread = 48, 779 unisonPhaseRandomise, 780 unisonStereoSpread, 781 unisonVibratoDepth, 782 unisonVibratoSpeed, 783 unisonSize, 784 unisonPhaseInvert, // None, Random, 50%, 33%, 25%, 20% 785 enableUnison = 56, 786 787 bypassGlobalFilter = 64, // TODO not seen on return? 788 enableFilter = 68, 789 enableFilterEnvelope = 72, 790 enableFilterLFO, 791 792 modulatorAmplitude = 80, 793 modulatorVelocitySense, 794 modulatorHFdamping, 795 enableModulatorAmplitudeEnvelope = 88, 796 modulatorDetuneFrequency = 96, 797 modulatorDetuneFromBaseOsc, 798 modulatorFrequencyAs440Hz, 799 modulatorOctave, 800 modulatorDetuneType, // Default, L35 cents, L10 cents, E100 cents, E1200 cents 801 modulatorCoarseDetune, 802 enableModulatorFrequencyEnvelope = 104, 803 modulatorOscillatorPhase = 112, 804 modulatorOscillatorSource, // -1 internal, 'n' external modulator 805 806 delay = 128, 807 enableResonance = 130, // for this voice 808 voiceOscillatorPhase = 132, 809 externalOscillator, // -1 local, 'n' voice 810 voiceOscillatorSource, // - 1 internal, 'n' external voice 811 soundType // Oscillator, White noise, Pink noise, Spot noise 812 }; 813 } 814 815 namespace SUBSYNTH // usage SUBSYNTH::control::volume 816 { 817 enum control : unsigned char { 818 volume = 0, 819 velocitySense, 820 panning, 821 enableRandomPan, 822 randomWidth, 823 824 bandwidth = 16, 825 bandwidthScale, 826 enableBandwidthEnvelope, 827 828 detuneFrequency = 32, 829 equalTemperVariation, 830 baseFrequencyAs440Hz, 831 octave, 832 detuneType, // L35 cents, L10 cents, E100 cents, E1200 cents 833 coarseDetune, 834 pitchBendAdjustment, 835 pitchBendOffset, 836 837 enableFrequencyEnvelope = 40, 838 839 overtoneParameter1 = 48, 840 overtoneParameter2, 841 overtoneForceHarmonics, 842 overtonePosition, // Harmonic, ShiftU, ShiftL, PowerU, PowerL, Sine, Power, Shift 843 844 enableFilter = 64, 845 filterStages = 80, 846 magType, // Linear, -40dB, -60dB, -80dB, -100dB 847 startPosition, // Zero, Random, Maximum 848 clearHarmonics = 96, 849 stereo = 112 850 }; 851 } 852 853 namespace PADSYNTH // usage PADSYNTH::control::volume 854 { 855 enum control : unsigned char { 856 volume = 0, 857 velocitySense, 858 panning, 859 enableRandomPan, 860 randomWidth, 861 862 detuneFrequency = 32, 863 equalTemperVariation, 864 baseFrequencyAs440Hz, 865 octave, 866 detuneType, // L35 cents, L10 cents, E100 cents, E1200 cents 867 coarseDetune, 868 pitchBendAdjustment, 869 pitchBendOffset, 870 871 bandwidth,// = 16, moved these three 872 bandwidthScale, 873 spectrumMode,// = 19, // Bandwidth, Discrete, Continuous 874 875 overtoneParameter1 = 48, 876 overtoneParameter2, 877 overtoneForceHarmonics, 878 overtonePosition, // Harmonic, ShiftU, ShiftL, PowerU, PowerL, Sine, Power, Shift 879 880 baseWidth = 64, 881 frequencyMultiplier, 882 modulatorStretch, 883 modulatorFrequency, 884 size, 885 baseType, // Gauss, Square, Double Exponential 886 harmonicSidebands, // Full, Upper half, Lower half 887 spectralWidth, 888 spectralAmplitude, 889 amplitudeMultiplier, // Off, Gauss, Sine, Flat 890 amplitudeMode, // Sum, Multiply, Divide 1, Divide 2 891 autoscale, 892 893 harmonicBase = 80, // C-2, G-2, C-3, G-3, C-4, G-4, C-5, G-5, G-6 894 samplesPerOctave, // 0.5, 1, 2, 3, 4, 6, 12 895 numberOfOctaves, // 1 - 8 896 sampleSize, // 16k, 32k, 64k, 128k, 256k, 512k, 1M 897 applyChanges = 104, 898 stereo = 112, 899 900 dePop = 120, 901 punchStrength, 902 punchDuration, 903 punchStretch, 904 punchVelocity 905 }; 906 } 907 908 namespace OSCILLATOR // usage OSCILLATOR::control::phaseRandomness 909 { 910 enum control : unsigned char { 911 phaseRandomness = 0, 912 magType, // Linear, -40dB, -60dB, -80dB, -100dB 913 harmonicAmplitudeRandomness, 914 harmonicRandomnessType, // None, Power, Sine 915 916 baseFunctionParameter = 16, 917 baseFunctionType, // Sine, Triangle, Pulse, Saw, Power, Gauss, Diode, AbsSine, 918 // PulseSine, StrchSine, Chirp, AbsStrSine, Chebyshev, Sqr, Spike, Circle 919 baseModulationParameter1 = 18, 920 baseModulationParameter2, 921 baseModulationParameter3, 922 baseModulationType, // None, Rev, Sine, Pow 923 924 autoClear = 32, // not used 925 useAsBaseFunction, // if 'value' is 1 assume autoclear set 926 waveshapeParameter, 927 waveshapeType, // None, Atan, Asym1, Pow, Sine Qnts, Zigzag, Lmt, LmtU, LmtL, Ilmt, Clip, Asym2, Pow2, Sgm 928 filterParameter1, 929 filterParameter2, 930 filterBeforeWaveshape, 931 filterType, // None, LP, HP1a, HP1b, BP1, BS1, LP2, HP2, BP2, BS2, Cos, Sin, Lsh, Sgm 932 modulationParameter1, 933 modulationParameter2, 934 modulationParameter3, 935 modulationType, // None, Rev, Sine, Pow 936 spectrumAdjustParameter, 937 spectrumAdjustType, // None, Pow, ThrsD, ThrsU 938 939 harmonicShift = 64, 940 clearHarmonicShift, 941 shiftBeforeWaveshapeAndFilter, 942 adaptiveHarmonicsParameter, 943 adaptiveHarmonicsBase, 944 adaptiveHarmonicsPower, 945 adaptiveHarmonicsType, // Off, On, Square, 2xSub, 2xAdd, 3xSub, 3xAdd, 4xSub, 4xAdd 946 947 clearHarmonics = 96, 948 convertToSine 949 }; 950 enum wave : unsigned char { 951 sine = 0, 952 triangle, 953 pulse, 954 saw, 955 power, 956 gauss, 957 diode, 958 absSine, 959 pulseSine, 960 stretchSine, 961 chirp, 962 absStretchSine, 963 chebyshev, 964 square, 965 spike, 966 circle, 967 hyperSec, 968 user 969 }; 970 } 971 972 namespace RESONANCE // usage RESONANCE::control::maxDb 973 { 974 enum control : unsigned char { 975 enableResonance = 0, 976 maxDb, 977 centerFrequency, 978 octaves, 979 980 randomType = 10, // coarse, medium, fine 981 interpolatePeaks = 20, // smooth, linear 982 protectFundamental, 983 clearGraph = 96, 984 smoothGraph, 985 graphPoint 986 }; 987 } 988 989 namespace LFOINSERT // usage LFOINSERT::control::speed 990 { 991 enum control : unsigned char { 992 speed = 0, 993 depth, 994 delay, 995 start, 996 amplitudeRandomness, 997 type, // Sine, Tri, Sqr, R.up, R.dn, E1dn, E2dn 998 continuous, 999 bpm, 1000 frequencyRandomness, 1001 stretch 1002 }; 1003 } 1004 1005 namespace FILTERINSERT // usage FILTERINSERT::control::centerFrequency 1006 { 1007 enum control : unsigned char { 1008 centerFrequency = 0, 1009 Q, 1010 frequencyTracking, 1011 velocitySensitivity, 1012 velocityCurve, 1013 gain, 1014 stages, // x1, x2, x3, x4, x5 1015 baseType, // analog, formant, state variable 1016 analogType, // LPF1, HPF1, LPF2, HPF2, BPF2, NF2, PkF2, LSh2, HSh2 1017 stateVariableType, // LPF, HPF, BPF, NF 1018 frequencyTrackingRange, 1019 formantSlowness = 16, 1020 formantClearness, 1021 formantFrequency, 1022 formantQ, 1023 formantAmplitude, 1024 formantStretch, 1025 formantCenter, 1026 formantOctave, 1027 numberOfFormants = 32, 1028 vowelNumber, // local to GUI 1029 formantNumber, // local to GUI 1030 sequenceSize, 1031 sequencePosition, // local to GUI 1032 vowelPositionInSequence, 1033 negateInput, // bypass LFOs, envelopes etc. 1034 }; 1035 } 1036 1037 namespace ENVELOPEINSERT // usage ENVELOPEINSERT::control::attackLevel 1038 { 1039 enum control : unsigned char { 1040 attackLevel = 0, 1041 attackTime, 1042 decayLevel, 1043 decayTime, 1044 sustainLevel, 1045 releaseTime, 1046 releaseLevel, 1047 stretch, 1048 forcedRelease = 16, 1049 linearEnvelope, 1050 edit = 24, // local to GUI 1051 1052 enableFreeMode = 32, 1053 points = 34, // local to GUI 1054 sustainPoint 1055 }; 1056 } 1057 1058 namespace EFFECT // usage EFFECT::type::none 1059 { 1060 enum type : unsigned char { 1061 none = 128, // must be higher than normal kits 1062 reverb, 1063 echo, 1064 chorus, 1065 phaser, 1066 alienWah, 1067 distortion, 1068 eq, 1069 dynFilter, 1070 count // this must be the last item! 1071 }; 1072 1073 enum control : unsigned char { 1074 level = 0, // volume, wet/dry, gain for EQ 1075 panning, // band for EQ 1076 frequency, // time reverb, delay echo, L/R-mix dist, Not EQ 1077 preset = 16, // not EQ 1078 bpm, 1079 bpmStart, 1080 changed = 129 // not EQ 1081 }; 1082 1083 enum sysIns : unsigned char { 1084 toEffect1 = 1, // system only 1085 toEffect2, // system only 1086 toEffect3, // system only 1087 effectNumber, 1088 effectType, 1089 effectDestination, // insert only 1090 effectEnable // system only 1091 }; 1092 } 1093 1094 /* 1095 * it is ESSENTIAL that the size is a power of 2 1096 */ 1097 union CommandBlock{ 1098 struct{ 1099 float value; 1100 unsigned char type; 1101 unsigned char source; 1102 unsigned char control; 1103 unsigned char part; 1104 unsigned char kit; 1105 unsigned char engine; 1106 unsigned char insert; 1107 unsigned char parameter; 1108 unsigned char offset; 1109 unsigned char miscmsg; 1110 unsigned char spare1; 1111 unsigned char spare0; 1112 } data; 1113 char bytes [sizeof(data)]; 1114 }; 1115 1116 #endif 1117