예제 #1
0
    public bool GenerateAudioFromText(string text, Voices voice)
    {
        if (isPlaying || voice == null)
        {
            return(false);
        }
        SpeachToTextCommand command = new SpeachToTextCommand
        {
            action          = "speechSynthesis",
            activityAddress = MagicRoomManager.instance.HttpListenerForMagiKRoom.Address + ":" + MagicRoomManager.instance.HttpListenerForMagiKRoom.Port + "/" + endpoint,
            text            = text,
            voice           = voice.name
        };

        MagicRoomManager.instance.Logger.AddToLogNewLine("ServerTTSO", text + "," + voice.name + " started");
        StartCoroutine(SendCommand(command, (body) => {
            isPlaying = true;
            StartSpeak?.Invoke();
        }, () =>
        {
            StartSpeak?.Invoke();
            EndSpeak?.Invoke();
            isPlaying = false;
        }));
        return(true);
    }
예제 #2
0
 private void IsCompleted(string message, NameValueCollection query)
 {
     MagicRoomManager.instance.Logger.AddToLogNewLine("ServerTTSO", "endplay");
     isPlaying = false;
     EndSpeak?.Invoke();
 }