diff options
Diffstat (limited to 'backends/midi/mt32/structures.h')
-rw-r--r-- | backends/midi/mt32/structures.h | 179 |
1 files changed, 82 insertions, 97 deletions
diff --git a/backends/midi/mt32/structures.h b/backends/midi/mt32/structures.h index d64f0a44f2..047f69f8bd 100644 --- a/backends/midi/mt32/structures.h +++ b/backends/midi/mt32/structures.h @@ -56,92 +56,92 @@ typedef signed char Bit8s; struct TimbreParam { struct commonParam { char name[10]; - char pstruct12; // 1&2 0-12 (1-13) - char pstruct34; // #3&4 0-12 (1-13) - char pmute; // 0-15 (0000-1111) - char nosustain; // 0-1(Normal, No sustain) + Bit8u pstruct12; // 1&2 0-12 (1-13) + Bit8u pstruct34; // #3&4 0-12 (1-13) + Bit8u pmute; // 0-15 (0000-1111) + Bit8u nosustain; // 0-1(Normal, No sustain) } MT32EMU_ALIGN_PACKED common; struct partialParam { struct wgParam { - char coarse; // 0-96 (C1,C#1-C9) - char fine; // 0-100 (-50 to +50 (cents?)) - char keyfollow; // 0-16 (-1,-1/2,0,1,1/8,1/4,3/8,1/2,5/8,3/4,7/8,1,5/4,3/2,2.s1,s2) - char bender; // 0,1 (ON/OFF) - char waveform; // 0-1 (SQU/SAW) - char pcmwave; // 0-127 (1-128) - char pulsewid; // 0-100 - char pwvelo; // 0-14 (-7 - +7) + Bit8u coarse; // 0-96 (C1,C#1-C9) + Bit8u fine; // 0-100 (-50 to +50 (cents?)) + Bit8u keyfollow; // 0-16 (-1,-1/2,0,1,1/8,1/4,3/8,1/2,5/8,3/4,7/8,1,5/4,3/2,2.s1,s2) + Bit8u bender; // 0,1 (ON/OFF) + Bit8u waveform; // 0-1 (SQU/SAW) + Bit8u pcmwave; // 0-127 (1-128) + Bit8u pulsewid; // 0-100 + Bit8u pwvelo; // 0-14 (-7 - +7) } MT32EMU_ALIGN_PACKED wg; struct envParam { - char depth; // 0-10 - char sensitivity; // 1-100 - char timekeyfollow; // 0-4 - char time[4]; // 1-100 - char level[5]; // 1-100 (-50 - +50) + Bit8u depth; // 0-10 + Bit8u sensitivity; // 1-100 + Bit8u timekeyfollow; // 0-4 + Bit8u time[4]; // 1-100 + Bit8u level[5]; // 1-100 (-50 - +50) } MT32EMU_ALIGN_PACKED env; struct lfoParam { - char rate; // 0-100 - char depth; // 0-100 - char modsense; // 0-100 + Bit8u rate; // 0-100 + Bit8u depth; // 0-100 + Bit8u modsense; // 0-100 } MT32EMU_ALIGN_PACKED lfo; struct tvfParam { - char cutoff; // 0-100 - char resonance; // 0-30 - char keyfollow; // 0-16 (-1,-1/2,1/4,0,1,1/8,1/4,3/8,1/2,5/8,3/2,7/8,1,5/4,3/2,2,s1,s2) - char biaspoint; // 0-127 (<1A-<7C >1A-7C) - char biaslevel; // 0-14 (-7 - +7) - char envdepth; // 0-100 - char envsense; // 0-100 - char envdkf; // DEPTH KEY FOLL0W 0-4 - char envtkf; // TIME KEY FOLLOW 0-4 - char envtime[5]; // 1-100 - char envlevel[4]; // 1-100 + Bit8u cutoff; // 0-100 + Bit8u resonance; // 0-30 + Bit8u keyfollow; // 0-16 (-1,-1/2,1/4,0,1,1/8,1/4,3/8,1/2,5/8,3/2,7/8,1,5/4,3/2,2,s1,s2) + Bit8u biaspoint; // 0-127 (<1A-<7C >1A-7C) + Bit8u biaslevel; // 0-14 (-7 - +7) + Bit8u envdepth; // 0-100 + Bit8u envsense; // 0-100 + Bit8u envdkf; // DEPTH KEY FOLL0W 0-4 + Bit8u envtkf; // TIME KEY FOLLOW 0-4 + Bit8u envtime[5]; // 1-100 + Bit8u envlevel[4]; // 1-100 } MT32EMU_ALIGN_PACKED tvf; struct tvaParam { - char level; // 0-100 - char velosens; // 0-100 - char biaspoint1; // 0-127 (<1A-<7C >1A-7C) - char biaslevel1; // 0-12 (-12 - 0) - char biaspoint2; // 0-127 (<1A-<7C >1A-7C) - char biaslevel2; // 0-12 (-12 - 0) - char envtkf; // TIME KEY FOLLOW 0-4 - char envvkf; // VELOS KEY FOLL0W 0-4 - char envtime[5]; // 1-100 - char envlevel[4]; // 1-100 + Bit8u level; // 0-100 + Bit8u velosens; // 0-100 + Bit8u biaspoint1; // 0-127 (<1A-<7C >1A-7C) + Bit8u biaslevel1; // 0-12 (-12 - 0) + Bit8u biaspoint2; // 0-127 (<1A-<7C >1A-7C) + Bit8u biaslevel2; // 0-12 (-12 - 0) + Bit8u envtkf; // TIME KEY FOLLOW 0-4 + Bit8u envvkf; // VELOS KEY FOLL0W 0-4 + Bit8u envtime[5]; // 1-100 + Bit8u envlevel[4]; // 1-100 } MT32EMU_ALIGN_PACKED tva; } MT32EMU_ALIGN_PACKED partial[4]; } MT32EMU_ALIGN_PACKED; struct PatchParam { - char timbreGroup; // TIMBRE GROUP 0-3 (group A, group B, Memory, Rhythm) - char timbreNum; // TIMBRE NUMBER 0-63 - char keyShift; // KEY SHIFT 0-48 (-24 - +24 semitones) - char fineTune; // FINE TUNE 0-100 (-50 - +50 cents) - char benderRange; // BENDER RANGE 0-24 - char assignMode; // ASSIGN MODE 0-3 (POLY1, POLY2, POLY3, POLY4) - char reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON) - char dummy; // (DUMMY) + Bit8u timbreGroup; // TIMBRE GROUP 0-3 (group A, group B, Memory, Rhythm) + Bit8u timbreNum; // TIMBRE NUMBER 0-63 + Bit8u keyShift; // KEY SHIFT 0-48 (-24 - +24 semitones) + Bit8u fineTune; // FINE TUNE 0-100 (-50 - +50 cents) + Bit8u benderRange; // BENDER RANGE 0-24 + Bit8u assignMode; // ASSIGN MODE 0-3 (POLY1, POLY2, POLY3, POLY4) + Bit8u reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON) + Bit8u dummy; // (DUMMY) } MT32EMU_ALIGN_PACKED; struct MemParams { struct PatchTemp { PatchParam patch; - char outlevel; // OUTPUT LEVEL 0-100 - char panpot; // PANPOT 0-14 (R-L) - char dummyv[6]; + Bit8u outlevel; // OUTPUT LEVEL 0-100 + Bit8u panpot; // PANPOT 0-14 (R-L) + Bit8u dummyv[6]; } MT32EMU_ALIGN_PACKED patchSettings[8]; struct RhythmTemp { - char timbre; // TIMBRE 0-94 (M1-M64,R1-30,OFF) - char outlevel; // OUTPUT LEVEL 0-100 - char panpot; // PANPOT 0-14 (R-L) - char reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON) - } MT32EMU_ALIGN_PACKED rhythmSettings[64]; + Bit8u timbre; // TIMBRE 0-94 (M1-M64,R1-30,OFF) + Bit8u outlevel; // OUTPUT LEVEL 0-100 + Bit8u panpot; // PANPOT 0-14 (R-L) + Bit8u reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON) + } MT32EMU_ALIGN_PACKED rhythmSettings[86]; // FIXME: Was 64, but let's support the next model... TimbreParam MT32EMU_ALIGN_PACKED timbreSettings[8]; @@ -149,58 +149,43 @@ struct MemParams { struct PaddedTimbre { TimbreParam timbre; - char padding[10]; + Bit8u padding[10]; } MT32EMU_ALIGN_PACKED timbres[64 + 64 + 64 + 30]; // Group A, Group B, Memory, Rhythm struct SystemArea { - char masterTune; // MASTER TUNE 0-127 432.1-457.6Hz - char reverbMode; // REVERB MODE 0-3 (room, hall, plate, tap delay) - char reverbTime; // REVERB TIME 0-7 (1-8) - char reverbLevel; // REVERB LEVEL 0-7 (1-8) - char reserveSettings[9]; // PARTIAL RESERVE (PART 1) 0-32 - char chanAssign[9]; // MIDI CHANNEL (PART1) 0-16 (1-16,OFF) - char masterVol; // MASTER VOLUME 0-100 + Bit8u masterTune; // MASTER TUNE 0-127 432.1-457.6Hz + Bit8u reverbMode; // REVERB MODE 0-3 (room, hall, plate, tap delay) + Bit8u reverbTime; // REVERB TIME 0-7 (1-8) + Bit8u reverbLevel; // REVERB LEVEL 0-7 (1-8) + Bit8u reserveSettings[9]; // PARTIAL RESERVE (PART 1) 0-32 + Bit8u chanAssign[9]; // MIDI CHANNEL (PART1) 0-16 (1-16,OFF) + Bit8u masterVol; // MASTER VOLUME 0-100 } MT32EMU_ALIGN_PACKED system; }; struct MemBanks { - char pTemp[8][sizeof(MemParams::PatchTemp)]; - char rTemp[64][sizeof(MemParams::RhythmTemp)]; - char tTemp[8][sizeof(TimbreParam)]; - char patchBank[128][sizeof(PatchParam)]; - char timbreBank[64 + 64 + 64 + 30][sizeof(MemParams::PaddedTimbre)]; - char systemBank[sizeof(MemParams::SystemArea)]; + Bit8u pTemp[8][sizeof(MemParams::PatchTemp)]; + Bit8u rTemp[86][sizeof(MemParams::RhythmTemp)]; + Bit8u tTemp[8][sizeof(TimbreParam)]; + Bit8u patchBank[128][sizeof(PatchParam)]; + Bit8u timbreBank[64 + 64 + 64 + 30][sizeof(MemParams::PaddedTimbre)]; + Bit8u systemBank[sizeof(MemParams::SystemArea)]; // System memory 0x100000 // Display 0x200000 // Reset 0x7F0000 }; -union MT32RAMFormat { - MemParams params; - MemBanks banks; -} MT32EMU_ALIGN_PACKED; - #if defined(_MSC_VER) || defined (__MINGW32__) #pragma pack(pop) #else #pragma pack() #endif -struct PCMWave { - char name[16]; - Bit32u addr; - Bit32u len; - bool loop; - float tune; - Bit32s ampval; -}; - struct PCMWaveEntry { Bit32u addr; Bit32u len; - Bit32u pcmnum; + double tune; bool loop; - Bit32s aggSound; // This variable is for the last 9 PCM samples, which are actually loop combinations }; struct soundaddr { @@ -221,17 +206,15 @@ struct PatchCache { char waveform; int pulsewidth; int pwsens; - int pitchshift; - int fineshift; + + float pitch; int lfodepth; int lforate; Bit32u lfoperiod; int modsense; - int keydir; - int pitchkeyfollow; - int pitchkeydir; + float pitchKeyfollow; int filtkeyfollow; @@ -264,8 +247,12 @@ struct PatchCache { int structurePair; // The following fields are actually common to all partials in the timbre + bool dirty; Bit32u partialCount; bool sustain; + float pitchShift; + bool reverb; + const StereoVolume *pansetptr; }; class Partial; // Forward reference for class defined in partial.h @@ -277,19 +264,17 @@ struct dpoly { int freqnum; int vel; - bool reverb; bool isDecay; - const Bit32s *volumeptr; - const StereoVolume *pansetptr; + const Bit32u *volumeptr; Partial *partials[4]; bool pedalhold; // This marks keys that have been released on the keyboard, but are being held by the pedal bool sustain; - bool isActive(); - Bit64s getAge(); + bool isActive() const; + Bit64s getAge() const; }; } |