Fix TTS Talking every button press
This commit is contained in:
parent
c7a6daf1a0
commit
d6eb8440bd
37
DllMain.cpp
37
DllMain.cpp
@ -2038,26 +2038,29 @@ DWORD WINAPI AdjustFFBStrengthLoop(LPVOID lpParam)
|
|||||||
|
|
||||||
if (EnableFFBStrengthTextToSpeech == 1)
|
if (EnableFFBStrengthTextToSpeech == 1)
|
||||||
{
|
{
|
||||||
if (AlternativeFFB == 1)
|
if ((e.jbutton.button == IncreaseFFBStrength) || (e.jbutton.button == DecreaseFFBStrength) || (e.jbutton.button == ResetFFBStrength))
|
||||||
{
|
{
|
||||||
sprintf(FFBStrength1, "Max Force: %d", configAlternativeMaxForceRight);
|
if (AlternativeFFB == 1)
|
||||||
}
|
{
|
||||||
else
|
sprintf(FFBStrength1, "Max Force: %d", configAlternativeMaxForceRight);
|
||||||
{
|
}
|
||||||
sprintf(FFBStrength1, "Max Force: %d", configMaxForce);
|
else
|
||||||
}
|
{
|
||||||
|
sprintf(FFBStrength1, "Max Force: %d", configMaxForce);
|
||||||
|
}
|
||||||
|
|
||||||
hr = ::CoInitialize(nullptr);
|
hr = ::CoInitialize(nullptr);
|
||||||
hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
|
hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
|
||||||
mbstowcs(FFBStrength2, FFBStrength1, strlen(FFBStrength1) + 1);
|
mbstowcs(FFBStrength2, FFBStrength1, strlen(FFBStrength1) + 1);
|
||||||
LPWSTR ptr = FFBStrength2;
|
LPWSTR ptr = FFBStrength2;
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = cpVoice->SetRate(3);
|
hr = cpVoice->SetRate(3);
|
||||||
hr = cpVoice->SetOutput(NULL, TRUE);
|
hr = cpVoice->SetOutput(NULL, TRUE);
|
||||||
hr = cpVoice->Speak(ptr, SPF_PURGEBEFORESPEAK, NULL);
|
hr = cpVoice->Speak(ptr, SPF_PURGEBEFORESPEAK, NULL);
|
||||||
::CoUninitialize();
|
::CoUninitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user