aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-12-29 03:43:00 -0800
committerChris Robinson <[email protected]>2013-12-29 03:43:00 -0800
commitd030e078790ca24f977a888f53c11c129082abe8 (patch)
tree5830e47bcd2928e8adfb12ce8588e8ba9d98e8a7
parent1d41122372c821e85a6f150d6435b9c034365e42 (diff)
Add tuning properties
-rw-r--r--Alc/midi/base.c8
-rw-r--r--Alc/midi/fluidsynth.c3
-rw-r--r--Alc/midi/sf2load.c6
-rw-r--r--OpenAL32/Include/alMain.h3
-rw-r--r--OpenAL32/Include/alMidi.h8
-rw-r--r--OpenAL32/alFontsound.c49
6 files changed, 60 insertions, 17 deletions
diff --git a/Alc/midi/base.c b/Alc/midi/base.c
index 19adc810..1a298ba4 100644
--- a/Alc/midi/base.c
+++ b/Alc/midi/base.c
@@ -322,12 +322,18 @@ void ALfontsound_Construct(ALfontsound *self)
self->VolEnv.KeyToHoldTime = 0;
self->VolEnv.KeyToDecayTime = 0;
+ self->CoarseTuning = 0;
+ self->FineTuning = 0;
+
+ self->LoopMode = AL_NONE;
+
+ self->TuningScale = 100;
+
self->Start = 0;
self->End = 0;
self->LoopStart = 0;
self->LoopEnd = 0;
self->SampleRate = 0;
- self->LoopMode = AL_NONE;
self->PitchKey = 0;
self->PitchCorrection = 0;
self->SampleType = AL_NONE;
diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c
index b19cfd03..a32c87c1 100644
--- a/Alc/midi/fluidsynth.c
+++ b/Alc/midi/fluidsynth.c
@@ -186,7 +186,10 @@ 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, 51, sound->CoarseTuning);
+ fluid_voice_gen_set(voice, 52, sound->FineTuning);
fluid_voice_gen_set(voice, 54, sound->LoopMode);
+ fluid_voice_gen_set(voice, 56, sound->TuningScale);
for(m = 0;m < sample->NumMods;m++)
fluid_voice_add_mod(voice, &sample->Mods[m], FLUID_VOICE_OVERWRITE);
diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c
index de238296..ab008d83 100644
--- a/Alc/midi/sf2load.c
+++ b/Alc/midi/sf2load.c
@@ -845,12 +845,12 @@ static void fillZone(ALuint id, const GenModList *zone)
0, /* 48 - initialAttenuation */
0, /* 49 - */
0, /* 50 - endloopAddrCoarseOffset */
- 0, /* 51 - corseTune */
- 0, /* 52 - fineTune */
+ AL_TUNING_COARSE_SOFT, /* 51 - corseTune */
+ AL_TUNING_FINE_SOFT, /* 52 - fineTune */
0, /* 53 - */
AL_LOOP_MODE_SOFT, /* 54 - sampleModes */
0, /* 55 - */
- 0, /* 56 - scaleTuning */
+ AL_TUNING_SCALE_SOFT, /* 56 - scaleTuning */
0, /* 57 - exclusiveClass */
AL_BASE_KEY_SOFT, /* 58 - overridingRootKey */
0, /* 59 - */
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 86eef440..d09bfb08 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -73,7 +73,10 @@
#define AL_VOLUME_ENV_KEY_TO_DECAYTIME_SOFT 0x0028
#define AL_KEY_RANGE_SOFT 0x002B
#define AL_VELOCITY_RANGE_SOFT 0x002C
+#define AL_TUNING_COARSE_SOFT 0x0033
+#define AL_TUNING_FINE_SOFT 0x0034
#define AL_LOOP_MODE_SOFT 0x0036
+#define AL_TUNING_SCALE_SOFT 0x0038
#define AL_LOOP_CONTINUOUS_SOFT 0x0001
#define AL_LOOP_UNTIL_RELEASE_SOFT 0x0003
#define AL_FORMAT_TYPE_SOFT 0x1991
diff --git a/OpenAL32/Include/alMidi.h b/OpenAL32/Include/alMidi.h
index a6e5c0a3..6faf327f 100644
--- a/OpenAL32/Include/alMidi.h
+++ b/OpenAL32/Include/alMidi.h
@@ -53,12 +53,18 @@ typedef struct ALfontsound {
ALint KeyToDecayTime;
} VolEnv;
+ ALint CoarseTuning;
+ ALint FineTuning;
+
+ ALenum LoopMode;
+
+ ALint TuningScale;
+
ALuint Start;
ALuint End;
ALuint LoopStart;
ALuint LoopEnd;
ALuint SampleRate;
- ALenum LoopMode;
ALubyte PitchKey;
ALbyte PitchCorrection;
ALenum SampleType;
diff --git a/OpenAL32/alFontsound.c b/OpenAL32/alFontsound.c
index d5aebb74..3eb6f675 100644
--- a/OpenAL32/alFontsound.c
+++ b/OpenAL32/alFontsound.c
@@ -210,6 +210,24 @@ AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint value)
sound->VolEnv.KeyToDecayTime = value;
break;
+ case AL_TUNING_COARSE_SOFT:
+ sound->CoarseTuning = value;
+ break;
+ case AL_TUNING_FINE_SOFT:
+ sound->FineTuning = value;
+ break;
+
+ case AL_LOOP_MODE_SOFT:
+ if(!(value == AL_NONE || value == AL_LOOP_CONTINUOUS_SOFT ||
+ value == AL_LOOP_UNTIL_RELEASE_SOFT))
+ SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
+ sound->LoopMode = value;
+ break;
+
+ case AL_TUNING_SCALE_SOFT:
+ sound->TuningScale = value;
+ break;
+
case AL_SAMPLE_START_SOFT:
sound->Start = value;
break;
@@ -232,13 +250,6 @@ AL_API void AL_APIENTRY alFontsoundiSOFT(ALuint id, ALenum param, ALint value)
sound->SampleRate = value;
break;
- case AL_LOOP_MODE_SOFT:
- if(!(value == AL_NONE || value == AL_LOOP_CONTINUOUS_SOFT ||
- value == AL_LOOP_UNTIL_RELEASE_SOFT))
- SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
- sound->LoopMode = value;
- break;
-
case AL_BASE_KEY_SOFT:
if(!((value >= 0 && value <= 127) || value == 255))
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
@@ -353,12 +364,15 @@ 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_TUNING_COARSE_SOFT:
+ case AL_TUNING_FINE_SOFT:
+ case AL_LOOP_MODE_SOFT:
+ case AL_TUNING_SCALE_SOFT:
case AL_SAMPLE_START_SOFT:
case AL_SAMPLE_END_SOFT:
case AL_SAMPLE_LOOP_START_SOFT:
case AL_SAMPLE_LOOP_END_SOFT:
case AL_SAMPLE_RATE_SOFT:
- case AL_LOOP_MODE_SOFT:
case AL_BASE_KEY_SOFT:
case AL_KEY_CORRECTION_SOFT:
case AL_SAMPLE_TYPE_SOFT:
@@ -487,6 +501,21 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val
values[1] = sound->MaxVelocity;
break;
+ case AL_TUNING_COARSE_SOFT:
+ values[0] = sound->CoarseTuning;
+ break;
+ case AL_TUNING_FINE_SOFT:
+ values[0] = sound->FineTuning;
+ break;
+
+ case AL_LOOP_MODE_SOFT:
+ values[0] = sound->LoopMode;
+ break;
+
+ case AL_TUNING_SCALE_SOFT:
+ values[0] = sound->TuningScale;
+ break;
+
case AL_SAMPLE_START_SOFT:
values[0] = sound->Start;
break;
@@ -507,10 +536,6 @@ AL_API void AL_APIENTRY alGetFontsoundivSOFT(ALuint id, ALenum param, ALint *val
values[0] = sound->SampleRate;
break;
- case AL_LOOP_MODE_SOFT:
- values[0] = sound->LoopMode;
- break;
-
case AL_BASE_KEY_SOFT:
values[0] = sound->PitchKey;
break;