| 203 | }; |
| 204 | |
| 205 | static 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 | |
| 218 | TEST_CASE("Timeline honors Mask fade_audio_hint with equal-power overlapping audio", "[libopenshot][timeline][audio][transition]") { |
| 219 | const Fraction fps(30, 1); |