MS3 plugin error trying to use window.setTimeout
This gives error, "ReferenceError: window is not defined", so how do I reference the setTimeout() method from within a MS3 plugin?
This gives error, "ReferenceError: window is not defined", so how do I reference the setTimeout() method from within a MS3 plugin?
Do you still have an unanswered question? Please log in first to post your question.
Comments
Please try Timer component https://musescore.org/en/node/320673#s52
In reply to Please try Timer component… by msfp
Thanks. It looks a bit cryptic but I'll give it a try.
In reply to Please try Timer component… by msfp
I've got the code working but it stops on the second score.
The idea is to make a JukeBox of scores based on a master score of snippets:
The stave texts on the right give the score filename, (in current folder), and the number of seconds to play.
The loader correctly loads information for these 2 scores and presents the play option:
On pressing Play JukeBox the first score loads and correctly plays for 3 seconds. The second score then loads in it's place, (so the recursive call is working), but doesn't start playing.
Any ideas?
iSts = Jukebox status 0:Not Loaded, 1:Loaded, 2:Playing
(The callWaiter code will need to be moved into the preceding if block but this is not the issue since there are no awol scores in this test scenario.)
In reply to I've got the code working… by yonah_ag
A really lovely plugin idea! I love it when hardcopy anthology publisher adds a contents page that shows a few bars of each piece, it makes searching for the melody stuck in my head much easier.
My wild guess of the cause of error would be the score's not yet ready after readScore(), does it work when cmds are scheduled with 1ms?
awol LOL
In reply to A really lovely plugin idea!… by msfp
Thanks for the suggestion, I'll give it a try.
The JukeBox idea has a duration so that the user can control how much of a sample to play. A value of zero is used to play the whole score and it takes the score duration property from the plugin api. The parameter texts would be hidden in a finished score.
In reply to A really lovely plugin idea!… by msfp
The delay worked so it does look like the score wasn't quite ready. I have increased the delay to 1000ms so that there is a brief pause between scores as it sounded rather abrupt otherwise.
I've got a bug in my logic as the second score doesn't stop but I can see from the console log that I haven't quite got iSts correct through the recursive calling. This shouldn't take long to fix and then I can finish things off - there needs to be a way for the user to stop the playback.
In reply to A really lovely plugin idea!… by msfp
Plugin released:
https://musescore.org/en/project/musescore-jukebox-player