696 |
_3ewa->ReadInt16(); // unknown |
_3ewa->ReadInt16(); // unknown |
697 |
EG1Sustain = _3ewa->ReadUint16(); |
EG1Sustain = _3ewa->ReadUint16(); |
698 |
EG1Release = (double) GIG_EXP_DECODE(_3ewa->ReadInt32()); |
EG1Release = (double) GIG_EXP_DECODE(_3ewa->ReadInt32()); |
699 |
EG1Controller = static_cast<eg1_ctrl_t>(_3ewa->ReadUint8()); |
EG1Controller = DecodeLeverageController(static_cast<_lev_ctrl_t>(_3ewa->ReadUint8())); |
700 |
uint8_t eg1ctrloptions = _3ewa->ReadUint8(); |
uint8_t eg1ctrloptions = _3ewa->ReadUint8(); |
701 |
EG1ControllerInvert = eg1ctrloptions & 0x01; |
EG1ControllerInvert = eg1ctrloptions & 0x01; |
702 |
EG1ControllerAttackInfluence = GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(eg1ctrloptions); |
EG1ControllerAttackInfluence = GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(eg1ctrloptions); |
703 |
EG1ControllerDecayInfluence = GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(eg1ctrloptions); |
EG1ControllerDecayInfluence = GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(eg1ctrloptions); |
704 |
EG1ControllerReleaseInfluence = GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(eg1ctrloptions); |
EG1ControllerReleaseInfluence = GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(eg1ctrloptions); |
705 |
EG2Controller = static_cast<eg2_ctrl_t>(_3ewa->ReadUint8()); |
EG2Controller = DecodeLeverageController(static_cast<_lev_ctrl_t>(_3ewa->ReadUint8())); |
706 |
uint8_t eg2ctrloptions = _3ewa->ReadUint8(); |
uint8_t eg2ctrloptions = _3ewa->ReadUint8(); |
707 |
EG2ControllerInvert = eg2ctrloptions & 0x01; |
EG2ControllerInvert = eg2ctrloptions & 0x01; |
708 |
EG2ControllerAttackInfluence = GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(eg2ctrloptions); |
EG2ControllerAttackInfluence = GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(eg2ctrloptions); |
764 |
ReleaseVelocityResponseDepth = 0; |
ReleaseVelocityResponseDepth = 0; |
765 |
} |
} |
766 |
VelocityResponseCurveScaling = _3ewa->ReadUint8(); |
VelocityResponseCurveScaling = _3ewa->ReadUint8(); |
767 |
AttenuationControlTreshold = _3ewa->ReadInt8(); |
AttenuationControllerThreshold = _3ewa->ReadInt8(); |
768 |
_3ewa->ReadInt32(); // unknown |
_3ewa->ReadInt32(); // unknown |
769 |
SampleStartOffset = (uint16_t) _3ewa->ReadInt16(); |
SampleStartOffset = (uint16_t) _3ewa->ReadInt16(); |
770 |
_3ewa->ReadInt16(); // unknown |
_3ewa->ReadInt16(); // unknown |
780 |
uint8_t lfo3ctrl = _3ewa->ReadUint8(); |
uint8_t lfo3ctrl = _3ewa->ReadUint8(); |
781 |
LFO3Controller = static_cast<lfo3_ctrl_t>(lfo3ctrl & 0x07); // lower 3 bits |
LFO3Controller = static_cast<lfo3_ctrl_t>(lfo3ctrl & 0x07); // lower 3 bits |
782 |
LFO3Sync = lfo3ctrl & 0x20; // bit 5 |
LFO3Sync = lfo3ctrl & 0x20; // bit 5 |
783 |
InvertAttenuationControl = lfo3ctrl & 0x80; // bit 7 |
InvertAttenuationController = lfo3ctrl & 0x80; // bit 7 |
784 |
if (VCFType == vcf_type_lowpass) { |
if (VCFType == vcf_type_lowpass) { |
785 |
if (lfo3ctrl & 0x40) // bit 6 |
if (lfo3ctrl & 0x40) // bit 6 |
786 |
VCFType = vcf_type_lowpassturbo; |
VCFType = vcf_type_lowpassturbo; |
787 |
} |
} |
788 |
AttenuationControl = static_cast<attenuation_ctrl_t>(_3ewa->ReadUint8()); |
AttenuationController = DecodeLeverageController(static_cast<_lev_ctrl_t>(_3ewa->ReadUint8())); |
789 |
uint8_t lfo2ctrl = _3ewa->ReadUint8(); |
uint8_t lfo2ctrl = _3ewa->ReadUint8(); |
790 |
LFO2Controller = static_cast<lfo2_ctrl_t>(lfo2ctrl & 0x07); // lower 3 bits |
LFO2Controller = static_cast<lfo2_ctrl_t>(lfo2ctrl & 0x07); // lower 3 bits |
791 |
LFO2FlipPhase = lfo2ctrl & 0x80; // bit 7 |
LFO2FlipPhase = lfo2ctrl & 0x80; // bit 7 |
869 |
(*pVelocityTables)[tableKey] = pVelocityAttenuationTable; // put the new table into the tables map |
(*pVelocityTables)[tableKey] = pVelocityAttenuationTable; // put the new table into the tables map |
870 |
} |
} |
871 |
} |
} |
872 |
|
|
873 |
|
leverage_ctrl_t DimensionRegion::DecodeLeverageController(_lev_ctrl_t EncodedController) { |
874 |
|
leverage_ctrl_t decodedcontroller; |
875 |
|
switch (EncodedController) { |
876 |
|
// special controller |
877 |
|
case _lev_ctrl_none: |
878 |
|
decodedcontroller.type = leverage_ctrl_t::type_none; |
879 |
|
decodedcontroller.controller_number = 0; |
880 |
|
break; |
881 |
|
case _lev_ctrl_velocity: |
882 |
|
decodedcontroller.type = leverage_ctrl_t::type_velocity; |
883 |
|
decodedcontroller.controller_number = 0; |
884 |
|
break; |
885 |
|
case _lev_ctrl_channelaftertouch: |
886 |
|
decodedcontroller.type = leverage_ctrl_t::type_channelaftertouch; |
887 |
|
decodedcontroller.controller_number = 0; |
888 |
|
break; |
889 |
|
|
890 |
|
// ordinary MIDI control change controller |
891 |
|
case _lev_ctrl_modwheel: |
892 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
893 |
|
decodedcontroller.controller_number = 1; |
894 |
|
break; |
895 |
|
case _lev_ctrl_breath: |
896 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
897 |
|
decodedcontroller.controller_number = 2; |
898 |
|
break; |
899 |
|
case _lev_ctrl_foot: |
900 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
901 |
|
decodedcontroller.controller_number = 4; |
902 |
|
break; |
903 |
|
case _lev_ctrl_effect1: |
904 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
905 |
|
decodedcontroller.controller_number = 12; |
906 |
|
break; |
907 |
|
case _lev_ctrl_effect2: |
908 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
909 |
|
decodedcontroller.controller_number = 13; |
910 |
|
break; |
911 |
|
case _lev_ctrl_genpurpose1: |
912 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
913 |
|
decodedcontroller.controller_number = 16; |
914 |
|
break; |
915 |
|
case _lev_ctrl_genpurpose2: |
916 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
917 |
|
decodedcontroller.controller_number = 17; |
918 |
|
break; |
919 |
|
case _lev_ctrl_genpurpose3: |
920 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
921 |
|
decodedcontroller.controller_number = 18; |
922 |
|
break; |
923 |
|
case _lev_ctrl_genpurpose4: |
924 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
925 |
|
decodedcontroller.controller_number = 19; |
926 |
|
break; |
927 |
|
case _lev_ctrl_portamentotime: |
928 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
929 |
|
decodedcontroller.controller_number = 5; |
930 |
|
break; |
931 |
|
case _lev_ctrl_sustainpedal: |
932 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
933 |
|
decodedcontroller.controller_number = 64; |
934 |
|
break; |
935 |
|
case _lev_ctrl_portamento: |
936 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
937 |
|
decodedcontroller.controller_number = 65; |
938 |
|
break; |
939 |
|
case _lev_ctrl_sostenutopedal: |
940 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
941 |
|
decodedcontroller.controller_number = 66; |
942 |
|
break; |
943 |
|
case _lev_ctrl_softpedal: |
944 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
945 |
|
decodedcontroller.controller_number = 67; |
946 |
|
break; |
947 |
|
case _lev_ctrl_genpurpose5: |
948 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
949 |
|
decodedcontroller.controller_number = 80; |
950 |
|
break; |
951 |
|
case _lev_ctrl_genpurpose6: |
952 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
953 |
|
decodedcontroller.controller_number = 81; |
954 |
|
break; |
955 |
|
case _lev_ctrl_genpurpose7: |
956 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
957 |
|
decodedcontroller.controller_number = 82; |
958 |
|
break; |
959 |
|
case _lev_ctrl_genpurpose8: |
960 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
961 |
|
decodedcontroller.controller_number = 83; |
962 |
|
break; |
963 |
|
case _lev_ctrl_effect1depth: |
964 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
965 |
|
decodedcontroller.controller_number = 91; |
966 |
|
break; |
967 |
|
case _lev_ctrl_effect2depth: |
968 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
969 |
|
decodedcontroller.controller_number = 92; |
970 |
|
break; |
971 |
|
case _lev_ctrl_effect3depth: |
972 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
973 |
|
decodedcontroller.controller_number = 93; |
974 |
|
break; |
975 |
|
case _lev_ctrl_effect4depth: |
976 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
977 |
|
decodedcontroller.controller_number = 94; |
978 |
|
break; |
979 |
|
case _lev_ctrl_effect5depth: |
980 |
|
decodedcontroller.type = leverage_ctrl_t::type_controlchange; |
981 |
|
decodedcontroller.controller_number = 95; |
982 |
|
break; |
983 |
|
|
984 |
|
// unknown controller type |
985 |
|
default: |
986 |
|
throw gig::Exception("Unknown leverage controller type."); |
987 |
|
} |
988 |
|
return decodedcontroller; |
989 |
|
} |
990 |
|
|
991 |
DimensionRegion::~DimensionRegion() { |
DimensionRegion::~DimensionRegion() { |
992 |
Instances--; |
Instances--; |
1011 |
* triggered to get the volume with which the sample should be played |
* triggered to get the volume with which the sample should be played |
1012 |
* back. |
* back. |
1013 |
* |
* |
1014 |
* @param MIDI velocity value of the triggered key (between 0 and 127) |
* @param MIDIKeyVelocity MIDI velocity value of the triggered key (between 0 and 127) |
1015 |
* @returns amplitude factor (between 0.0 and 1.0) |
* @returns amplitude factor (between 0.0 and 1.0) |
1016 |
*/ |
*/ |
1017 |
double DimensionRegion::GetVelocityAttenuation(uint8_t MIDIKeyVelocity) { |
double DimensionRegion::GetVelocityAttenuation(uint8_t MIDIKeyVelocity) { |
1018 |
return pVelocityAttenuationTable[MIDIKeyVelocity]; |
return pVelocityAttenuationTable[MIDIKeyVelocity]; |