Use a uint map for modulators
This commit is contained in:
parent
49c17ad520
commit
f790d0e91f
@ -89,9 +89,7 @@ typedef struct ALfontsound {
|
||||
ALenum SampleType;
|
||||
struct ALfontsound *Link;
|
||||
|
||||
ALsfmodulator *Modulators;
|
||||
ALsizei NumModulators;
|
||||
ALsizei ModulatorsMax;
|
||||
UIntMap ModulatorMap;
|
||||
|
||||
ALuint id;
|
||||
} ALfontsound;
|
||||
@ -103,6 +101,11 @@ inline struct ALfontsound *LookupFontsound(ALCdevice *device, ALuint id)
|
||||
inline struct ALfontsound *RemoveFontsound(ALCdevice *device, ALuint id)
|
||||
{ return (struct ALfontsound*)RemoveUIntMapKey(&device->FontsoundMap, id); }
|
||||
|
||||
inline struct ALsfmodulator *LookupModulator(ALfontsound *sound, ALuint id)
|
||||
{ return (struct ALsfmodulator*)LookupUIntMapKey(&sound->ModulatorMap, id); }
|
||||
inline struct ALsfmodulator *RemoveModulator(ALfontsound *sound, ALuint id)
|
||||
{ return (struct ALsfmodulator*)RemoveUIntMapKey(&sound->ModulatorMap, id); }
|
||||
|
||||
void ReleaseALFontsounds(ALCdevice *device);
|
||||
|
||||
|
||||
|
@ -735,15 +735,15 @@ static void ALfontsound_Construct(ALfontsound *self)
|
||||
self->SampleType = AL_NONE;
|
||||
self->Link = NULL;
|
||||
|
||||
self->Modulators = NULL;
|
||||
self->NumModulators = 0;
|
||||
self->ModulatorsMax = 0;
|
||||
InitUIntMap(&self->ModulatorMap, ~0);
|
||||
|
||||
self->id = 0;
|
||||
}
|
||||
|
||||
static void ALfontsound_Destruct(ALfontsound *self)
|
||||
{
|
||||
ALsizei i;
|
||||
|
||||
FreeThunkEntry(self->id);
|
||||
self->id = 0;
|
||||
|
||||
@ -751,10 +751,12 @@ static void ALfontsound_Destruct(ALfontsound *self)
|
||||
DecrementRef(&self->Link->ref);
|
||||
self->Link = NULL;
|
||||
|
||||
free(self->Modulators);
|
||||
self->Modulators = NULL;
|
||||
self->NumModulators = 0;
|
||||
self->ModulatorsMax = 0;
|
||||
for(i = 0;i < self->ModulatorMap.size;i++)
|
||||
{
|
||||
free(self->ModulatorMap.array[i].value);
|
||||
self->ModulatorMap.array[i].value = NULL;
|
||||
}
|
||||
ResetUIntMap(&self->ModulatorMap);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user