Skip to content

Commit

Permalink
Added speaking capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
66Bunz committed Oct 29, 2023
1 parent 5bbcb45 commit ef43448
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 2 deletions.
Binary file modified Config/MainConfig.inc
Binary file not shown.
Binary file modified CustomApp.ini
Binary file not shown.
Binary file modified Folder/Config/FolderConfig.inc
Binary file not shown.
Binary file modified Images/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/PreviewImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/RMSKIN.bmp
Binary file not shown.
Binary file modified Images/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/copy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/speaker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 39 additions & 2 deletions Scripts/Translate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,46 @@ function Translate {
$Response = Invoke-RestMethod -Uri $Uri -Method Get
$Translation = $Response[0].SyncRoot | ForEach-Object { $_[0] }

$RmAPI.Bang('!SetVariable Translation1 "'+$Translation+'"')
$RmAPI.Bang('!WriteKeyValue Variables Translation1 "'+$Translation+'" "'+$VarsLocation+'"')
$RmAPI.Bang('!SetVariable Translation1 "' + $Translation + '"')
$RmAPI.Bang('!WriteKeyValue Variables Translation1 "' + $Translation + '" "' + $VarsLocation + '"')
$RmAPI.Bang('!SetVariable CopyActive 1')
$RmAPI.Bang('!UpdateMeter *')
$RmAPI.Bang('!Update')
}

function Listen {
$Translation = $RmAPI.OptionStr('Translation')
$TargetLanguage = $RmAPI.OptionStr('TargetLanguage')

$targetCulture = @{
'en' = 'en-US'
'fr' = 'fr-FR'
'de' = 'de-DE'
'es' = 'es-ES'
'it' = 'it-IT'
'pt' = 'pt-PT'
'ru' = 'ru-RU'
'ja' = 'ja-JP'
'zh' = 'zh-CN'
}
$targetCultureCode = $targetCulture[$TargetLanguage]

if (!$targetCultureCode) {
$targetCultureCode = 'en-US'
Write-Host "Invalid target language."
}

Add-Type -AssemblyName System.Speech
$SpeechSynthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer

$targetVoice = $SpeechSynthesizer.GetInstalledVoices() | Where-Object { $_.VoiceInfo.Culture.Name -eq $targetCultureCode }

if (!$targetVoice) {
Write-Host "Target voice not found. Falling back to English."
$targetCultureCode = 'en-US'
$targetVoice = $SpeechSynthesizer.GetInstalledVoices() | Where-Object { $_.VoiceInfo.Culture.Name -eq $targetCultureCode }
}

$SpeechSynthesizer.SelectVoice($targetVoice.VoiceInfo.Name)
$SpeechSynthesizer.Speak($Translation)
}
Binary file modified Settings/Config/MainConfig.inc
Binary file not shown.
Binary file modified Settings/Folder/Config/FolderConfig.inc
Binary file not shown.
Binary file modified Variables/VariablesData.inc
Binary file not shown.

0 comments on commit ef43448

Please sign in to comment.