Crosstales.RTVoice.Util.Helper Class Reference

Various helper functions. More...

Inheritance diagram for Crosstales.RTVoice.Util.Helper:
Crosstales.Common.Util.BaseHelper

Static Public Member Functions

static Crosstales.RTVoice.Model.Enum.Gender StringToGender (string gender)
 Converts a string to a Gender. More...
 
static Crosstales.RTVoice.Model.Enum.Gender AppleVoiceNameToGender (string voiceName)
 Converts an Apple voice name to a Gender. More...
 
static Crosstales.RTVoice.Model.Enum.Gender WSAVoiceNameToGender (string voiceName)
 Converts an WSA voice name to a Gender. More...
 
static string CleanText (string text, bool removeTags=true, bool clearSpaces=true, bool clearLineEndings=true)
 Cleans a given text to contain only letters or digits. More...
 
static string MarkSpokenText (string[] speechTextArray, int wordIndex, bool markAllSpokenWords=false, string markPrefix="<color=green><b>", string markPostfix="</b></color>")
 Marks the current word or all spoken words from a given text array. More...
 
- Static Public Member Functions inherited from Crosstales.Common.Util.BaseHelper
static string CreateString (string generateChars, int stringLength)
 Creates a string of characters with a given length. More...
 
static System.Collections.Generic.List< string > SplitStringToLines (string text, bool ignoreCommentedLines=true, int skipHeaderLines=0, int skipFooterLines=0)
 Split the given text to lines and return it as list. More...
 
static string FormatBytesToHRF (long bytes, bool useSI=false)
 Format byte-value to Human-Readable-Form. More...
 
static string FormatSecondsToHRF (double seconds)
 Format seconds to Human-Readable-Form. More...
 
static Color HSVToRGB (float h, float s, float v, float a=1f)
 Generate nice HSV colors. Based on https://gist.github.com/rje/6206099 More...
 
static string GenerateLoremIpsum (int length, int minSentences=1, int maxSentences=int.MaxValue, int minWords=1, int maxWords=15)
 Generates a "Lorem Ipsum" based on various parameters. More...
 
static string LanguageToISO639 (SystemLanguage language)
 Converts a SystemLanguage to an ISO639-1 code. Returns "en" if the SystemLanguage could not be converted. More...
 
static SystemLanguage ISO639ToLanguage (string isoCode)
 Converts an ISO639-1 code to a SystemLanguage. Returns SystemLanguage.English if the code could not be converted. More...
 
static object InvokeMethod (string className, string methodName, System.Reflection.BindingFlags flags=System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.Public, params object[] parameters)
 Invokes a method on a full qualified class. More...
 
static string GetArgument (string name)
 Returns an argument for a name from the url or command line. More...
 
static string[] GetArguments ()
 Returns all arguments from the url or command line. More...
 
static System.Collections.Generic.Dictionary< string, System.Collections.Generic.List< string > > ParseJSON (string json)
 Parses a given JSON into a dictionary with key and values Note: this is a very basic implementation for simple JSON-strings - don't expect it to work with complex (e.g. nested) JSONs More...
 

Static Public Attributes

static readonly System.Collections.Generic.Dictionary< int, string > LocaleCodes = new System.Collections.Generic.Dictionary<int, string>(161)
 
static bool hasBuiltInTTS => isWindowsBasedPlatform || isAppleBasedPlatform || isAndroidPlatform || isLinuxPlatform
 Checks if the current platform has built-in TTS. More...
 
- Static Public Attributes inherited from Crosstales.Common.Util.BaseHelper
static bool ApplicationIsPlaying = Application.isPlaying
 
static bool isEditorMode => isEditor && !ApplicationIsPlaying
 Checks if we are in Editor mode. More...
 
static bool isStandalonePlatform => isWindowsPlatform || isMacOSPlatform || isLinuxPlatform
 Checks if the current platform is standalone (Windows, macOS or Linux). More...
 
static bool isWebPlatform => isWebGLPlatform
 Checks if the current platform is Web (WebPlayer or WebGL). More...
 
static bool isWindowsBasedPlatform => isWindowsPlatform || isWSAPlatform || isXboxOnePlatform
 Checks if the current platform is Windows-based (Windows standalone, WSA or XboxOne). More...
 
static bool isWSABasedPlatform => isWSAPlatform || isXboxOnePlatform
 Checks if the current platform is WSA-based (WSA or XboxOne). More...
 
static bool isAppleBasedPlatform => isMacOSPlatform || isIOSPlatform || isTvOSPlatform
 Checks if the current platform is Apple-based (macOS standalone, iOS or tvOS). More...
 
static bool isIOSBasedPlatform => isIOSPlatform || isTvOSPlatform
 Checks if the current platform is iOS-based (iOS or tvOS). More...
 
static bool isMobilePlatform => isAndroidPlatform || isIOSBasedPlatform
 Checks if the current platform is mobile (Android and iOS). More...
 
static bool isEditor => isWindowsEditor || isMacOSEditor || isLinuxEditor
 Checks if we are inside the Editor. More...
 

Properties

static Crosstales.RTVoice.Model.Enum.ProviderType CurrentProviderType [get]
 The current provider type. More...
 
- Properties inherited from Crosstales.Common.Util.BaseHelper
static System.Globalization.CultureInfo BaseCulture [get]
 The current culture of the application. More...
 
static bool isIL2CPP [get]
 Checks if the current build target uses IL2CPP. More...
 
static Crosstales.Common.Model.Enum.PlatformCurrentPlatform [get]
 Returns the current platform. More...
 
static int AndroidAPILevel [get]
 Returns the Android API level of the current device (Android only)". More...
 
static bool isWindowsPlatform [get]
 Checks if the current platform is Windows. More...
 
static bool isMacOSPlatform [get]
 Checks if the current platform is OSX. More...
 
static bool isLinuxPlatform [get]
 Checks if the current platform is Linux. More...
 
static bool isAndroidPlatform [get]
 Checks if the current platform is Android. More...
 
static bool isIOSPlatform [get]
 Checks if the current platform is iOS. More...
 
static bool isTvOSPlatform [get]
 Checks if the current platform is tvOS. More...
 
static bool isWSAPlatform [get]
 Checks if the current platform is WSA. More...
 
static bool isXboxOnePlatform [get]
 Checks if the current platform is XboxOne. More...
 
static bool isPS4Platform [get]
 Checks if the current platform is PS4. More...
 
static bool isWebGLPlatform [get]
 Checks if the current platform is WebGL. More...
 
static bool isWindowsEditor [get]
 Checks if we are inside the Windows Editor. More...
 
static bool isMacOSEditor [get]
 Checks if we are inside the macOS Editor. More...
 
static bool isLinuxEditor [get]
 Checks if we are inside the Linux Editor. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from Crosstales.Common.Util.BaseHelper
static readonly System.Random _rnd = new System.Random()
 

Detailed Description

Various helper functions.

Member Function Documentation

◆ AppleVoiceNameToGender()

static Crosstales.RTVoice.Model.Enum.Gender Crosstales.RTVoice.Util.Helper.AppleVoiceNameToGender ( string  voiceName)
static

Converts an Apple voice name to a Gender.

Parameters
voiceNameVoice name.
Returns
Gender from the given Apple voice name.

◆ CleanText()

static string Crosstales.RTVoice.Util.Helper.CleanText ( string  text,
bool  removeTags = true,
bool  clearSpaces = true,
bool  clearLineEndings = true 
)
static

Cleans a given text to contain only letters or digits.

Parameters
textText to clean.
removeTagsRemoves tags from text (default: true, optional).
clearSpacesClears multiple spaces from text (default: true, optional).
clearLineEndingsClears line endings from text (default: true, optional).
Returns
Clean text with only letters and digits.

◆ MarkSpokenText()

static string Crosstales.RTVoice.Util.Helper.MarkSpokenText ( string[]  speechTextArray,
int  wordIndex,
bool  markAllSpokenWords = false,
string  markPrefix = "<color=green><b>",
string  markPostfix = "</b></color>" 
)
static

Marks the current word or all spoken words from a given text array.

Parameters
speechTextArrayArray with all text fragments
wordIndexCurrent word index
markAllSpokenWordsMark the spoken words (default: false, optional)
markPrefixPrefix for every marked word (default: green, optional)
markPostfixPostfix for every marked word (default: green, optional)
Returns
Marked current word or all spoken words.

◆ StringToGender()

static Crosstales.RTVoice.Model.Enum.Gender Crosstales.RTVoice.Util.Helper.StringToGender ( string  gender)
static

Converts a string to a Gender.

Parameters
genderGender as text.
Returns
Gender from the given string.

◆ WSAVoiceNameToGender()

static Crosstales.RTVoice.Model.Enum.Gender Crosstales.RTVoice.Util.Helper.WSAVoiceNameToGender ( string  voiceName)
static

Converts an WSA voice name to a Gender.

Parameters
voiceNameVoice name.
Returns
Gender from the given WSA voice name.

Member Data Documentation

◆ hasBuiltInTTS

bool Crosstales.RTVoice.Util.Helper.hasBuiltInTTS => isWindowsBasedPlatform || isAppleBasedPlatform || isAndroidPlatform || isLinuxPlatform
static

Checks if the current platform has built-in TTS.

Returns
True if the current platform has built-in TTS.

Property Documentation

◆ CurrentProviderType

Crosstales.RTVoice.Model.Enum.ProviderType Crosstales.RTVoice.Util.Helper.CurrentProviderType
staticget

The current provider type.

Returns
Current provider type.

The documentation for this class was generated from the following file:
  • C:/Users/slaub/Unity/assets/RTVoice/RTVoicePro/Assets/Plugins/crosstales/RTVoice/Scripts/Util/Helper.cs