temporal: remove dangerous muldiv methods and use explicit method name not cast
This commit is contained in:
parent
0eb8b6aa85
commit
5175260af4
@ -148,7 +148,7 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
|
||||
* I hope this is clear.
|
||||
*/
|
||||
|
||||
double stretch = region->stretch() * tsr.time_fraction;
|
||||
double stretch = region->stretch() * tsr.time_fraction.to_double();
|
||||
double shift = region->shift() * tsr.pitch_fraction;
|
||||
|
||||
samplecnt_t read_start = region->ancestral_start_sample () +
|
||||
@ -360,7 +360,7 @@ RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
|
||||
/* multiply the old (possibly previously stretched) region length by the extra
|
||||
* stretch this time around to get its new length. this is a non-music based edit atm.
|
||||
*/
|
||||
(*x)->set_length (timecnt_t (tsr.time_fraction * (*x)->length_samples (), (*x)->position()));
|
||||
(*x)->set_length (timecnt_t (tsr.time_fraction.to_double() * (*x)->length_samples (), (*x)->position()));
|
||||
}
|
||||
|
||||
/* stretch region gain envelope */
|
||||
|
@ -76,18 +76,7 @@ class _ratio_t {
|
||||
bool is_unity() const { return _numerator == _denominator; }
|
||||
bool is_zero() const { return _numerator == 0; }
|
||||
|
||||
operator double() const { return (double) _numerator / _denominator; };
|
||||
|
||||
/* provide an easy way to multiply double by ratio_t. Note that this
|
||||
must be written as ratio_t * double, not the other way around. We
|
||||
are not trying to duplicate boost::rational here (which also doesn't
|
||||
allow this without a lot of syntactic fluff.
|
||||
*/
|
||||
double operator* (double v) const { return (v * (double) _numerator) / (double) _denominator; }
|
||||
|
||||
/* ditto for int64_t */
|
||||
|
||||
int64_t operator* (int64_t v) const { return int_div_round (v * _numerator, _denominator); }
|
||||
double to_double() const { return (double) _numerator / _denominator; };
|
||||
|
||||
private:
|
||||
T _numerator;
|
||||
|
Loading…
Reference in New Issue
Block a user