Replies: 1 comment 1 reply
-
Looking at what you want to doWouldn't it be easier to synchronize the scores always by the playback position? The click on an element should also trigger the playerPositionChanged event and you can seek on all browser to the same time. In case there is something not working as desired, you could also use Looking at your API requestThe reason why jumping to a beat or bar is a bit more complicated is due to repeats and the complexity that can be behind the data model. If you consider the complexity of the data model hierachy it is quite a list of indicesto jump to an exact item:
Having a function with all the same indices in multiple conmbinations would be quite noisy without much developer benefit. The function jumpToMasterBar(masterBar) {
api.tickPosition = api.tickCache.getMasterBarStart(masterBar);
}
function jumpToBeat(beat) {
api.tickPosition = api.tickCache.getBeatStart(beat);
}
jumpToMasterBar(api.score.masterBars[10]);
jumpToBeat(api.score.tracks[0].staves[0].bar[10].voices[0].beats[3]); |
Beta Was this translation helpful? Give feedback.
-
I'm working on a small project that displays the same tab to multiple people so they can play together, and it works well.
Currently, I'm trying to synchronize the current cursor position, i.e., when someone clicks on bar 12, the cursor should jump to bar 12 for everyone.
Getting the clicked bar is easy with
api.beatMouseDown()
, but I cannot find a way to set the cursor like that.I wish to have
api.cursorFocusBar(12)
.Similar methods for beat and note index would certainly be helpful for other tasks as well, such as showing overviews like the one in Guitar Pro.
Did I miss an existing way to do this?
I tried somehow getting the tick or time of the bar and then using
api.tickPosition
, but I did not figure out how, and it seems unnecessarily complicated.https://www.alphatab.net/docs/reference/api/tickposition/
Beta Was this translation helpful? Give feedback.
All reactions