convert use of operator* for tim::line types with ::scale(ratio_t)
This commit is contained in:
parent
48f4f9bf9c
commit
c8feef51ab
@ -42,7 +42,7 @@ public:
|
||||
|
||||
float sample_rate () const { return _session.nominal_sample_rate(); }
|
||||
|
||||
timepos_t natural_position() const { return _source->natural_position() * _ratio;}
|
||||
timepos_t natural_position() const { return _source->natural_position().scale (_ratio); }
|
||||
samplecnt_t readable_length_samples() const { assert (_source->length().time_domain() == Temporal::AudioTime); return _source->length().samples () * _ratio; }
|
||||
timepos_t length () const { assert (_source->length().time_domain() == Temporal::AudioTime); return timepos_t ((samplepos_t) (_source->length().samples () * _ratio)); }
|
||||
|
||||
|
@ -1245,7 +1245,7 @@ LuaAPI::Rubberband::finalize ()
|
||||
ar->set_ancestral_data (timepos_t (_read_start), timecnt_t (_read_len), _stretch_ratio, _pitch_ratio);
|
||||
ar->set_master_sources (_region->master_sources ());
|
||||
ar->set_position (timepos_t (_region->position_sample ()));
|
||||
ar->set_length (ar->length () * _stretch_ratio); // XXX
|
||||
ar->set_length (ar->length ().scale (_stretch_ratio)); // XXX
|
||||
if (_stretch_ratio != 1.0) {
|
||||
// TODO: apply mapping
|
||||
ar->envelope ()->x_scale (_stretch_ratio);
|
||||
|
@ -587,8 +587,6 @@ LuaBindings::common (lua_State* L)
|
||||
.addConstructor <void (*) (Temporal::samplepos_t)> ()
|
||||
.addOperator ("__add", CPPOPERATOR(Temporal::timepos_t, +))
|
||||
//.addOperator ("__mod", CPPOPERATOR2(Temporal::timepos_t, Temporal::timepos_t, Temporal::timecnt_t, %))
|
||||
.addOperator ("__mul", CPPOPERATOR2(Temporal::timepos_t, Temporal::timepos_t, Temporal::ratio_t , *))
|
||||
.addOperator ("__div", CPPOPERATOR2(Temporal::timepos_t, Temporal::timepos_t, Temporal::ratio_t , /))
|
||||
.addOperator ("__lt", CPPCOMPERATOR(Temporal::timepos_t, <))
|
||||
.addOperator ("__le", CPPCOMPERATOR(Temporal::timepos_t, <=))
|
||||
.addOperator ("__eq", CPPCOMPERATOR(Temporal::timepos_t, ==))
|
||||
@ -605,6 +603,7 @@ LuaBindings::common (lua_State* L)
|
||||
.addFunction ("ticks", &Temporal::timepos_t::ticks)
|
||||
.addFunction ("beats", &Temporal::timepos_t::beats)
|
||||
.addFunction ("str", &Temporal::timepos_t::str)
|
||||
.addFunction ("scale", &Temporal::timepos_t::scale)
|
||||
.addMetamethod ("__tostring", &Temporal::timepos_t::str)
|
||||
.endClass ()
|
||||
|
||||
@ -613,8 +612,6 @@ LuaBindings::common (lua_State* L)
|
||||
.addOperator ("__add", CPPOPERATOR(Temporal::timecnt_t, +))
|
||||
.addOperator ("__sub", CPPOPERATOR(Temporal::timecnt_t, -))
|
||||
.addOperator ("__mod", CPPOPERATOR(Temporal::timecnt_t, %))
|
||||
.addOperator ("__mul", CPPOPERATOR2(Temporal::timecnt_t, Temporal::timecnt_t, Temporal::ratio_t , *))
|
||||
.addOperator ("__div", CPPOPERATOR2(Temporal::timecnt_t, Temporal::timecnt_t, Temporal::ratio_t , /))
|
||||
.addOperator ("__lt", CPPCOMPERATOR(Temporal::timecnt_t, <))
|
||||
.addOperator ("__le", CPPCOMPERATOR(Temporal::timecnt_t, <=))
|
||||
.addOperator ("__eq", CPPCOMPERATOR(Temporal::timecnt_t, ==))
|
||||
@ -639,6 +636,7 @@ LuaBindings::common (lua_State* L)
|
||||
.addFunction ("beats", &Temporal::timecnt_t::beats)
|
||||
.addFunction ("ticks", &Temporal::timecnt_t::ticks)
|
||||
.addFunction ("str", &Temporal::timecnt_t::str)
|
||||
.addFunction ("scale", &Temporal::timecnt_t::scale)
|
||||
.addMetamethod ("__tostring", &Temporal::timecnt_t::str)
|
||||
.endClass ()
|
||||
|
||||
|
@ -121,7 +121,7 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*)
|
||||
|
||||
/* set length of new region to precisely match source length */
|
||||
|
||||
results[0]->set_length (region->length() * _request.time_fraction);
|
||||
results[0]->set_length (region->length().scale (_request.time_fraction));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, timepos_t const & positi
|
||||
timecnt_t length;
|
||||
|
||||
if (floor (times) != times) {
|
||||
length = region->length() * (times - floor (times));
|
||||
length = region->length().scale (times - floor (times));
|
||||
string name;
|
||||
RegionFactory::region_name (name, region->name (), false);
|
||||
|
||||
@ -1308,7 +1308,7 @@ Playlist::duplicate (boost::shared_ptr<Region> region, timepos_t & position, tim
|
||||
}
|
||||
|
||||
if (floor (times) != times) {
|
||||
timecnt_t length = region->length() * (times - floor (times));
|
||||
timecnt_t length = region->length().scale (times - floor (times));
|
||||
string name;
|
||||
RegionFactory::region_name (name, region->name(), false);
|
||||
|
||||
@ -1389,7 +1389,7 @@ Playlist::duplicate_ranges (std::list<TimelineRange>& ranges, float times)
|
||||
while (itimes--) {
|
||||
for (list<TimelineRange>::iterator i = ranges.begin (); i != ranges.end (); ++i) {
|
||||
boost::shared_ptr<Playlist> pl = copy ((*i).start(), (*i).length (), true);
|
||||
paste (pl, (*i).start() + (offset * count), 1.0f);
|
||||
paste (pl, (*i).start() + (offset.scale (count)), 1.0f);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ void
|
||||
ControlList::_x_scale (ratio_t const & factor)
|
||||
{
|
||||
for (iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||
(*i)->when = (*i)->when.operator* (factor);
|
||||
(*i)->when = (*i)->when.scale (factor);
|
||||
}
|
||||
|
||||
mark_dirty ();
|
||||
|
Loading…
Reference in New Issue
Block a user