Retrieving the bar number

• Jul 16, 2025 - 23:42

Hi,
Is it possible to find the number of a measure accessed via a segment ?
´´´
var segment=...
var measure=segment.parent;
var measureNumber = measure.????
´´´

Whether the global measure number ou the local one (local to the section).

I couldn't find the right property...

Thanks,


Comments

Waiting for the wonders of version 4.6 (on which I allow myself to be skeptical), I must say that unfortunately there is no property to have the number of measure directly, but it is certainly possible to create a map of the measures through the cursor.nextMeasure() method, but perhaps you already know ...

In reply to by XiaoMigros

There are certainly several ways to find the numbers of the measures, different from the two proposed here. Personally I don't know if there is a better or a worse, but everyone is free to think that their own method is the best in the universe. Always waiting for the magical version 4.6 which will resolve all issues ...

In reply to by parkingb

I don't know how structured your plugin is, but a search algorithm of the number of measures, whatever the method you choose (I prefer to always do a complete mapping of the score, but everyone can do what they want), usually does not add appreciable times to the execution of the program. In any case, the best judge of the situation can only be you.

Do you still have an unanswered question? Please log in first to post your question.