Threads with Changed()
-
Does anyone know if Changed is synchronous, or asynchronous? Cheers.
-
-
@clevername27
changed()
is guaranteed to run on the scripting thread. So if you call if from within the scripting thread, it will be synchronous, otherwise it will be asynchronous.You can confirm this by using Perfetto and this snippet
HiseSnippet 1061.3ocsV80aaTDDeOmbErApnn9AXUdgKRVowk1BRHTBwItxJjTKbRD7T0lamK2pb2tm1cuj3Vwa74guB7UA3IdjuAvr6cN24lnjVKgevxy++MyryLdhVECFiRSB5dzrBfD7ogSmIsoCSYBIY7tjfGFd.yXAMsh0NyJXFCvIAAq7RGiftqR7e9ms1gkwjwPCKB4DkHF9AQtv1vcx16KxxFw3vQh7VZ+rsGGqjCUYpRDOqDtIofEeN6L3PlSsNgjfGrGWXU5oVlELnN6n3yllptTVo+IBi3zLvQLfLEcTEaxvTQFex7b0PHAqNoIyWoJyeb3ABt3Z9MUfO2Kf1XQ6ZPPm6BRC9.fTPKHsZEjdT3zXsnv1HwgmOIbrDaHILrT2FJU5R5zYkvgJTCocib14vHMRbsEQuXyM6SwuV+a606IOgNRoiApMEnGLd2wzXVV1oXU2PsJZJqn.jTkzKmUxEJ7WZfwoJsmmwGRg7rZ987Od1fCIfd3bWEY0kfKbX20XoWvzz8kpSGP+N5bbdFXGpxKTRjHZMuz0bVzSHyDRflTJisBkCKdgN6zprn34F0GcaFFkdusWWLqbNSjAzKE1T5DLyAqU0mx3bJ6ZZ5EB3RP22kIRpwxzV2O8NnPqRDXnOqOMUXwvBToxB8Q0TEMRoLImJjlBH1aK0huncH16jHCvzwozDrZs1niOb+edvZdKpHd5ZthrAPXlBZfJreogxhskXgaluS.7060cCq102laCVV9ErxbmUtMLNt9Rz7tPzhUNzKspoGho1qjQ9p2Bgy2E55Mz4ySb03nCXXKVi4gJOZ8F4woL4Y.OxAvdz206IIUt+cjUCmLPeqhcKHz2kgQxx7Sc8vl1uSQbBZwwxG79MVFWUUaonRNVJruBmCpnGox3twM2uu4PLots3FmqQHpp0OL+v5g4oYBNnIBzIeTnuzQ7fudQ3ebwe82aQNd7tLKataPOhQo.zVgKYB1Et.WqVsina3tf4b7UoW25WB3d76MnW0r4ku8rqInv1F6LWo4AdEI4BNOClnLBWou099eGOKTLU7FOxe6i+sW9mu4W2Ju8IABImcU6KDlxjDwU9c43.TtwhXabNthmD7EgGa.Jt4fUlYolyQ+fCRmC7iTd8I2b8HtXVwKyX1E2V6NKUKvA31qHcqAkXhLqMn9.Vgu4ctB+8EhOJbhvFmd6XrysfQ7cv+GXr9v2mEtWRBt.qAfqFN5mV1qb2S3+QUo6dAtCQ6dHDdXY9T7deLfQWJgLz4gAcbSRUza5ncUfofj6I9W7SsvAN5fZgClKDezEqUuNtZ9ycZ8i8bPLI8+Sht3eoAooKN3U8dEuz+533Ec0ML7oKqge0xZ3yVVCe9xZ3KVVC+5k0vu49Mz8Gw99RqJuZrgPNXxd9EkAA6IY3KP+qUx+AH1jXfH
-
@Christoph-Hart Thank you, and what I was hoping. If I could pls ask a follow-up — how would it not be called from the scripting thread?
-
@Christoph-Hart Thank you for the example. I must be doing this wrong…
-
@clevername27 Click once on the power button to start and then again to stop the profiling.
how would it not be called from the scripting thread?
Synth.deferCallbacks(false)
will make the onNoteOn callback run in the audio thread. The other scenario is custom LAF which will be executed synchronously in the UI thread but if you callchanged()
from within a LAF function then you deserve all the pain it brings to you :) -
@Christoph-Hart Understood and thank you. However, when I call
changed()
, execution appears to be asynchronous, and if I call the control callback, explicitly, execution is synchronous. I may have misstated my question. I can upload a screen movie showing a simple example. I will add that I'm doing this during the loading callback with a custom preset manager. (It's not during onInit.)EDIT: I have a movie but the screen movie "exceeds the pixel limit" for an upload. The screen capture is 50% of the built-in display on my Mac laptop.
Somebody please fix the forum. I will help.
-
@Christoph-Hart said in Threads with Changed():
Click once on the power button to start and then again to stop the profiling.
I'm aware lol, it just doesn't seem to work on my end. (But that's a different affair.) Thank you again for taking the time to write that snippet.