Use text-to-speech for incoming messages
How to synthesize incoming text messages as speech.
阅读时间1 分钟最后更新于 12 天前
After you set up message polling for the Vivox SDK, you receive events whenever the Vivox SDK receives a message.
- When a text channel message is received, the event is raised.
vx_evt_message - When a direct message is received, the event is raised.
vx_evt_user_to_user_message
vx_tts_speaktts_dest_queued_local_playbackcase evt_message:{ vx_evt_message *evt_message = (vx_evt_message *)evt; string sessionHandle = string(evt_message->session_handle); string username; if (evt_message->participant_displayname != NULL) { username = string(evt_message->participant_displayname); } else { username = string("Anonymous"); } string text = username + " says " + string(evt_message->message_body); vx_tts_utterance_id utteranceID; vx_tts_status status = vx_tts_speak(*m_ttsManagerId, m_ttsVoiceID, text.c_str(), tts_dest_queued_local_playback, &utteranceID); break;}