diff options
author | Chris Robinson <[email protected]> | 2013-12-26 22:10:41 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-26 22:10:41 -0800 |
commit | cc30c5754fa43f21833dc59d212bfb5aa42628de (patch) | |
tree | d2199d95643a30483d9b3d91bcdc6575053f61f1 | |
parent | d5f687b2faddaa9a173b387fe07192be5dfbb6c9 (diff) |
Remove the generator list
-rw-r--r-- | Alc/midi/base.c | 60 | ||||
-rw-r--r-- | OpenAL32/Include/alMidi.h | 19 |
2 files changed, 16 insertions, 63 deletions
diff --git a/Alc/midi/base.c b/Alc/midi/base.c index cd6293d2..6449d7fc 100644 --- a/Alc/midi/base.c +++ b/Alc/midi/base.c @@ -252,14 +252,6 @@ void ALfontsound_Construct(ALfontsound *self) self->MinVelocity = 0; self->MaxVelocity = 127; - self->Generators = NULL; - self->NumGenerators = 0; - self->GeneratorsMax = 0; - - self->Modulators = NULL; - self->NumModulators = 0; - self->ModulatorsMax = 0; - self->Start = 0; self->End = 0; self->LoopStart = 0; @@ -267,59 +259,29 @@ void ALfontsound_Construct(ALfontsound *self) self->SampleRate = 0; self->PitchKey = 0; self->PitchCorrection = 0; - self->SampleLink = 0; self->SampleType = AL_NONE; + self->Link = NULL; - self->id = 0; -} - -void ALfontsound_Destruct(ALfontsound *self) -{ - free(self->Modulators); self->Modulators = NULL; self->NumModulators = 0; self->ModulatorsMax = 0; - free(self->Generators); - self->Generators = NULL; - self->NumGenerators = 0; - self->GeneratorsMax = 0; - - FreeThunkEntry(self->id); self->id = 0; } -ALenum ALfontsound_addGenerator(ALfontsound *self, ALenum generator, ALint value) +void ALfontsound_Destruct(ALfontsound *self) { - ALsizei i; - for(i = 0;i < self->NumGenerators;i++) - { - if(self->Generators[i].Generator == generator) - { - self->Generators[i].Value = value; - return AL_NO_ERROR; - } - } - - if(self->NumGenerators == self->GeneratorsMax) - { - ALsizei newmax = 0; - ALvoid *temp = NULL; - - newmax = (self->GeneratorsMax ? self->GeneratorsMax<<1 : 1); - if(newmax > self->GeneratorsMax) - temp = realloc(self->Generators, newmax * sizeof(ALsfgenerator)); - if(!temp) return AL_OUT_OF_MEMORY; - - self->Generators = temp; - self->GeneratorsMax = newmax; - } + FreeThunkEntry(self->id); + self->id = 0; - self->Generators[self->NumGenerators].Generator = generator; - self->Generators[self->NumGenerators].Value = value; - self->NumGenerators++; + if(self->Link) + DecrementRef(&self->Link->ref); + self->Link = NULL; - return AL_NO_ERROR; + free(self->Modulators); + self->Modulators = NULL; + self->NumModulators = 0; + self->ModulatorsMax = 0; } ALenum ALfontsound_addModulator(ALfontsound *self, ALenum sourceop, ALenum destop, ALint amount, ALenum amtsourceop, ALenum transop) diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index cd5249a2..acbc81b5 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -8,11 +8,6 @@ extern "C" { #endif -typedef struct ALsfgenerator { - ALenum Generator; - ALint Value; -} ALsfgenerator; - typedef struct ALsfmodulator { ALenum SourceOp; ALenum DestOp; @@ -28,14 +23,6 @@ typedef struct ALfontsound { ALint MinKey, MaxKey; ALint MinVelocity, MaxVelocity; - ALsfgenerator *Generators; - ALsizei NumGenerators; - ALsizei GeneratorsMax; - - ALsfmodulator *Modulators; - ALsizei NumModulators; - ALsizei ModulatorsMax; - ALuint Start; ALuint End; ALuint LoopStart; @@ -43,8 +30,12 @@ typedef struct ALfontsound { ALuint SampleRate; ALubyte PitchKey; ALbyte PitchCorrection; - ALint SampleLink; ALenum SampleType; + struct ALfontsound *Link; + + ALsfmodulator *Modulators; + ALsizei NumModulators; + ALsizei ModulatorsMax; ALuint id; } ALfontsound; |