New script = new message thread?
-
@Christoph-Hart Thanks for the clarification.
Yeah, I thought of adding such a cancel button, but, while my loop is running, I have access to nothing. No button, no graphic stuff... In fact, even the progress bar wouldn't move with a paint routine, so I had to make a hidden panel that changes its position...The loop in question is a correlation algorithm, hence making a nested loop onto a selection on my almost "1sec" sample array/buffer. So this nested loop is taking full focus of the interface until it is done. and sliding the progress bar/panel is the only thing that works during this time. Meters are freezing too of course.
-
@Christoph-Hart What if I put the heavy stuff in the audio thread, knowing that I don't use it at computation time?
Can this cause drop-outs for other applications?It is probably not possible, but having a lower priority thread just for heavy stuff would be cool.. Then we could use a timer to checks when it is done, and nothing is going back and forth between the threads, except a global flag.
How other applications are working then? When their interface doesn't freeze during heavy computation? Don't have examples but, be it audio, graphics or data computing, they exists.
-
I have a question, slightly related to this thread stuff I think...
I have a panel with a preload callback, in that callback I start a timer, which repaints the panel to create a preload animation. By starting the timer manually I see the animation play, but when the preloader starts the timer the animation freezes after one frame until the loading is complete. How can I get my animation to play while the samples are loaded?
This is almost the script I'm using
sofiawoodwinds/Scripts/preloadBar.js at master · davidhealey/sofiawoodwinds
Contribute to davidhealey/sofiawoodwinds development by creating an account on GitHub.
GitHub (github.com)
-
@d-healey This is kind of exactly the issue I have...
I came up with simply moving the panel's position instead of updating its paint routine.
As Chris said, the paint routine has a lower priority, so it will repaint only when the highest priority things are done.
But moving a component works, it certainly has a higher priority over a paint routine AND the sample loading or other heavy functions like in my case... Which is weird, because it is still the script thread that moves the component -
@ustk said in New script = new message thread?:
As Chris said, the paint routine has a lower priority,
But the code I'm using is Christoph's :cat_face_with_tears_of_joy:
-
@d-healey And my solution might not work in your case. Because on my side, the heavy stuff is in the same script thread. But in your case, it is a higher priority one. Test and report :)
-
@ustk It won't work for me because I need to repaint things (that script I linked too is not 100% the same as the one I'm using).
-
I assume the new BackgroundTask class is related to this thread? Can it be used to solve my preloader issue? I found an old old forum post where someone had the same issue.
-
@d-healey Yeah it is totally related. If I can build I'm trying today ;)
-
@d-healey I think there‘s a glitch that prevents the timer from being started in your case so spawning another thread won‘t solve it.
Is this reproducable with the code you‘ve linked?
-
@christoph-hart I'll check and make a snippet
-
The above preloadBar code works. I've figured it's something to do with my paint routine, it has a loop in it so I'm investigating that angle now.
-
Is there a way I can trigger the preload callback for testing purposes without just switching sample maps?
-
@ustk said in New script = new message thread?:
@d-healey
Yeah it is totally related.Sorry for misleading you!
-
@ustk said in New script = new message thread?:
@ustk said in New script = new message thread?:
@d-healey
Yeah it is totally related.Sorry for misleading you!
Actually I think it is related, but in a different way. I made another project to test my preload animation and it works fine. I did some more tests in my main project and I think it's because I'm doing other things when the preset loads, those things are "blocking" the animation. So I'm thinking if I move those things to a background task it might solve it.
-
I finally solved my preload issue. Not 100% sure what is causing it but moving my sample loading into the post preset callback made it work.