aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-07-04 11:18:32 -0700
committerChris Robinson <[email protected]>2014-07-04 22:08:24 -0700
commit5afc29f65dde15059e2511adbba466c15cc2e3b1 (patch)
treec8297a8f1b91e909d687deaf56e9b2df310fbd33 /Alc
parentf667782df2307ff480ccf85c3fa09dc5f6ceabdb (diff)
Use a helper function to check valid MIDI controller inputs
Diffstat (limited to 'Alc')
-rw-r--r--Alc/midi/base.c2
-rw-r--r--Alc/midi/sf2load.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/Alc/midi/base.c b/Alc/midi/base.c
index fbf02556..cab85c1a 100644
--- a/Alc/midi/base.c
+++ b/Alc/midi/base.c
@@ -16,6 +16,8 @@
#include "alu.h"
+extern inline ALboolean IsValidCtrlInput(int cc);
+
extern inline size_t Reader_read(Reader *self, void *buf, size_t len);
diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c
index 3c81b256..933166ad 100644
--- a/Alc/midi/sf2load.c
+++ b/Alc/midi/sf2load.c
@@ -614,11 +614,8 @@ static ALenum getModSrcInput(int input)
if(input == 16) return AL_PITCHBEND_SENSITIVITY_SOFT;
if((input&0x80))
{
- input ^= 0x80;
- if(input > 0 && input < 120 && !(input == 6 || (input >= 32 && input <= 63) ||
- (input >= 98 && input <= 101)))
- return input;
- input ^= 0x80;
+ if(IsValidCtrlInput(input^0x80))
+ return input^0x80;
}
ERR("Unhandled modulator source input: 0x%02x\n", input);
return AL_INVALID;