Add pan and attenuation properties

This commit is contained in:
Chris Robinson 2013-12-29 04:24:32 -08:00
parent d030e07879
commit 699d84491f
6 changed files with 41 additions and 6 deletions

View File

@ -304,6 +304,8 @@ void ALfontsound_Construct(ALfontsound *self)
self->ModLfoToFilterCutoff = 0;
self->ModEnvToFilterCutoff = 0;
self->Pan = 0;
self->ModEnv.DelayTime = -12000;
self->ModEnv.AttackTime = -12000;
self->ModEnv.HoldTime = -12000;
@ -322,6 +324,8 @@ void ALfontsound_Construct(ALfontsound *self)
self->VolEnv.KeyToHoldTime = 0;
self->VolEnv.KeyToDecayTime = 0;
self->Attenuation = 0;
self->CoarseTuning = 0;
self->FineTuning = 0;

View File

@ -170,6 +170,7 @@ static int FPreset_noteOn(fluid_preset_t *preset, fluid_synth_t *synth, int chan
fluid_voice_gen_set(voice, 9, sound->FilterQ);
fluid_voice_gen_set(voice, 10, sound->ModLfoToFilterCutoff);
fluid_voice_gen_set(voice, 11, sound->ModEnvToFilterCutoff);
fluid_voice_gen_set(voice, 17, sound->Pan);
fluid_voice_gen_set(voice, 25, sound->ModEnv.DelayTime);
fluid_voice_gen_set(voice, 26, sound->ModEnv.AttackTime);
fluid_voice_gen_set(voice, 27, sound->ModEnv.HoldTime);
@ -186,6 +187,7 @@ static int FPreset_noteOn(fluid_preset_t *preset, fluid_synth_t *synth, int chan
fluid_voice_gen_set(voice, 38, sound->VolEnv.ReleaseTime);
fluid_voice_gen_set(voice, 39, sound->VolEnv.KeyToHoldTime);
fluid_voice_gen_set(voice, 40, sound->VolEnv.KeyToDecayTime);
fluid_voice_gen_set(voice, 48, sound->Attenuation);
fluid_voice_gen_set(voice, 51, sound->CoarseTuning);
fluid_voice_gen_set(voice, 52, sound->FineTuning);
fluid_voice_gen_set(voice, 54, sound->LoopMode);

View File

@ -811,7 +811,7 @@ static void fillZone(ALuint id, const GenModList *zone)
0, /* 14 - */
0, /* 15 - chorusEffectsSend */
0, /* 16 - reverbEffectsSend */
0, /* 17 - pan */
AL_PAN_SOFT, /* 17 - pan */
0, /* 18 - */
0, /* 19 - */
0, /* 20 - */
@ -842,7 +842,7 @@ static void fillZone(ALuint id, const GenModList *zone)
0, /* 45 - startloopAddrCoarseOffset */
0, /* 46 - keynum */
0, /* 47 - velocity */
0, /* 48 - initialAttenuation */
AL_ATTENUATION_SOFT, /* 48 - initialAttenuation */
0, /* 49 - */
0, /* 50 - endloopAddrCoarseOffset */
AL_TUNING_COARSE_SOFT, /* 51 - corseTune */
@ -895,10 +895,13 @@ static void fillZone(ALuint id, const GenModList *zone)
ALint value = (ALshort)gen->mAmount;
if(param == AL_BASE_KEY_SOFT && value == -1)
break;
if(param == AL_FILTER_RESONANCE_SOFT && value < 0)
value = 0;
else if(param == AL_LOOP_MODE_SOFT && value == 2)
value = 0;
if(param == AL_FILTER_RESONANCE_SOFT || param == AL_ATTENUATION_SOFT)
value = maxi(0, value);
else if(param == AL_LOOP_MODE_SOFT)
{
if(!(value == 0 || value == 1 || value == 3))
value = 0;
}
alFontsoundiSOFT(id, param, value);
}
else if(gen->mGenerator < 256)

View File

@ -55,6 +55,7 @@
#define AL_FILTER_RESONANCE_SOFT 0x0009
#define AL_MOD_LFO_TO_FILTER_CUTOFF_SOFT 0x000A
#define AL_MOD_ENV_TO_FILTER_CUTOFF_SOFT 0x000B
#define AL_PAN_SOFT 0x0011
#define AL_MOD_ENV_DELAYTIME_SOFT 0x0019
#define AL_MOD_ENV_ATTACKTIME_SOFT 0x001A
#define AL_MOD_ENV_HOLDTIME_SOFT 0x001B
@ -73,6 +74,7 @@
#define AL_VOLUME_ENV_KEY_TO_DECAYTIME_SOFT 0x0028
#define AL_KEY_RANGE_SOFT 0x002B
#define AL_VELOCITY_RANGE_SOFT 0x002C
#define AL_ATTENUATION_SOFT 0x0030
#define AL_TUNING_COARSE_SOFT 0x0033
#define AL_TUNING_FINE_SOFT 0x0034
#define AL_LOOP_MODE_SOFT 0x0036

View File

@ -32,6 +32,8 @@ typedef struct ALfontsound {
ALint ModLfoToFilterCutoff;
ALint ModEnvToFilterCutoff;
ALint Pan;
struct {
ALint DelayTime;
ALint AttackTime;
@ -53,6 +55,8 @@ typedef struct ALfontsound {
ALint KeyToDecayTime;
} VolEnv;
ALint Attenuation;
ALint CoarseTuning;
ALint FineTuning;

View File

@ -160,6 +160,10 @@ AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint value)
sound->ModEnvToFilterCutoff = value;
break;
case AL_PAN_SOFT:
sound->Pan = value;
break;
case AL_MOD_ENV_DELAYTIME_SOFT:
sound->ModEnv.DelayTime = value;
break;
@ -210,6 +214,12 @@ AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint value)
sound->VolEnv.KeyToDecayTime = value;
break;
case AL_ATTENUATION_SOFT:
if(!(value >= 0))
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
sound->Attenuation = value;
break;
case AL_TUNING_COARSE_SOFT:
sound->CoarseTuning = value;
break;
@ -348,6 +358,7 @@ AL_API void AL_APIENTRY alFontsoundivSOFT(ALuint id, ALenum param, const ALint *
case AL_FILTER_RESONANCE_SOFT:
case AL_MOD_LFO_TO_FILTER_CUTOFF_SOFT:
case AL_MOD_ENV_TO_FILTER_CUTOFF_SOFT:
case AL_PAN_SOFT:
case AL_MOD_ENV_DELAYTIME_SOFT:
case AL_MOD_ENV_ATTACKTIME_SOFT:
case AL_MOD_ENV_HOLDTIME_SOFT:
@ -364,6 +375,7 @@ AL_API void AL_APIENTRY alFontsoundivSOFT(ALuint id, ALenum param, const ALint *
case AL_VOLUME_ENV_RELEASETIME_SOFT:
case AL_VOLUME_ENV_KEY_TO_HOLDTIME_SOFT:
case AL_VOLUME_ENV_KEY_TO_DECAYTIME_SOFT:
case AL_ATTENUATION_SOFT:
case AL_TUNING_COARSE_SOFT:
case AL_TUNING_FINE_SOFT:
case AL_LOOP_MODE_SOFT:
@ -441,6 +453,10 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val
values[0] = sound->ModEnvToFilterCutoff;
break;
case AL_PAN_SOFT:
values[0] = sound->Pan;
break;
case AL_MOD_ENV_DELAYTIME_SOFT:
values[0] = sound->ModEnv.DelayTime;
break;
@ -501,6 +517,10 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val
values[1] = sound->MaxVelocity;
break;
case AL_ATTENUATION_SOFT:
values[0] = sound->Attenuation;
break;
case AL_TUNING_COARSE_SOFT:
values[0] = sound->CoarseTuning;
break;