From bfa1ec82eb69263131dcb5210a91981a45123597 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Tue, 23 Oct 2012 11:13:06 -0500 Subject: [PATCH] Fixed a problem with audio time map deltas, and being slowed down instead of sped up --- src/Clip.cpp | 2 +- src/Main.cpp | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Clip.cpp b/src/Clip.cpp index 31c0fc6e..9564e10c 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -396,7 +396,7 @@ tr1::shared_ptr Clip::get_time_mapped_frame(tr1::shared_ptr frame, } // Resample audio to be X times faster (where X is the delta of the repeat fraction) - resampler->SetBuffer(samples, float(number_of_samples) / float(start)); + resampler->SetBuffer(samples, float(start) / float(number_of_samples)); // Resample data, and return new buffer pointer AudioSampleBuffer *buffer = resampler->GetResampledBuffer(); diff --git a/src/Main.cpp b/src/Main.cpp index 3953b1e8..b0cec8a0 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -38,7 +38,7 @@ int main() Timeline t(640, 360, Framerate(24,1)); // Add some clips - Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel-1024-stereo.mp4")); + Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel_trailer-720p.mp4")); c1.Position(0.0); // LINEAR Reverse @@ -46,24 +46,28 @@ int main() //c1.time.AddPoint(500, 1, LINEAR); // LINEAR Slow Reverse (sounds wavy, due to periodic repeated frames) - //c1.time.AddPoint(1, 500, LINEAR); - //c1.time.AddPoint(500, 100, LINEAR); + c1.time.AddPoint(1, 500, LINEAR); + c1.time.AddPoint(500, 100, LINEAR); // LINEAR Fast Reverse (sounds wavy, due to periodic repeated frames) //c1.time.AddPoint(1, 600, LINEAR); //c1.time.AddPoint(500, 1, LINEAR); - // BEZIER Reverse - openshot::Point p1(1,500); - p1.handle_left = Coordinate(1,500); - p1.handle_right = Coordinate(250,500); + // LINEAR Slow Forward + //c1.time.AddPoint(1, 1000, LINEAR); + //c1.time.AddPoint(500, 1, LINEAR); - openshot::Point p2(500,100); - p1.handle_left = Coordinate(500,350); - p1.handle_right = Coordinate(500,100); - - c1.time.AddPoint(p1); - c1.time.AddPoint(p2); +// // BEZIER Reverse +// openshot::Point p1(1,500); +// p1.handle_left = Coordinate(1,500); +// p1.handle_right = Coordinate(250,500); +// +// openshot::Point p2(500,100); +// p1.handle_left = Coordinate(500,350); +// p1.handle_right = Coordinate(500,100); +// +// c1.time.AddPoint(p1); +// c1.time.AddPoint(p2); // c1.time.AddPoint(1, 500, LINEAR); // c1.time.AddPoint(500, 1, LINEAR);