diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-22 00:09:57 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-02 22:40:13 +0200 |
| commit | 33b0928b20618da5bc295711bfdf3d638863afa5 (patch) | |
| tree | 24af21c6a7b863d914991ae837c36b6b9b50bcce /src/wx/controls.cc | |
| parent | 6784eb8de2451afd2dedc15c05eac043011b5afb (diff) | |
Untested conversion to num/den DCPTime.arbitrary-hz
Summary of required changes:
Replace ::from_frames with a constructor that takes num/den.
Provide and use member to_debug_string() instead of to_string().
Provide and use member to_serializable_string() and string constructor instead of fmt::to_string on .get() and number constructor.
Provide and use content_time() member instead of ContentTime constructor from DCPTime.
Use frames_round(96000) instead of get() when comparing times to see if they are "close enough".
Provide and use DCPTime(x, FrameRateChange) constructor when converting from ContentTime.
Use .seconds() when calculating proportions or sometimes when dividing by HZ.
Provide and use operator bool().
Pass explicit 96000 denominator in a lot of places.
Add member max() and use it instead of static max()
Change BOOST_CHECK_EQUAL to BOOST_CHECK
Provide operator/ and use it instead of .get() / 2.
Diffstat (limited to 'src/wx/controls.cc')
| -rw-r--r-- | src/wx/controls.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wx/controls.cc b/src/wx/controls.cc index a452e1d13..8619b6b4a 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -227,7 +227,7 @@ Controls::slider_moved (bool page) _slider_being_moved = true; } - DCPTime t (_slider->GetValue() * _film->length().get() / 4096); + auto t = DCPTime::from_seconds(_slider->GetValue() * _film->length().seconds() / 4096); t = t.round (_film->video_frame_rate()); /* Ensure that we hit the end of the film at the end of the slider. In particular, we need to do an accurate seek in case there isn't a keyframe near the end. @@ -265,8 +265,8 @@ Controls::update_position_slider () auto const len = _film->length (); - if (len.get ()) { - int const new_slider_position = 4096 * _viewer.position().get() / len.get(); + if (len) { + int const new_slider_position = 4096 * _viewer.position().seconds() / len.seconds(); if (new_slider_position != _slider->GetValue()) { _slider->SetValue (new_slider_position); } |
