Use a proper struct for envelope properties

This commit is contained in:
Chris Robinson 2014-01-17 00:36:33 -08:00
parent e118ac93a0
commit 08ba5d9dba
3 changed files with 21 additions and 28 deletions

View File

@ -320,7 +320,7 @@ static int FPreset_noteOn(fluid_preset_t *preset, fluid_synth_t *synth, int chan
fluid_voice_gen_set(voice, GEN_MODENVATTACK, sound->ModEnv.AttackTime);
fluid_voice_gen_set(voice, GEN_MODENVHOLD, sound->ModEnv.HoldTime);
fluid_voice_gen_set(voice, GEN_MODENVDECAY, sound->ModEnv.DecayTime);
fluid_voice_gen_set(voice, GEN_MODENVSUSTAIN, sound->ModEnv.SustainVol);
fluid_voice_gen_set(voice, GEN_MODENVSUSTAIN, sound->ModEnv.SustainAttn);
fluid_voice_gen_set(voice, GEN_MODENVRELEASE, sound->ModEnv.ReleaseTime);
fluid_voice_gen_set(voice, GEN_KEYTOMODENVHOLD, sound->ModEnv.KeyToHoldTime);
fluid_voice_gen_set(voice, GEN_KEYTOMODENVDECAY, sound->ModEnv.KeyToDecayTime);
@ -328,7 +328,7 @@ static int FPreset_noteOn(fluid_preset_t *preset, fluid_synth_t *synth, int chan
fluid_voice_gen_set(voice, GEN_VOLENVATTACK, sound->VolEnv.AttackTime);
fluid_voice_gen_set(voice, GEN_VOLENVHOLD, sound->VolEnv.HoldTime);
fluid_voice_gen_set(voice, GEN_VOLENVDECAY, sound->VolEnv.DecayTime);
fluid_voice_gen_set(voice, GEN_VOLENVSUSTAIN, sound->VolEnv.SustainVol);
fluid_voice_gen_set(voice, GEN_VOLENVSUSTAIN, sound->VolEnv.SustainAttn);
fluid_voice_gen_set(voice, GEN_VOLENVRELEASE, sound->VolEnv.ReleaseTime);
fluid_voice_gen_set(voice, GEN_KEYTOVOLENVHOLD, sound->VolEnv.KeyToHoldTime);
fluid_voice_gen_set(voice, GEN_KEYTOVOLENVDECAY, sound->VolEnv.KeyToDecayTime);

View File

@ -19,6 +19,17 @@ typedef struct ALsfmodulator {
ALenum Dest;
} ALsfmodulator;
typedef struct ALenvelope {
ALint DelayTime;
ALint AttackTime;
ALint HoldTime;
ALint DecayTime;
ALint SustainAttn;
ALint ReleaseTime;
ALint KeyToHoldTime;
ALint KeyToDecayTime;
} ALenvelope;
typedef struct ALfontsound {
volatile RefCount ref;
@ -50,26 +61,8 @@ typedef struct ALfontsound {
ALint Frequency;
} VibratoLfo;
struct {
ALint DelayTime;
ALint AttackTime;
ALint HoldTime;
ALint DecayTime;
ALint SustainVol;
ALint ReleaseTime;
ALint KeyToHoldTime;
ALint KeyToDecayTime;
} ModEnv;
struct {
ALint DelayTime;
ALint AttackTime;
ALint HoldTime;
ALint DecayTime;
ALint SustainVol;
ALint ReleaseTime;
ALint KeyToHoldTime;
ALint KeyToDecayTime;
} VolEnv;
ALenvelope ModEnv;
ALenvelope VolEnv;
ALint Attenuation;

View File

@ -328,7 +328,7 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val
values[0] = sound->ModEnv.DecayTime;
break;
case AL_MOD_ENV_SUSTAINVOLUME_SOFT:
values[0] = sound->ModEnv.SustainVol;
values[0] = sound->ModEnv.SustainAttn;
break;
case AL_MOD_ENV_RELEASETIME_SOFT:
values[0] = sound->ModEnv.ReleaseTime;
@ -353,7 +353,7 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val
values[0] = sound->VolEnv.DecayTime;
break;
case AL_VOLUME_ENV_SUSTAINVOLUME_SOFT:
values[0] = sound->VolEnv.SustainVol;
values[0] = sound->VolEnv.SustainAttn;
break;
case AL_VOLUME_ENV_RELEASETIME_SOFT:
values[0] = sound->VolEnv.ReleaseTime;
@ -540,7 +540,7 @@ static void ALfontsound_Construct(ALfontsound *self)
self->ModEnv.AttackTime = -12000;
self->ModEnv.HoldTime = -12000;
self->ModEnv.DecayTime = -12000;
self->ModEnv.SustainVol = 0;
self->ModEnv.SustainAttn = 0;
self->ModEnv.ReleaseTime = -12000;
self->ModEnv.KeyToHoldTime = 0;
self->ModEnv.KeyToDecayTime = 0;
@ -549,7 +549,7 @@ static void ALfontsound_Construct(ALfontsound *self)
self->VolEnv.AttackTime = -12000;
self->VolEnv.HoldTime = -12000;
self->VolEnv.DecayTime = -12000;
self->VolEnv.SustainVol = 0;
self->VolEnv.SustainAttn = 0;
self->VolEnv.ReleaseTime = -12000;
self->VolEnv.KeyToHoldTime = 0;
self->VolEnv.KeyToDecayTime = 0;
@ -681,7 +681,7 @@ void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param,
self->ModEnv.DecayTime = value;
break;
case AL_MOD_ENV_SUSTAINVOLUME_SOFT:
self->ModEnv.SustainVol = value;
self->ModEnv.SustainAttn = value;
break;
case AL_MOD_ENV_RELEASETIME_SOFT:
self->ModEnv.ReleaseTime = value;
@ -706,7 +706,7 @@ void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param,
self->VolEnv.DecayTime = value;
break;
case AL_VOLUME_ENV_SUSTAINVOLUME_SOFT:
self->VolEnv.SustainVol = value;
self->VolEnv.SustainAttn = value;
break;
case AL_VOLUME_ENV_RELEASETIME_SOFT:
self->VolEnv.ReleaseTime = value;