[SOLVED] Using the RewindMode enum
I'm working on a plugin that has to rewind the score in a few places, using the function cursor.rewind()
.
To pass a parameter to this function, I would like to use the enum RewindMode
, but when I try to use it, I get the following error message:
13:-1: ReferenceError: RewindMode is not defined
I attached an example of me trying to use this enum.
What do I have to do in order to use this enum in a plugin?
Attachment | Size |
---|---|
TEST.qml | 240 bytes |
Comments
I get
Plug-In Details:
Menu Path: Plugins.TEST
Version: 1.0.0
Description: TEST.
Needs score
13:-1: ReferenceError: cursor is not defined
13:-1: ReferenceError: cursor is not defined
13:-1: ReferenceError: cursor is not defined
Warning: <Unknown File>:13: ReferenceError: cursor is not defined
In Mu3 that is...
At least a
var cursor = curScore.newCursor();
is neededThen changing to
cursor.Rewind(Cursor.RewindMode.SCORE_START);
the error message changes to14:-1: TypeError: Cannot read property 'SCORE_START' of undefined
Then changing that to
cursor.rewind("Cursor.RewindMode.SCORE_START");
(lower case r, arg in quotes), and it seems to work?In reply to I get Plug-In Details: … by Jojo-Schmitz
Sorry for the previous example, I was going to upload a different file, then I changed it at the last moment and apparently forgot to test it.
By passing the argument as as string, I also don't get an error message, but it seems like I always get the cursor back to tick 0, even if I pass as input
"RewindMode.SELECTION_START"
or"RewindMode.SELECTION_END"
, or any other string.For example, by running the attached plugin on the attached file, I get the following output:
This was with the following selection:
Apparently it rewinds to the beginnig of the score whatever string it receives in input. Could it be that rewinding to the beginning of the score is the default action of
cursor.rewind()
, if the input is invalid?In reply to Sorry for the previous… by looptailG
Yes, probably. I couldn't get it to work too
In reply to Yes, probably. I couldn't… by Jojo-Schmitz
Out of curiosity I ported the test plugin to MS4, and got the same output. It would be nice if in this case
cursor.Rewind()
threw an exeption, or at least gave some indication that the given input is not valid.As far as I understand, the plugin API for version 4 is not complete yet. Should this be reported somewhere?
In reply to Out of curiosity I ported… by looptailG
Yes, please do
In reply to Yes, please do by Jojo-Schmitz
I opened an issue on GitHub.
In reply to I opened an issue on GitHub. by looptailG
Apparently the correct syntax is simply
Cursor.SELECTION_START
, without explicitly writingCursor.RewindMode.SELECTION_START
.In reply to Apparently the correct… by looptailG
I tried that and it didn't work either
In reply to I tried that and it didn't… by Jojo-Schmitz
Weird, because for me this solution works, for both MS3 and MS4.
In reply to Apparently the correct… by looptailG
Hmm, ok,lemme try again then
In reply to Apparently the correct… by looptailG
Hold on, I did not try that! I tried RewindMode.SELECTION_START