Commit 4cf2ad98 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

dinput: Don't give up if we can't translate the effect envelope.

Based on ideas by Elias Vanderstuyft. Signed-off-by: 's avatarBruno Jesus <00cpxxx@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 79b5883f
...@@ -557,30 +557,36 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters( ...@@ -557,30 +557,36 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
This->effect.replay.length = 1; This->effect.replay.length = 1;
} }
if (dwFlags & DIEP_ENVELOPE) { if (dwFlags & DIEP_ENVELOPE)
{
struct ff_envelope* env; struct ff_envelope* env;
if (This->effect.type == FF_CONSTANT) env = &This->effect.u.constant.envelope; if (This->effect.type == FF_CONSTANT)
else if (This->effect.type == FF_PERIODIC) env = &This->effect.u.periodic.envelope; env = &This->effect.u.constant.envelope;
else if (This->effect.type == FF_RAMP) env = &This->effect.u.ramp.envelope; else if (This->effect.type == FF_PERIODIC)
else env = NULL; env = &This->effect.u.periodic.envelope;
else if (This->effect.type == FF_RAMP)
if (peff->lpEnvelope == NULL) { env = &This->effect.u.ramp.envelope;
/* if this type had an envelope, reset it */ else
if (env) { env = NULL;
env->attack_length = 0;
env->attack_level = 0; /* copy the envelope if it is present and the linux effect supports it */
env->fade_length = 0; if (peff->lpEnvelope && env)
env->fade_level = 0; {
} env->attack_length = peff->lpEnvelope->dwAttackTime / 1000;
} else { env->attack_level = (peff->lpEnvelope->dwAttackLevel / 10) * 32;
/* did we get passed an envelope for a type that doesn't even have one? */ env->fade_length = peff->lpEnvelope->dwFadeTime / 1000;
if (!env) return DIERR_INVALIDPARAM; env->fade_level = (peff->lpEnvelope->dwFadeLevel / 10) * 32;
/* copy the envelope */ }
env->attack_length = peff->lpEnvelope->dwAttackTime / 1000; /* if the dinput envelope is NULL we will clear the linux envelope */
env->attack_level = (peff->lpEnvelope->dwAttackLevel / 10) * 32; else if (env)
env->fade_length = peff->lpEnvelope->dwFadeTime / 1000; {
env->fade_level = (peff->lpEnvelope->dwFadeLevel / 10) * 32; env->attack_length = 0;
} env->attack_level = 0;
env->fade_length = 0;
env->fade_level = 0;
}
else
WARN("Ignoring dinput envelope not supported in the linux effect\n");
} }
/* Gain and Sample Period settings are not supported by the linux /* Gain and Sample Period settings are not supported by the linux
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment