VoiceAttack

Profiles, Commands and Plugins => Profile and Command Discussions => Topic started by: Serge on March 23, 2024, 07:51:56 AM

Title: How intercept the release key event for the "Recognition Global Hotkey"
Post by: Serge on March 23, 2024, 07:51:56 AM
Hi again,

So i have set a key in the "Recognition Global Key" with the "VoiceAttack Listens while keys are down" option.
This is to be in "push to talk" mode.

Is there a way for me to know when the key is released ?

Indeed, since it is the responsibility of the plugin to aggregate the audio files generated during the pressing of this key, I need to know when to stop the aggregation.

I could do this with a timeout after which, if I have not received any audio, I stop aggregating. But this is a solution that has significant disadvantages. If the timeout is too long, it will be a waste of time at the end of each sentence. If it is too short, the user will still be cut off in their sentence.

Thank you in advance for any responses.


Title: Re: How intercept the release key event for the "Recognition Global Hotkey"
Post by: Pfeil on March 23, 2024, 07:59:00 AM
There are a number of ways to accomplish that, E.G. polling the listening state or the state of the key (both of which can be done within the plugin, and thus wouldn't require any commands), or assigning a command (or two) to the same key and having it call your plugin.
Title: Re: How intercept the release key event for the "Recognition Global Hotkey"
Post by: Serge on March 23, 2024, 08:29:25 AM
Hello,

Yes thanks you very much.

I'v just find another solution by setting an action with the same key but with the option "Shortcut is invoked only when all keys are released".

Do you think it's ok to do that ? i mean, the "all keys are released" condition apply only for the involved key, as the tooltips says ?

Thanks.
Title: Re: How intercept the release key event for the "Recognition Global Hotkey"
Post by: Pfeil on March 23, 2024, 08:58:26 AM
That's exactly what I was referring to by "assigning a command (or two) to the same key and having it call your plugin"

"Shortcut is invoked only when all keys are released" refers to all keys in the combination for that specific command.