aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index f9a9ff2e..fbac9db2 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -870,6 +870,11 @@ static __inline ALfloat lerp(ALfloat val1, ALfloat val2, ALint frac)
{
return val1 + ((val2-val1)*(frac * (1.0f/(1<<FRACTIONBITS))));
}
+static __inline ALfloat cos_lerp(ALfloat val1, ALfloat val2, ALint frac)
+{
+ ALfloat mult = (1.0f-cos(frac * (1.0f/(1<<FRACTIONBITS)) * M_PI)) * 0.5f;
+ return val1 + ((val2-val1)*mult);
+}
static void MixSomeSources(ALCcontext *ALContext, float (*DryBuffer)[OUTPUTCHANNELS], ALuint SamplesToDo)
{
@@ -1106,6 +1111,8 @@ another_source:
break;
case LINEAR: DO_MIX(lerp);
break;
+ case COSINE: DO_MIX(cos_lerp);
+ break;
case RESAMPLER_MAX:
break;
}
@@ -1153,6 +1160,8 @@ another_source:
break;
case LINEAR: DO_MIX(lerp);
break;
+ case COSINE: DO_MIX(cos_lerp);
+ break;
case RESAMPLER_MAX:
break;
}
@@ -1171,6 +1180,8 @@ another_source:
break;
case LINEAR: DO_MIX(lerp);
break;
+ case COSINE: DO_MIX(cos_lerp);
+ break;
case RESAMPLER_MAX:
break;
}
@@ -1190,6 +1201,8 @@ another_source:
break;
case LINEAR: DO_MIX(lerp);
break;
+ case COSINE: DO_MIX(cos_lerp);
+ break;
case RESAMPLER_MAX:
break;
}
@@ -1210,6 +1223,8 @@ another_source:
break;
case LINEAR: DO_MIX(lerp);
break;
+ case COSINE: DO_MIX(cos_lerp);
+ break;
case RESAMPLER_MAX:
break;
}
@@ -1230,6 +1245,8 @@ another_source:
break;
case LINEAR: DO_MIX(lerp);
break;
+ case COSINE: DO_MIX(cos_lerp);
+ break;
case RESAMPLER_MAX:
break;
}