aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi/base.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-25 19:23:34 -0800
committerChris Robinson <[email protected]>2013-12-25 19:23:34 -0800
commitb650ecbc23222ebd295384fce45aaca8cfb5c368 (patch)
tree0ab985988bb87f04f9d7c0584061837de274ae94 /Alc/midi/base.c
parent94ddc5cb1889a42c9ffe98b79e431b596a9563df (diff)
Add methods to add generators and modulators to fontsounds
Diffstat (limited to 'Alc/midi/base.c')
-rw-r--r--Alc/midi/base.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/Alc/midi/base.c b/Alc/midi/base.c
index 33c39133..f3f89743 100644
--- a/Alc/midi/base.c
+++ b/Alc/midi/base.c
@@ -467,6 +467,77 @@ void ALfontsound_Destruct(ALfontsound *self)
self->id = 0;
}
+ALenum ALfontsound_addGenerator(ALfontsound *self, ALenum generator, ALint value)
+{
+ 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;
+ }
+
+ self->Generators[self->NumGenerators].Generator = generator;
+ self->Generators[self->NumGenerators].Value = value;
+ self->NumGenerators++;
+
+ return AL_NO_ERROR;
+}
+
+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 ALsfpreset_Construct(ALsfpreset *self)
{