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/lib/audio_analyser.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/lib/audio_analyser.cc')
| -rw-r--r-- | src/lib/audio_analyser.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/audio_analyser.cc b/src/lib/audio_analyser.cc index 7d4ee6ace..b1ccef901 100644 --- a/src/lib/audio_analyser.cc +++ b/src/lib/audio_analyser.cc @@ -135,7 +135,7 @@ AudioAnalyser::AudioAnalyser(shared_ptr<const Film> film, shared_ptr<const Playl void AudioAnalyser::analyse (shared_ptr<AudioBuffers> b, DCPTime time) { - LOG_DEBUG_AUDIO_ANALYSIS("AudioAnalyser received {} frames at {}", b->frames(), to_string(time)); + LOG_DEBUG_AUDIO_ANALYSIS("AudioAnalyser received {} frames at {}", b->frames(), time.to_debug_string()); DCPOMATIC_ASSERT (time >= _start); /* In bug #2364 we had a lot of frames arriving here (~47s worth) which * caused an OOM error on Windows. Check for the number of frames being @@ -197,7 +197,7 @@ AudioAnalyser::finish () vector<AudioAnalysis::PeakTime> sample_peak; for (int i = 0; i < _film->audio_channels(); ++i) { sample_peak.push_back ( - AudioAnalysis::PeakTime (_sample_peak[i], DCPTime::from_frames (_sample_peak_frame[i], _film->audio_frame_rate ())) + AudioAnalysis::PeakTime(_sample_peak[i], DCPTime(_sample_peak_frame[i], _film->audio_frame_rate())) ); } _analysis.set_sample_peak (sample_peak); |
