diff options
author | Chris Robinson <[email protected]> | 2014-07-04 11:18:32 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-07-04 22:08:24 -0700 |
commit | 5afc29f65dde15059e2511adbba466c15cc2e3b1 (patch) | |
tree | c8297a8f1b91e909d687deaf56e9b2df310fbd33 /OpenAL32/Include | |
parent | f667782df2307ff480ccf85c3fa09dc5f6ceabdb (diff) |
Use a helper function to check valid MIDI controller inputs
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMidi.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index 76567db0..948fc319 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -157,6 +157,20 @@ inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id) void ReleaseALSoundfonts(ALCdevice *device); + +inline ALboolean IsValidCtrlInput(int cc) +{ + /* These correspond to MIDI functions, not real controller values. */ + if(cc == 0 || cc == 6 || cc == 32 || cc == 38 || (cc >= 98 && cc <= 101) || cc >= 120) + return AL_FALSE; + /* These are the LSB components of CC0...CC31, which are automatically used when + * reading the MSB controller value. */ + if(cc >= 32 && cc <= 63) + return AL_FALSE; + /* All the rest are okay! */ + return AL_TRUE; +} + #ifdef __cplusplus } #endif |