|
@@ -74,10 +74,11 @@ export class PlaybackSettings {
|
|
|
// now approximate as good as possible by using fractionPrecision as smallest fraction
|
|
|
const tmp: number = numBeats - numerator;
|
|
|
numerator = <number>Math.round(tmp / (1.0 / fractionPrecision) / 4);
|
|
|
- // if (numerator === 0 && milliseconds > 0) {
|
|
|
- // numerator = 1; // error: this turns 4/4 into 1.0009 instead of 1
|
|
|
- // -> too far in playFromMs() (see extended issue 63). better just to round.
|
|
|
- // }
|
|
|
+ if (tmp !== 0 && numerator === 0 && milliseconds > 0) {
|
|
|
+ numerator = 1;
|
|
|
+ // tmp !== 0 necessary because otherwise 4/4 turns into e.g. 1.0009 instead of 1
|
|
|
+ // -> too far in playFromMs() (see extended issue 63). better just to round.
|
|
|
+ }
|
|
|
// add the 2 fractions
|
|
|
ret.Add(new Fraction(numerator, fractionPrecision));
|
|
|
return ret;
|