aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-01-17 05:14:58 -0800
committerChris Robinson <[email protected]>2014-01-17 05:14:58 -0800
commit05e9c824d5f330b9bf691f1049433e1ab9e9b251 (patch)
treec3acb00bd2678434a97afb6e3e8b665954c67d23 /Alc
parent65a5311449da52d29fbdddcc1f7077a69f844296 (diff)
Better handle original key and overriding root key
Diffstat (limited to 'Alc')
-rw-r--r--Alc/midi/sf2load.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c
index ef032535..811ff806 100644
--- a/Alc/midi/sf2load.c
+++ b/Alc/midi/sf2load.c
@@ -924,8 +924,15 @@ static void fillZone(ALfontsound *sound, ALCcontext *context, const GenModList *
param = Gen2Param[gen->mGenerator];
if(param)
{
- if(param == AL_BASE_KEY_SOFT && value == -1)
- continue;
+ if(param == AL_BASE_KEY_SOFT)
+ {
+ if(!(value >= 0 && value <= 127))
+ {
+ if(value != -1)
+ WARN("Invalid overridingRootKey generator value %d\n", value);
+ continue;
+ }
+ }
if(param == AL_FILTER_RESONANCE_SOFT || param == AL_ATTENUATION_SOFT)
value = maxi(0, value);
else if(param == AL_CHORUS_SEND_SOFT || param == AL_REVERB_SEND_SOFT)
@@ -1045,7 +1052,7 @@ static void processInstrument(ALfontsound ***sounds, ALsizei *sounds_size, ALCco
ALfontsound_setPropi(sound, context, AL_SAMPLE_LOOP_START_SOFT, samp->mStartloop);
ALfontsound_setPropi(sound, context, AL_SAMPLE_LOOP_END_SOFT, samp->mEndloop);
ALfontsound_setPropi(sound, context, AL_SAMPLE_RATE_SOFT, samp->mSampleRate);
- ALfontsound_setPropi(sound, context, AL_BASE_KEY_SOFT, samp->mOriginalKey);
+ ALfontsound_setPropi(sound, context, AL_BASE_KEY_SOFT, (samp->mOriginalKey <= 127) ? samp->mOriginalKey : 60);
ALfontsound_setPropi(sound, context, AL_KEY_CORRECTION_SOFT, samp->mCorrection);
ALfontsound_setPropi(sound, context, AL_SAMPLE_TYPE_SOFT, getSampleType(samp->mSampleType&0x7fff));
fillZone(sound, context, &lzone);