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

[MU4 Task] [TECH_DEBTS] Fraction from/to ticks does not work properly #16253

Open
Eism opened this issue Feb 7, 2023 · 1 comment
Open

[MU4 Task] [TECH_DEBTS] Fraction from/to ticks does not work properly #16253

Eism opened this issue Feb 7, 2023 · 1 comment

Comments

@Eism
Copy link
Contributor

Eism commented Feb 7, 2023

    Fraction fr1(1, 256);
    int ticks = fr1.ticks();

    Fraction fr2 = Fraction::fromTicks(ticks);

    EXPECT_EQ(fr2.numerator(), 1);
    EXPECT_EQ(fr2.denominator(), 256);  // fail: denominator == 240
@jeetee
Copy link
Contributor

jeetee commented Feb 7, 2023

This is somewhat expected as a 1/256th is the first fraction that falls below our basic midi resolution of 480 ticks / quarter note.
See jeetee:MuseScore:fraction_ticks_convertions for a reference initial test showcasing this.

1/256th => 7.5ticks but is ceiled to 8 in the ticks function, which makes that 3rd EQ fail as division/64 is floored instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants