diff options
author | Chris Robinson <[email protected]> | 2014-07-06 09:06:35 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-07-06 09:06:35 -0700 |
commit | 8dec92531bb466bbefedf93778520cb71a218bf4 (patch) | |
tree | 2e5c8d297759e6949a2ba6cf690095aa936724d0 /OpenAL32 | |
parent | dc760131261412b537f7c5859acaa40c0a630e3d (diff) |
Store 4 modulators per map entry
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMidi.h | 1 | ||||
-rw-r--r-- | OpenAL32/alFontsound.c | 21 |
2 files changed, 14 insertions, 8 deletions
diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index 082e16d1..f3f623a5 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -87,6 +87,7 @@ typedef struct ALfontsound { ALenum SampleType; struct ALfontsound *Link; + /* NOTE: Each map entry contains *four* (4) ALsfmodulator objects. */ UIntMap ModulatorMap; ALuint id; diff --git a/OpenAL32/alFontsound.c b/OpenAL32/alFontsound.c index aaa65c98..3a8f1460 100644 --- a/OpenAL32/alFontsound.c +++ b/OpenAL32/alFontsound.c @@ -25,9 +25,11 @@ void ALfontsound_setModStagei(ALfontsound *self, ALCcontext *context, ALsizei st static void ALfontsound_getModStagei(ALfontsound *self, ALCcontext *context, ALsizei stage, ALenum param, ALint *values); static inline struct ALsfmodulator *LookupModulator(ALfontsound *sound, ALuint id) -{ return (struct ALsfmodulator*)LookupUIntMapKey(&sound->ModulatorMap, id); } -static inline struct ALsfmodulator *RemoveModulator(ALfontsound *sound, ALuint id) -{ return (struct ALsfmodulator*)RemoveUIntMapKey(&sound->ModulatorMap, id); } +{ + ALsfmodulator *mod = LookupUIntMapKey(&sound->ModulatorMap, id>>2); + if(mod) mod += id&3; + return mod; +} AL_API void AL_APIENTRY alGenFontsoundsSOFT(ALsizei n, ALuint *ids) @@ -846,15 +848,18 @@ static ALsfmodulator *ALfontsound_getModStage(ALfontsound *self, ALsizei stage) { static const ALsfmodulator moddef = { { { AL_ONE_SOFT, AL_UNORM_SOFT, AL_LINEAR_SOFT }, - { AL_ONE_SOFT, AL_UNORM_SOFT, AL_LINEAR_SOFT } - }, + { AL_ONE_SOFT, AL_UNORM_SOFT, AL_LINEAR_SOFT } }, 0, AL_LINEAR_SOFT, AL_NONE }; - ret = malloc(sizeof(*ret)); - *ret = moddef; - InsertUIntMapEntry(&self->ModulatorMap, stage, ret); + ret = malloc(sizeof(ALsfmodulator[4])); + ret[0] = moddef; + ret[1] = moddef; + ret[2] = moddef; + ret[3] = moddef; + InsertUIntMapEntry(&self->ModulatorMap, stage>>2, ret); + ret += stage&3; } return ret; } |