Many improvements for smooth audio playback when 'time' keyframes are used for time remapping.

- Added new Frame::ReverseAudio() helper method - for time keyframe support playing backwards audio
- Fixed math rounding error on time keyframe Resampler, to use the rounded source samples value
- Removed some unused args and Frame audio methods
- Reset FrameMapper resample context when non-adjacent frames are requested
- Correctly reverse Frame audio if a time keyframe is present, and reversing audio
- Rewrite Keyframe::IsIncreasing() function, to give accurate direction of time keyframes at any index (special logic to support first and last indexes)
- Fixed Keyframe unit tests - since logic has changed a bit
- Improved time mapping unit tests
- Replace many c-style casts with static_cast
- Added new sine.wav test file
This commit is contained in:
Jonathan Thomas
2023-03-10 01:15:14 -06:00
parent d104664da3
commit 09ce05bbf2
15 changed files with 144 additions and 181 deletions

View File

@@ -113,7 +113,7 @@ void EffectBase::SetJsonValue(const Json::Value root) {
if (ParentTimeline()){
// Get parent timeline
Timeline* parentTimeline = (Timeline *) ParentTimeline();
Timeline* parentTimeline = static_cast<Timeline *>(ParentTimeline());
// Get the list of effects on the timeline
std::list<EffectBase*> effects = parentTimeline->ClipEffects();
@@ -129,14 +129,14 @@ void EffectBase::SetJsonValue(const Json::Value root) {
}
// Set this effect properties with the parent effect properties (except the id and parent_effect_id)
Json::Value my_root;
Json::Value my_root;
if (parentEffect){
my_root = parentEffect->JsonValue();
my_root["id"] = this->Id();
my_root["parent_effect_id"] = this->info.parent_effect_id;
} else {
my_root = root;
}
my_root = root;
}
// Set parent data
ClipBase::SetJsonValue(my_root);
@@ -183,7 +183,7 @@ void EffectBase::ParentClip(openshot::ClipBase* new_clip) {
void EffectBase::SetParentEffect(std::string parentEffect_id) {
// Get parent Timeline
Timeline* parentTimeline = (Timeline *) ParentTimeline();
Timeline* parentTimeline = static_cast<Timeline *>(ParentTimeline());
if (parentTimeline){