Fixed an issue with reversed resampled audio in FrameMapper, which caused lots of clicks / seams between frames... Also, added a new overload to GetInterleavedAudioSamples, to reverse the samples before returning the float* array. Essentially, the FrameMapper is now aware of it's parent clip, and especially the 'time' keyframe, if the audio is in the forward or reverse direction. Also fixed a memory leak in time remapping.

This commit is contained in:
Jonathan Thomas
2023-02-28 14:13:12 -06:00
parent 59d46e59be
commit d104664da3
5 changed files with 47 additions and 63 deletions

View File

@@ -372,13 +372,18 @@ float* Frame::GetPlanarAudioSamples(int new_sample_rate, AudioResampler* resampl
// Get an array of sample data (all channels interleaved together), using any sample rate
float* Frame::GetInterleavedAudioSamples(int new_sample_rate, AudioResampler* resampler, int* sample_count)
float* Frame::GetInterleavedAudioSamples(int new_sample_rate, AudioResampler* resampler, int* sample_count, bool reverse)
{
float *output = NULL;
juce::AudioBuffer<float> *buffer(audio.get());
int num_of_channels = audio->getNumChannels();
int num_of_samples = GetAudioSamplesCount();
if (reverse) {
// Reverse audio samples (if needed)
buffer->reverse(0, buffer->getNumSamples());
}
// Resample to new sample rate (if needed)
if (new_sample_rate != sample_rate && resampler)
{