aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-26 21:45:16 -0800
committerChris Robinson <[email protected]>2013-12-26 21:45:16 -0800
commitd5f687b2faddaa9a173b387fe07192be5dfbb6c9 (patch)
treee1ebad8be4fa511bc4334257de96ed5372ab4793
parent35f9e35aa361c6f1f05539cb2ca01508fdd1ce59 (diff)
Allow specifying key and velocity ranges on fontsounds
-rw-r--r--Alc/ALc.c4
-rw-r--r--OpenAL32/Include/alMain.h10
-rw-r--r--OpenAL32/alFontsound.c126
3 files changed, 140 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index ca5c3200..ad4cefc2 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -299,6 +299,10 @@ static const ALCfunction alcFunctions[] = {
DECL(alGenFontsoundsSOFT),
DECL(alDeleteFontsoundsSOFT),
DECL(alIsFontsoundSOFT),
+ DECL(alFontsoundiSOFT),
+ DECL(alFontsound2iSOFT),
+ DECL(alFontsoundivSOFT),
+ DECL(alGetFontsoundivSOFT),
DECL(alMidiSoundfontSOFT),
DECL(alMidiEventSOFT),
DECL(alMidiSysExSOFT),
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 1673e8be..66830b8c 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -37,6 +37,8 @@
#define AL_PRESETS_SOFT 0x9994
#define AL_FONTSOUNDS_SIZE_SOFT 0x9993
#define AL_FONTSOUNDS_SOFT 0x9992
+#define AL_KEY_RANGE_SOFT 0x002B
+#define AL_VELOCITY_RANGE_SOFT 0x002C
#define AL_FORMAT_TYPE_SOFT 0x1991
#define AL_NOTEOFF_SOFT 0x0080
#define AL_NOTEON_SOFT 0x0090
@@ -63,6 +65,10 @@ typedef void (AL_APIENTRY*LPALGETPRESETIVSOFT)(ALuint id, ALenum param, ALint *v
typedef void (AL_APIENTRY*LPALGENFONTSOUNDSSOFT)(ALsizei n, ALuint *ids);
typedef void (AL_APIENTRY*LPALDELETEFONTSOUNDSSOFT)(ALsizei n, const ALuint *ids);
typedef ALboolean (AL_APIENTRY*LPALISFONTSOUNDSOFT)(ALuint id);
+typedef void (AL_APIENTRY*LPALFONTSOUNDISOFT)(ALuint id, ALenum param, ALint value);
+typedef void (AL_APIENTRY*LPALFONTSOUND2ISOFT)(ALuint id, ALenum param, ALint value1, ALint value2);
+typedef void (AL_APIENTRY*LPALFONTSOUNDIVSOFT)(ALuint id, ALenum param, const ALint *values);
+typedef void (AL_APIENTRY*LPALGETFONTSOUNDIVSOFT)(ALuint id, ALenum param, ALint *values);
typedef void (AL_APIENTRY*LPALMIDISOUNDFONTSOFT)(const char *filename);
typedef void (AL_APIENTRY*LPALMIDIEVENTSOFT)(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2);
typedef void (AL_APIENTRY*LPALMIDISYSEXSOFT)(ALuint64SOFT time, const ALbyte *data, ALsizei size);
@@ -94,6 +100,10 @@ AL_API void AL_APIENTRY alPresetFontsoundsSOFT(ALuint id, ALsizei count, const A
AL_API void AL_APIENTRY alGenFontsoundsSOFT(ALsizei n, ALuint *ids);
AL_API void AL_APIENTRY alDeleteFontsoundsSOFT(ALsizei n, const ALuint *ids);
AL_API ALboolean AL_APIENTRY alIsFontsoundSOFT(ALuint id);
+AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint value);
+AL_API void AL_APIENTRY alFontsound2iSOFT(ALuint id, ALenum param, ALint value1, ALint value2);
+AL_API void AL_APIENTRY alFontsoundivSOFT(ALuint id, ALenum param, const ALint *values);
+AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *values);
AL_API void AL_APIENTRY alMidiSoundfontSOFT(const char *filename);
AL_API void AL_APIENTRY alMidiEventSOFT(ALuint64SOFT time, ALenum event, ALsizei channel, ALsizei param1, ALsizei param2);
diff --git a/OpenAL32/alFontsound.c b/OpenAL32/alFontsound.c
index bfb2e6da..8ad85c0e 100644
--- a/OpenAL32/alFontsound.c
+++ b/OpenAL32/alFontsound.c
@@ -113,6 +113,132 @@ AL_API ALboolean AL_APIENTRY alIsFontsoundSOFT(ALuint id)
return ret;
}
+AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint UNUSED(value))
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ ALfontsound *sound;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ if(!(sound=LookupFontsound(device, id)))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
+ if(sound->ref != 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ switch(param)
+ {
+ default:
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ }
+
+done:
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alFontsound2iSOFT(ALuint id, ALenum param, ALint value1, ALint value2)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ ALfontsound *sound;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ if(!(sound=LookupFontsound(device, id)))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
+ if(sound->ref != 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ switch(param)
+ {
+ case AL_KEY_RANGE_SOFT:
+ if(!(value1 >= 0 && value1 <= 127 && value2 >= 0 && value2 <= 127))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ sound->MinKey = value1;
+ sound->MaxKey = value2;
+ break;
+
+ case AL_VELOCITY_RANGE_SOFT:
+ if(!(value1 >= 0 && value1 <= 127 && value2 >= 0 && value2 <= 127))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ sound->MinVelocity = value1;
+ sound->MaxVelocity = value2;
+ break;
+
+ default:
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ }
+
+done:
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alFontsoundivSOFT(ALuint id, ALenum param, const ALint *values)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ ALfontsound *sound;
+
+ switch(param)
+ {
+ case AL_KEY_RANGE_SOFT:
+ case AL_VELOCITY_RANGE_SOFT:
+ alFontsound2iSOFT(id, param, values[0], values[1]);
+ return;
+ }
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ if(!(sound=LookupFontsound(device, id)))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
+ if(sound->ref != 0)
+ SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done);
+ switch(param)
+ {
+ default:
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ }
+
+done:
+ ALCcontext_DecRef(context);
+}
+
+AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *values)
+{
+ ALCdevice *device;
+ ALCcontext *context;
+ const ALfontsound *sound;
+
+ context = GetContextRef();
+ if(!context) return;
+
+ device = context->Device;
+ if(!(sound=LookupFontsound(device, id)))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done);
+ switch(param)
+ {
+ case AL_KEY_RANGE_SOFT:
+ values[0] = sound->MinKey;
+ values[1] = sound->MaxKey;
+ break;
+
+ case AL_VELOCITY_RANGE_SOFT:
+ values[0] = sound->MinVelocity;
+ values[1] = sound->MaxVelocity;
+ break;
+
+ default:
+ SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
+ }
+
+done:
+ ALCcontext_DecRef(context);
+}
+
/* ReleaseALFontsounds
*