aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/midi')
-rw-r--r--Alc/midi/fluidsynth.c13
-rw-r--r--Alc/midi/sf2load.c30
2 files changed, 30 insertions, 13 deletions
diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c
index cef00ed0..c32d2fb1 100644
--- a/Alc/midi/fluidsynth.c
+++ b/Alc/midi/fluidsynth.c
@@ -113,6 +113,17 @@ static enum fluid_gen_type getSf2Gen(ALenum gen)
return 0;
}
+static int getSf2LoopMode(ALenum mode)
+{
+ switch(mode)
+ {
+ case AL_NONE: return 0;
+ case AL_LOOP_CONTINUOUS_SOFT: return 1;
+ case AL_LOOP_UNTIL_RELEASE_SOFT: return 3;
+ }
+ return 0;
+}
+
typedef struct FSample {
DERIVE_FROM_TYPE(fluid_sample_t);
@@ -313,7 +324,7 @@ static int FPreset_noteOn(fluid_preset_t *preset, fluid_synth_t *synth, int chan
fluid_voice_gen_set(voice, GEN_ATTENUATION, sound->Attenuation);
fluid_voice_gen_set(voice, GEN_COARSETUNE, sound->CoarseTuning);
fluid_voice_gen_set(voice, GEN_FINETUNE, sound->FineTuning);
- fluid_voice_gen_set(voice, GEN_SAMPLEMODE, sound->LoopMode);
+ fluid_voice_gen_set(voice, GEN_SAMPLEMODE, getSf2LoopMode(sound->LoopMode));
fluid_voice_gen_set(voice, GEN_SCALETUNE, sound->TuningScale);
fluid_voice_gen_set(voice, GEN_EXCLUSIVECLASS, sound->ExclusiveClass);
for(m = 0;m < sample->NumMods;m++)
diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c
index 318b9547..747b340f 100644
--- a/Alc/midi/sf2load.c
+++ b/Alc/midi/sf2load.c
@@ -763,6 +763,14 @@ static ALenum getModTransOp(int op)
return AL_INVALID;
}
+static ALenum getLoopMode(int mode)
+{
+ if(mode == 0) return AL_NONE;
+ if(mode == 1) return AL_LOOP_CONTINUOUS_SOFT;
+ if(mode == 3) return AL_LOOP_UNTIL_RELEASE_SOFT;
+ ERR("Unhandled loop mode: %d\n", mode);
+ return AL_NONE;
+}
static void fillZone(ALfontsound *sound, ALCcontext *context, const GenModList *zone)
{
@@ -909,10 +917,7 @@ static void fillZone(ALfontsound *sound, ALCcontext *context, const GenModList *
else if(param == AL_CHORUS_SEND_SOFT || param == AL_REVERB_SEND_SOFT)
value = clampi(value, 0, 1000);
else if(param == AL_LOOP_MODE_SOFT)
- {
- if(!(value == 0 || value == 1 || value == 3))
- value = 0;
- }
+ value = getLoopMode(value);
ALfontsound_setPropi(sound, context, param, value);
}
else if(gen->mGenerator < 256)
@@ -1016,14 +1021,15 @@ static void processInstrument(ALfontsound ***sounds, ALsizei *sounds_size, ALCco
break;
(*sounds)[*sounds_size] = NewFontsound(context);
- (*sounds)[*sounds_size]->Start = samp->mStart;
- (*sounds)[*sounds_size]->End = samp->mEnd;
- (*sounds)[*sounds_size]->LoopStart = samp->mStartloop;
- (*sounds)[*sounds_size]->LoopEnd = samp->mEndloop;
- (*sounds)[*sounds_size]->SampleRate = samp->mSampleRate;
- (*sounds)[*sounds_size]->PitchKey = samp->mOriginalKey;
- (*sounds)[*sounds_size]->PitchCorrection = samp->mCorrection;
- (*sounds)[*sounds_size]->LoopMode = (samp->mSampleType&0x7ffff);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_SAMPLE_START_SOFT, samp->mStart);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_SAMPLE_END_SOFT, samp->mEnd);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_SAMPLE_LOOP_START_SOFT, samp->mStartloop);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_SAMPLE_LOOP_END_SOFT, samp->mEndloop);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_SAMPLE_RATE_SOFT, samp->mSampleRate);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_BASE_KEY_SOFT, samp->mOriginalKey);
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_KEY_CORRECTION_SOFT, samp->mCorrection);
+ if(samp->mSampleType == 1 || samp->mSampleType == 2 || samp->mSampleType == 4)
+ ALfontsound_setPropi((*sounds)[*sounds_size], context, AL_SAMPLE_TYPE_SOFT, samp->mSampleType);
fillZone((*sounds)[*sounds_size], context, &lzone);
(*sounds_size)++;