aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-29 04:24:32 -0800
committerChris Robinson <[email protected]>2013-12-29 04:24:32 -0800
commit699d84491f2f01a95b8210ba7234dcebc8b4f817 (patch)
treed0221554417bb0609988417773e70f5817e145e6 /Alc/midi
parentd030e078790ca24f977a888f53c11c129082abe8 (diff)
Add pan and attenuation properties
Diffstat (limited to 'Alc/midi')
-rw-r--r--Alc/midi/base.c4
-rw-r--r--Alc/midi/fluidsynth.c2
-rw-r--r--Alc/midi/sf2load.c15
3 files changed, 15 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)