yncat / temporarySkip

Skip certain phrases for a while
GNU General Public License v2.0
1 stars 1 forks source link

Suggestion for changing method of intercepting speech #4

Open XLTechie opened 2 months ago

XLTechie commented 2 months ago

Hello

I find the concept of this add-on interesting, and am looking forward to using it.

I noticed in the readme that you say that it "hooks" processSpeech. I think you mean speech.processText. But anyway, in the speech History add-on, and my Speech Logger add-on, in the past we always patched the speech.speech.speak function, to do this sort of thing.

These are both kind of risky approaches, as you noted when you said it might interfere with other add-ons.

So I wondered if you noticed the speech module extension point, speech.extensions.filter_speechSequence? It is meant for exactly this kind of thing, and doesn't require patching of any methods.

It is a good idea to get away from patching the speech subsystem when possible.

There may be good reasons not to use the extension point, so this is not a feature request, just an idea. Feel free to close this issue, I just wanted to make you aware if you weren't.

yncat commented 2 months ago

@XLTechie Hi. Yes, I am aware of the extension points. The problem was that I hadn't been able to check if there was an extension point suited for the purpose. Since I wrote this add-on very quickly, I just used the way I was familiar with. What you've suggested is completely right, and you've highlighted the suited extension point. Thanks! I'll try reimplementing using the extension point in a few weeks.