# 取消文本转语音消息

> Cancel a queued text-to-speech message.

要取消当前正在播放或已排队的文本转语音 (TTS) 消息，请将 `VivoxService.Instance.TextToSpeechCancelMessages()` 或 `VivoxService.Instance.TextToSpeechCancelAllMessages()` 与要取消的 TTS 消息结合使用。还可以对任何 ITTS 消息集合使用 `Dequeue()` 方法，以取消队列头部的消息。

以前说过的任何 TTSMessage 对象都可以使用 `VivoxService.Instance.TextToSpeechCancelMessages()` 直接取消。以下示例进行了详细说明：

```cs
VivoxService.Instance.TextToSpeechSendMessage()
```

在包含队列的目标中，取消正在进行的 TTS 消息将自动触发下一条消息的播放。取消已排队的 TTS 消息会将队列中的所有后续消息上移一个位置。

可以取消一个目标中的所有 TTS 消息（正在进行和已排队的）或所有目标中的所有 TTS 消息。

```cs
// Cancel all TTS messages in the destination for Queued Local Playback
VivoxService.Instance.TextToSpeechCancelMessages(TextToSpeechMessageType);

// Cancel all TTS messages in all destinations
VivoxService.Instance.TextToSpeechCancelAllMessages();
```
