diff options
author | Chris Robinson <[email protected]> | 2013-12-26 23:37:22 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-26 23:37:22 -0800 |
commit | 307ac564ca68abf8a3a24b2d0f7c1e2efb13a4be (patch) | |
tree | c24388e3cef76c4db29fb3204f69b5d362b8591e /OpenAL32 | |
parent | cc30c5754fa43f21833dc59d212bfb5aa42628de (diff) |
Allow specifying some fontsound sample properties
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 9 | ||||
-rw-r--r-- | OpenAL32/alFontsound.c | 105 |
2 files changed, 113 insertions, 1 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 66830b8c..a471fb92 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -37,6 +37,15 @@ #define AL_PRESETS_SOFT 0x9994 #define AL_FONTSOUNDS_SIZE_SOFT 0x9993 #define AL_FONTSOUNDS_SOFT 0x9992 +#define AL_SAMPLE_START_SOFT 0x2000 +#define AL_SAMPLE_END_SOFT 0x2001 +#define AL_SAMPLE_LOOP_START_SOFT 0x2002 +#define AL_SAMPLE_LOOP_END_SOFT 0x2003 +#define AL_SAMPLE_RATE_SOFT 0x2004 +#define AL_BASE_KEY_SOFT 0x2005 +#define AL_KEY_CORRECTION_SOFT 0x2006 +#define AL_SAMPLE_TYPE_SOFT 0x2007 +#define AL_FONTSOUND_LINK_SOFT 0x2008 #define AL_KEY_RANGE_SOFT 0x002B #define AL_VELOCITY_RANGE_SOFT 0x002C #define AL_FORMAT_TYPE_SOFT 0x1991 diff --git a/OpenAL32/alFontsound.c b/OpenAL32/alFontsound.c index 8ad85c0e..85ca25d6 100644 --- a/OpenAL32/alFontsound.c +++ b/OpenAL32/alFontsound.c @@ -113,11 +113,12 @@ AL_API ALboolean AL_APIENTRY alIsFontsoundSOFT(ALuint id) return ret; } -AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint UNUSED(value)) +AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint value) { ALCdevice *device; ALCcontext *context; ALfontsound *sound; + ALfontsound *link; context = GetContextRef(); if(!context) return; @@ -129,6 +130,60 @@ AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint UNUSED(v SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); switch(param) { + case AL_SAMPLE_START_SOFT: + sound->Start = value; + break; + + case AL_SAMPLE_END_SOFT: + sound->End = value; + break; + + case AL_SAMPLE_LOOP_START_SOFT: + sound->LoopStart = value; + break; + + case AL_SAMPLE_LOOP_END_SOFT: + sound->LoopEnd = value; + break; + + case AL_SAMPLE_RATE_SOFT: + if(!(value > 0)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + sound->SampleRate = value; + break; + + case AL_BASE_KEY_SOFT: + if(!((value >= 0 && value <= 127) || value == 255)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + sound->PitchKey = value; + break; + + case AL_KEY_CORRECTION_SOFT: + if(!(value > -100 && value < 100)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + sound->PitchCorrection = value; + break; + + case AL_SAMPLE_TYPE_SOFT: + if(!(value == 1)) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + sound->SampleType = value; + break; + + case AL_FONTSOUND_LINK_SOFT: + if(!value) + link = NULL; + else + { + link = LookupFontsound(device, value); + if(!link) + SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + } + if(link) IncrementRef(&link->ref); + link = ExchangePtr((XchgPtr*)&sound->Link, link); + if(link) DecrementRef(&link->ref); + break; + default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } @@ -187,6 +242,18 @@ AL_API void AL_APIENTRY alFontsoundivSOFT(ALuint id, ALenum param, const ALint * case AL_VELOCITY_RANGE_SOFT: alFontsound2iSOFT(id, param, values[0], values[1]); return; + + case AL_SAMPLE_START_SOFT: + case AL_SAMPLE_END_SOFT: + case AL_SAMPLE_LOOP_START_SOFT: + case AL_SAMPLE_LOOP_END_SOFT: + case AL_SAMPLE_RATE_SOFT: + case AL_BASE_KEY_SOFT: + case AL_KEY_CORRECTION_SOFT: + case AL_SAMPLE_TYPE_SOFT: + case AL_FONTSOUND_LINK_SOFT: + alFontsoundiSOFT(id, param, values[0]); + return; } context = GetContextRef(); @@ -231,6 +298,42 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val values[1] = sound->MaxVelocity; break; + case AL_SAMPLE_START_SOFT: + values[0] = sound->Start; + break; + + case AL_SAMPLE_END_SOFT: + values[0] = sound->End; + break; + + case AL_SAMPLE_LOOP_START_SOFT: + values[0] = sound->LoopStart; + break; + + case AL_SAMPLE_LOOP_END_SOFT: + values[0] = sound->LoopEnd; + break; + + case AL_SAMPLE_RATE_SOFT: + values[0] = sound->SampleRate; + break; + + case AL_BASE_KEY_SOFT: + values[0] = sound->PitchKey; + break; + + case AL_KEY_CORRECTION_SOFT: + values[0] = sound->PitchCorrection; + break; + + case AL_SAMPLE_TYPE_SOFT: + values[0] = sound->SampleType; + break; + + case AL_FONTSOUND_LINK_SOFT: + values[0] = (sound->Link ? sound->Link->id : 0); + break; + default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } |