Пример #1
0
    public override void Initialize(SpeechToTextOptions speechToTextOptions)
    {
        if (speechToTextOptions.GetType() == typeof(WindowsSTTOptions))
        {
            windowsSTTOptions = speechToTextOptions as WindowsSTTOptions;

            dictationRecognizer = new DictationRecognizer();
            dictationRecognizer.AutoSilenceTimeoutSeconds = windowsSTTOptions.AutoSilenceTimeoutSeconds;

            dictationRecognizer.DictationResult += (result, confidence) =>
            {
                if (confidence <= windowsSTTOptions.ConfidenceLevel)
                {
                    base.OnSTTResult(new SpeechToTextResultEventArgs(result));
                }
                else
                {
                    Debug.LogWarning("Windows STT Result under confidence level");
                }
            };

            dictationRecognizer.DictationError += (string error, int hresult) =>
            {
                Debug.LogError(error + " " + hresult);
            };
        }
    }
Пример #2
0
    public override void DrawOptions <TOptions>(TOptions serviceOptions)
    {
        windowsSTTOptions = serviceOptions as WindowsSTTOptions;

#if UNITY_EDITOR_WIN
        DrawExplanationBox();

        GUILayout.Space(20);

        DrawConfidenceEnum();

        GUILayout.Space(20);

        DrawAutoSilenceField();
#else
        GUILayout.Label("Service not supported on your platform");
#endif
    }