13
0

adapt to DoubleableBeats and so forth (libs edition)

This commit is contained in:
Paul Davis 2020-12-18 19:05:51 -07:00
parent 3e8f4d80fb
commit f66a6c779e
5 changed files with 9 additions and 20 deletions

View File

@ -93,7 +93,7 @@ public:
std::min(value, (double)INT64_MAX)));
break;
case BEATS:
_beats = Temporal::Beats(value);
_beats = Temporal::Beats::from_double (value);
break;
default:
_type = NOTHING;
@ -109,7 +109,7 @@ public:
case FLOAT: return _float;
case INT: return _int;
case LONG: return _long;
case BEATS: return _beats.to_double();
case BEATS: return Temporal::DoubleableBeats (_beats).to_double();
default: return 0.0;
}
}

View File

@ -1777,15 +1777,6 @@ LV2Plugin::write_to_ui(uint32_t index,
}
return true;
}
/* this used to be computed by Temporal::Beats::to_double() but that
* method has been hidden as of February 2017 to prevent inadvertent
* use of floating point musical time.
*/
inline static double
beats_to_double (Temporal::Beats const & b)
{
return (double) b.get_beats() + (b.get_ticks() / (double) Temporal::ticks_per_beat);
}
static void
forge_variant(LV2_Atom_Forge* forge, const Variant& value)
@ -1795,7 +1786,7 @@ forge_variant(LV2_Atom_Forge* forge, const Variant& value)
break;
case Variant::BEATS:
// No atom type for this, just forge a double
lv2_atom_forge_double(forge, beats_to_double (value.get_beats()));
lv2_atom_forge_double(forge, DoubleableBeats(value.get_beats()).to_double());
break;
case Variant::BOOL:
lv2_atom_forge_bool(forge, value.get_bool());

View File

@ -475,7 +475,7 @@ MidiModel::NoteDiffCommand::unmarshal_note (XMLNode *xml_note)
warning << "note information missing time" << endmsg;
}
MidiModel::TimeType length = MidiModel::TimeType(1);
MidiModel::TimeType length = MidiModel::TimeType();
if (!xml_note->get_property("length", length)) {
warning << "note information missing length" << endmsg;
}

View File

@ -143,9 +143,9 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
Temporal::Beats new_end = (((*i)->end_time() - offset) / _end_grid) * _end_grid;
if (_swing) {
new_start = swing_position (new_start.to_double(), _start_grid, _swing, offset.to_double());
new_end = swing_position (new_end.to_double(), _end_grid, _swing, offset.to_double());
Temporal::DoubleableBeats doff (offset);
new_start = swing_position (Temporal::DoubleableBeats (new_start).to_double(), _start_grid, _swing, doff.to_double());
new_end = swing_position (Temporal::DoubleableBeats (new_end).to_double(), _end_grid, _swing, doff.to_double());
} else {

View File

@ -207,11 +207,9 @@ intptr_t Session::vst_callback (
bbt.beats = 1;
bbt.ticks = 0;
/* exact quarter note */
#warning NUTEMPO need better conversion to double from Beats here
double ppqBar = 0; // tmap->quarters_at (bbt);
double ppqBar = DoubleableBeats (tmap->quarters_at (bbt)).to_double ();
/* quarter note at sample position (not rounded to note subdivision) */
#warning NUTEMPO need better conversion to double from Beats here
double ppqPos = 0; // tmap->quarters_at_sample (now);
double ppqPos = DoubleableBeats (tmap->quarters_at_sample (now)).to_double();
if (value & (kVstPpqPosValid)) {
timeinfo->ppqPos = ppqPos;
newflags |= kVstPpqPosValid;