jcsteh / osara

OSARA: Open Source Accessibility for the REAPER Application
GNU General Public License v2.0
127 stars 46 forks source link

API osara_outputMessage performs are silent when REAPER overloaded a bit #1028

Open outsidepro-arts opened 5 months ago

outsidepro-arts commented 5 months ago

Hello all! I've updated OSARA at yesterday to version 2024.3.13.1359,52099010 and noticed that my scripts complex may silent a few times in a row when I'd loaded serious project which may overload my machine over 50 percent. My script is using reaper.osara_outputMessage and I did change nothing in speech mechanism at last time. I haven't experienced this bug when I have used 2023.1pre-1223,0e013cbe. I cannot provide any extra information because it has no any logic patterns.

jcsteh commented 5 months ago

I haven't changed anything fundamental in how osara_outputMessage works in a long time. That said, do you have the action OSARA: Mute next message in any of your scripts or custom actions?

outsidepro-arts commented 5 months ago

No, I don't have there. It looks like UIA notifications are working glitchy.

jcsteh commented 5 months ago

I don't really know how to diagnose this. It really depends on what your scripts are doing. Perhaps you can explain what your script does and exactly what happens, step by step.

I believe that if the UI becomes unresponsive, Windows might choose to drop some (if not all) UI Automation events in some cases. That might have some relevance here.

outsidepro-arts commented 5 months ago

The scripts complex implements pseudoGUI. There's message accumulator which outputs when action performs at the child module's side. The API function calls once per script performing (because it is not possible to queue messages), but every time when user performs either navigational or adjusting actions. It was works at osara_2023.1pre-1223,0e013cbe.

jcsteh commented 5 months ago

Sorry, but that doesn't help me at all. I need to understand what the script does, what you're doing with it, when it uses osara_outputMessage, etc. As I said, I don't know of any changes to osara_outputMessage that should have any impact at all here. That code hasn't been changed in years.

outsidepro-arts commented 5 months ago

More detailed you may see at https://github.com/outsidepro-arts/Properties_Ribbon Please note that I've made a huge changes recently, so WIKI still didn't updated.

jcsteh commented 5 months ago

I don't have time to read through an entire script to understand the sequence of events here. What exactly happens? Does your script respond immediately to a key press by speaking a message or does it do a bunch of extra, time consuming work in the middle? Does it open any dialogs at any point? Does it ever call osara_outputMessage multiple times in quick succession? Those are the kinds of questions you need to answer in order for me to have any chance of diagnosing this.

outsidepro-arts commented 5 months ago

I've answered these question shortly. It performs osara_outputMessage once by script performing. Of course, there're many code performs but they're not have nothing to OSARA (it works with REAPER API). For now I've downgraded to osara_2023.1pre-1223,0e013cbe and it works correctly.

jcsteh commented 5 months ago

Fair enough. Well, I don't have sufficient info to diagnose this as it stands, so I guess we'll just leave it open and see if something comes to light.

outsidepro-arts commented 5 months ago

Might the following commit to make this problem?

Revision: 0c96be2e0b85fcfd5200309848447af7cc530284
Author: James Teh <jamie@jantrid.net>
Date: 08.03.2024 15:06:26
Message:
Fix OSARA toggle actions triggered from custom actions. (#914)

Actions triggered by custom actions go through the handleMainCommandFallback function.
Previously, handleMainCommandFallback didn't call handleSettingCommand, which meant that OSARA setting actions were just ignored.
To fix this, the handleMainCommandFallback function now calls handleCommand.
This also simplifies things and removes a bunch of code duplication.

I see the time rely process here, and may assume that the mute next message calls at some times while. If I can build the project on my own before this commit, I will test this. But I have not enough knowledge in MSVC Build.

jcsteh commented 5 months ago

Yeah, that's why I asked if you use mute next message at any point. If you do, these commits would be a good place to start, since they do slightly change the way mute next message works. But if you don't, I don't see how that could be the problem.

outsidepro-arts commented 5 months ago

But my scripts do not contains the muting next messages cases at least in where this bug has watched.

outsidepro-arts commented 5 months ago

So, I've tested more time the last build and found the pattern when this bug goes. The actions non-reporting happen when actions procedure takes more time which OSARA (or something else in OSARA thread) expects. A striking example of this we might see when we're opening the media explorer: while the media explorer opened, OSARA silents alltime. Every actions states are not reported. The same happens when REAPER overloaded by some massive computations and action's state applies slowly. Unfortunately I have not enough of time to check every commit build to watch the exact commit which caused this problem...

jcsteh commented 5 months ago

Opening the Media Explorer opens a new window and focuses it. I'm wondering whether the announcement of the window simply overrides the OSARA message, which can happen if the OSARA message tries to speak first.