diff options
author | Chris Robinson <[email protected]> | 2013-12-29 04:24:32 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-12-29 04:24:32 -0800 |
commit | 699d84491f2f01a95b8210ba7234dcebc8b4f817 (patch) | |
tree | d0221554417bb0609988417773e70f5817e145e6 | |
parent | d030e078790ca24f977a888f53c11c129082abe8 (diff) |
Add pan and attenuation properties
-rw-r--r-- | Alc/midi/base.c | 4 | ||||
-rw-r--r-- | Alc/midi/fluidsynth.c | 2 | ||||
-rw-r--r-- | Alc/midi/sf2load.c | 15 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alMidi.h | 4 | ||||
-rw-r--r-- | OpenAL32/alFontsound.c | 20 |
6 files changed, 41 insertions, 6 deletions
diff --git a/Alc/midi/base.c b/Alc/midi/base.c index 1a298ba4..1c6a2fcf 100644 --- a/Alc/midi/base.c +++ b/Alc/midi/base.c @@ -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; diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c index a32c87c1..3d3338dc 100644 --- a/Alc/midi/fluidsynth.c +++ b/Alc/midi/fluidsynth.c @@ -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); diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c index ab008d83..931b5945 100644 --- a/Alc/midi/sf2load.c +++ b/Alc/midi/sf2load.c @@ -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) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index d09bfb08..1fe6b7e7 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -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 diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h index 6faf327f..47b159ba 100644 --- a/OpenAL32/Include/alMidi.h +++ b/OpenAL32/Include/alMidi.h @@ -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; diff --git a/OpenAL32/alFontsound.c b/OpenAL32/alFontsound.c index 3eb6f675..c5b04970 100644 --- a/OpenAL32/alFontsound.c +++ b/OpenAL32/alFontsound.c @@ -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; |