Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
153 stars 7 forks source link

[Request][All clients] Add a 6th parameter "flags" to C_VoiceChat.SpeakText to pass SAPI flags to SpVoice.Speak #529

Open Duugu opened 4 months ago

Duugu commented 4 months ago

Pain Point

One limitation of C_VoiceChat.SpeakText (https://warcraft.wiki.gg/wiki/API_C_VoiceChat.SpeakText) is that you can't change its behaviour. It simply queues all utterances. This can be useful for "static" outputs like chat. But it doesn't work for "dynamic" outputs, such as a player constantly scrolling rapidly through a menu with many items, where each menu item is read out to the player.

To implement accessible interfaces for the blind, such as the aforementioned "audio menu", we need Sapi to clear the queue before speaking. And we really need Sapi to do asynchronous output. There are literally tons of scenarios where queued output won't work. Think of a blind player entering a new zone and having the zone name read out, and at the same time targeting a mob, having its name and health read out. With just queued outputs that would delay the important and urgent mob name and health output would be delayed after the zone name, leading to an unplayable scenario. So we absolutely need asynchronous tts outputs. To make audio interfaces work for accessibility, asynchronous tts output is a must.

Requested Change

Please add a sixth parameter to C_VoiceChat.SpeakText C_VoiceChat.SpeakText(voiceID, text, destination, rate, volume, flags) to pass flags to SpVoice.Speak.

To meet both requirements real we need to provide flags for SpVoice.Speak.

SpVoice.Speak: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms723609(v=vs.85)

Flags for the second parameter of SpVoice.Speak: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms720892(v=vs.85)

The two important flags are:

SVSFlagsAsync = 1
SVSFPurgeBeforeSpeak = 2

Result

This gives developers the flexibility to implement really useful audio accessibility features for the blind in your game!

Additional comments