From 49c17ad520d25075b7988c51705198a3cb834e93 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 2 Jan 2014 13:53:16 -0800 Subject: Mostly load into fontsound objects directly This leaves only one unsafe alFontsoundiSOFT call. --- Alc/midi/base.c | 130 -------------------------------------------------------- 1 file changed, 130 deletions(-) (limited to 'Alc/midi/base.c') diff --git a/Alc/midi/base.c b/Alc/midi/base.c index 599dc6dc..db839958 100644 --- a/Alc/midi/base.c +++ b/Alc/midi/base.c @@ -286,136 +286,6 @@ ALenum MidiSynth_insertSysExEvent(MidiSynth *self, ALuint64 time, const ALbyte * } -void ALfontsound_Construct(ALfontsound *self) -{ - self->ref = 0; - - self->MinKey = 0; - self->MaxKey = 127; - self->MinVelocity = 0; - self->MaxVelocity = 127; - - self->ModLfoToPitch = 0; - self->VibratoLfoToPitch = 0; - self->ModEnvToPitch = 0; - - self->FilterCutoff = 13500; - self->FilterQ = 0; - self->ModLfoToFilterCutoff = 0; - self->ModEnvToFilterCutoff = 0; - self->ModLfoToVolume = 0; - - self->ChorusSend = 0; - self->ReverbSend = 0; - - self->Pan = 0; - - self->ModLfo.Delay = 0; - self->ModLfo.Frequency = 0; - - self->VibratoLfo.Delay = 0; - self->VibratoLfo.Frequency = 0; - - self->ModEnv.DelayTime = -12000; - self->ModEnv.AttackTime = -12000; - self->ModEnv.HoldTime = -12000; - self->ModEnv.DecayTime = -12000; - self->ModEnv.SustainVol = 0; - self->ModEnv.ReleaseTime = -12000; - self->ModEnv.KeyToHoldTime = 0; - self->ModEnv.KeyToDecayTime = 0; - - self->VolEnv.DelayTime = -12000; - self->VolEnv.AttackTime = -12000; - self->VolEnv.HoldTime = -12000; - self->VolEnv.DecayTime = -12000; - self->VolEnv.SustainVol = 0; - self->VolEnv.ReleaseTime = -12000; - self->VolEnv.KeyToHoldTime = 0; - self->VolEnv.KeyToDecayTime = 0; - - self->Attenuation = 0; - - self->CoarseTuning = 0; - self->FineTuning = 0; - - self->LoopMode = AL_NONE; - - self->TuningScale = 100; - - self->ExclusiveClass = 0; - - self->Start = 0; - self->End = 0; - self->LoopStart = 0; - self->LoopEnd = 0; - self->SampleRate = 0; - self->PitchKey = 0; - self->PitchCorrection = 0; - self->SampleType = AL_NONE; - self->Link = NULL; - - self->Modulators = NULL; - self->NumModulators = 0; - self->ModulatorsMax = 0; - - self->id = 0; -} - -void ALfontsound_Destruct(ALfontsound *self) -{ - FreeThunkEntry(self->id); - self->id = 0; - - if(self->Link) - DecrementRef(&self->Link->ref); - self->Link = NULL; - - 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) -{ - ALsizei i; - for(i = 0;i < self->NumModulators;i++) - { - if(self->Modulators[i].SourceOp == sourceop && self->Modulators[i].DestOp == destop && - self->Modulators[i].AmountSourceOp == amtsourceop && - self->Modulators[i].TransformOp == transop) - { - self->Modulators[i].Amount = amount; - return AL_NO_ERROR; - } - } - - if(self->NumModulators == self->ModulatorsMax) - { - ALsizei newmax = 0; - ALvoid *temp = NULL; - - newmax = (self->ModulatorsMax ? self->ModulatorsMax<<1 : 1); - if(newmax > self->ModulatorsMax) - temp = realloc(self->Modulators, newmax * sizeof(ALsfmodulator)); - if(!temp) return AL_OUT_OF_MEMORY; - - self->Modulators = temp; - self->ModulatorsMax = newmax; - } - - self->Modulators[self->NumModulators].SourceOp = sourceop; - self->Modulators[self->NumModulators].DestOp = destop; - self->Modulators[self->NumModulators].Amount = amount; - self->Modulators[self->NumModulators].AmountSourceOp = amtsourceop; - self->Modulators[self->NumModulators].TransformOp = transop; - self->NumModulators++; - - return AL_NO_ERROR; -} - - void ALsoundfont_Construct(ALsoundfont *self) { self->ref = 0; -- cgit v1.2.3