MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / expected_equal_power_gain

Function expected_equal_power_gain

tests/Timeline.cpp:205–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203};
204
205static double expected_equal_power_gain(int64_t frame_number, int64_t start_frame, int64_t end_frame, bool fades_in) {
206 constexpr double kHalfPi = 1.57079632679489661923;
207 if (end_frame <= start_frame)
208 return 1.0;
209 const double span = static_cast<double>(end_frame - start_frame);
210 double t = static_cast<double>(frame_number - start_frame) / span;
211 if (t < 0.0)
212 t = 0.0;
213 else if (t > 1.0)
214 t = 1.0;
215 return fades_in ? std::sin(t * kHalfPi) : std::cos(t * kHalfPi);
216}
217
218TEST_CASE("Timeline honors Mask fade_audio_hint with equal-power overlapping audio", "[libopenshot][timeline][audio][transition]") {
219 const Fraction fps(30, 1);

Callers 1

Timeline.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected