Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixel coordinates & timepos for each measure and each beat #383

Closed
cecilios opened this issue Oct 29, 2022 · 5 comments
Closed

Pixel coordinates & timepos for each measure and each beat #383

cecilios opened this issue Oct 29, 2022 · 5 comments

Comments

@cecilios
Copy link
Member

In discussion #377 it was requested information about how to retrieve a list of associated horizontal pixel coordinates & timepos for each measure and each beat in that measure (for manually controlling the highlight, etc.)

Opening this issue as a remainder to answer this question.

@cecilios
Copy link
Member Author

Perhaps these methods can be used for getting the required information:

    /** Returns the x position for the given timepos. This method only takes notes and
        rests into account, ignoring other staff objects that could exist
        at the same timepos in different locations, such as a barline or a clef before
        the note/rest. The returned value is the x position at which notes/rests are
        vertically aligned with notes/rests at the same timepos in other staves.
        If there are no nets/rests at the requested timepos, this method provides an
        approximated interpolated value.
        
        The returned value is in logical units, relative to GmoDocPage origin.
        
        @param timepos Absolute time units for the requested position.

        See get_x_for_barline_at_time()
    */
    LUnits get_x_for_note_rest_at_time(TimeUnits timepos);

    /** Returns the x position for the given timepos. This method takes only barlines
        into account, ignoring other staff objects that could exist at the same timepos
        (e.g. any staffobj after the barline). Therefore, the returned value is the x
        position of the first barline found at the provided @c timepos.
        
        The returned value is in logical units, relative to GmoDocPage origin.

        @param timepos Absolute time units for the requested position.

        See get_x_for_note_rest_at_time()
    */
    LUnits get_x_for_barline_at_time(TimeUnits timepos);

    /** Returns the timepos at start of this system. */
    TimeUnits start_time();
    
    /** Returns the timepos at end of this system. */
    TimeUnits end_time();
    

Method get_x_for_note_rest_at_time() will provide the logical coordinates (relative to GmoDocPage origin) for each beat, by providing the timepos for the beat.

Method start_time() will return the timepos for first measure and with this value you can use previous method to get its x position.

And method get_x_for_barline_at_time() could be used the get the start position for all other measures in the system.

@cecilios
Copy link
Member Author

cecilios commented Nov 9, 2022

@npiegdon Did the answer solved your needs? Can I close this issue?

@npiegdon
Copy link

npiegdon commented Nov 9, 2022

Sorry for the wait on this. Between trying to get a major release out the door before I can start on this integration in earnest and real life stuff like my 6 year old being home from school for a few days with the flu, I haven't had a chance to dig into these details.

That said, this does look like a good starting point and you can probably close this for now. Thanks!

@cecilios
Copy link
Member Author

No problem. I'll keep it open until you can test and confirm.

@cecilios
Copy link
Member Author

cecilios commented Jun 1, 2024

I am closing this issue due to lack of any feedback. So I assume the issue is solved.

@cecilios cecilios closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants