aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/midi/fluidsynth.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-01-15 22:18:07 -0800
committerChris Robinson <[email protected]>2014-01-15 22:18:07 -0800
commite118ac93a01c15adee8e6d81a99dda73a985c54d (patch)
treed0629a04fd04ffb8222f2a1001bd8761c8380318 /Alc/midi/fluidsynth.c
parent9ebeae62285092712cc10642802711e7a24b1043 (diff)
Handle fontsound sample types using explicit enum values
Uses AL_MONO_SOFT, AL_RIGHT_SOFT, and AL_LEFT_SOFT. "Linked" samples types aren't explicitly supported due to being under-defined in the SF2 spec, nor are ROM samples currently.
Diffstat (limited to 'Alc/midi/fluidsynth.c')
-rw-r--r--Alc/midi/fluidsynth.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c
index c32d2fb1..0e3ddd6d 100644
--- a/Alc/midi/fluidsynth.c
+++ b/Alc/midi/fluidsynth.c
@@ -124,6 +124,17 @@ static int getSf2LoopMode(ALenum mode)
return 0;
}
+static int getSampleType(ALenum type)
+{
+ switch(type)
+ {
+ case AL_MONO_SOFT: return FLUID_SAMPLETYPE_MONO;
+ case AL_RIGHT_SOFT: return FLUID_SAMPLETYPE_RIGHT;
+ case AL_LEFT_SOFT: return FLUID_SAMPLETYPE_LEFT;
+ }
+ return FLUID_SAMPLETYPE_MONO;
+}
+
typedef struct FSample {
DERIVE_FROM_TYPE(fluid_sample_t);
@@ -144,7 +155,7 @@ static void FSample_Construct(FSample *self, ALfontsound *sound, ALsoundfont *sf
sample->samplerate = sound->SampleRate;
sample->origpitch = sound->PitchKey;
sample->pitchadj = sound->PitchCorrection;
- sample->sampletype = sound->SampleType;
+ sample->sampletype = getSampleType(sound->SampleType);
sample->valid = 1;
sample->data = sfont->Samples;