Fixed a problem with audio time map deltas, and being slowed down instead of sped up

This commit is contained in:
Jonathan Thomas
2012-10-23 11:13:06 -05:00
parent 651993ff60
commit bfa1ec82eb
2 changed files with 18 additions and 14 deletions

View File

@@ -396,7 +396,7 @@ tr1::shared_ptr<Frame> Clip::get_time_mapped_frame(tr1::shared_ptr<Frame> 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();

View File

@@ -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);