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); }
private void IsCompleted(string message, NameValueCollection query) { MagicRoomManager.instance.Logger.AddToLogNewLine("ServerTTSO", "endplay"); isPlaying = false; EndSpeak?.Invoke(); }