Add Text to Speech for FFB Strength Adjustment
This commit is contained in:
parent
301daf6bc1
commit
580f3cd6a6
@ -52,12 +52,8 @@ ResetFFBStrength=
|
||||
; Step is the amount to adjust when increasing or decreasing per button where FFB strength is represented on
|
||||
; a scale of 0-100.
|
||||
StepFFBStrength=5
|
||||
; Set to 1 if you want FFB strength adjustments to persist between loads, else 0.
|
||||
EnablePersistentMaxForce=0
|
||||
; 0-100: the previous max force strength set if persistence is enabled. -1 means this has not yet been saved.
|
||||
PersistentMaxForce=-1
|
||||
PersistentAlternativeMaxForceLeft=1
|
||||
PersistentAlternativeMaxForceRight=-1
|
||||
; Set to 1 if you want FFB strength adjustments text to speech over speaker
|
||||
EnableFFBStrengthTextToSpeech=0
|
||||
|
||||
; ***********************************************************************************************************************************
|
||||
; ************************************************ Game overrides are specified below ***********************************************
|
||||
|
32
DllMain.cpp
32
DllMain.cpp
@ -25,6 +25,8 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <thread>
|
||||
#include "IDirectInputDevice.h"
|
||||
#include <d3d11.h>
|
||||
#include <sapi.h>
|
||||
#include <atlbase.h>
|
||||
|
||||
#include "Config/PersistentValues.h"
|
||||
|
||||
@ -927,11 +929,17 @@ int IncreaseFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseF
|
||||
int DecreaseFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("DecreaseFFBStrength"), NULL, settingsFilename);
|
||||
int ResetFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ResetFFBStrength"), NULL, settingsFilename);
|
||||
int StepFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("StepFFBStrength"), 5, settingsFilename);
|
||||
int EnableFFBStrengthTextToSpeech = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthTextToSpeech"), 0, settingsFilename);
|
||||
|
||||
extern void DefaultConfigValues();
|
||||
extern void CustomFFBStrengthSetup();
|
||||
|
||||
char chainedDLL[256];
|
||||
static char FFBStrength1[256];
|
||||
static wchar_t FFBStrength2[256];
|
||||
|
||||
HRESULT hr;
|
||||
CComPtr<ISpVoice> cpVoice;
|
||||
|
||||
const int TEST_GAME_CONST = -1;
|
||||
const int TEST_GAME_SINE = -2;
|
||||
@ -2020,6 +2028,30 @@ DWORD WINAPI AdjustFFBStrengthLoop(LPVOID lpParam)
|
||||
DefaultConfigValues();
|
||||
WritePersistentMaxForce();
|
||||
}
|
||||
|
||||
if (EnableFFBStrengthTextToSpeech == 1)
|
||||
{
|
||||
if (AlternativeFFB == 1)
|
||||
{
|
||||
sprintf(FFBStrength1, "Max Force: %d", configAlternativeMaxForceRight);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(FFBStrength1, "Max Force: %d", configMaxForce);
|
||||
}
|
||||
|
||||
hr = ::CoInitialize(nullptr);
|
||||
hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
|
||||
mbstowcs(FFBStrength2, FFBStrength1, strlen(FFBStrength1) + 1);
|
||||
LPWSTR ptr = FFBStrength2;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = cpVoice->SetOutput(NULL, TRUE);
|
||||
hr = cpVoice->Speak(ptr, SPF_PURGEBEFORESPEAK, NULL);
|
||||
::CoUninitialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user