Loading...
Searching...
No Matches
AudioResampler.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_RESAMPLER_H
#define OPENSHOT_RESAMPLER_H
#include "AudioBufferSource.h"
#include <AppConfig.h>
#include <juce_audio_basics/juce_audio_basics.h>
#include <juce_audio_devices/juce_audio_devices.h>
namespace openshot {
class AudioResampler {
private:
juce::AudioBuffer<float> *buffer;
juce::AudioBuffer<float> *resampled_buffer;
openshot::AudioBufferSource *buffer_source;
juce::ResamplingAudioSource *resample_source;
juce::AudioSourceChannelInfo resample_callback_buffer;
int num_of_samples;
int new_num_of_samples;
double dest_ratio;
double source_ratio;
bool isPrepared;
public:
AudioResampler(int numChannels=2);
~AudioResampler();
void SetBuffer(juce::AudioBuffer<float> *new_buffer, double sample_rate, double new_sample_rate);
void SetBuffer(juce::AudioBuffer<float> *new_buffer, double ratio);
juce::AudioBuffer<float>* GetResampledBuffer();
};
}
#endif
AudioBufferSource.h
Header file for AudioBufferSource class.
juce::AudioBuffer
Definition Frame.h:38
openshot::AudioBufferSource
This class is used to expose an AudioBuffer<float> as an AudioSource in JUCE.
Definition AudioBufferSource.h:28
openshot::AudioResampler
This class is used to resample audio data for many sequential frames.
Definition AudioResampler.h:30
openshot::AudioResampler::SetBuffer
void SetBuffer(juce::AudioBuffer< float > *new_buffer, double sample_rate, double new_sample_rate)
Sets the audio buffer and key settings.
Definition AudioResampler.cpp:60
openshot::AudioResampler::~AudioResampler
~AudioResampler()
Destructor.
Definition AudioResampler.cpp:48
openshot::AudioResampler::GetResampledBuffer
juce::AudioBuffer< float > * GetResampledBuffer()
Get the resampled audio buffer.
Definition AudioResampler.cpp:106
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29