OpenShot Library | libopenshot  0.3.3
AudioResampler.h
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #ifndef OPENSHOT_RESAMPLER_H
14 #define OPENSHOT_RESAMPLER_H
15 
16 #include "AudioBufferSource.h"
17 
18 #include <AppConfig.h>
19 #include <juce_audio_basics/juce_audio_basics.h>
20 #include <juce_audio_devices/juce_audio_devices.h>
21 
22 namespace openshot {
23 
31  private:
33  juce::AudioBuffer<float> *resampled_buffer;
34  openshot::AudioBufferSource *buffer_source;
35  juce::ResamplingAudioSource *resample_source;
36  juce::AudioSourceChannelInfo resample_callback_buffer;
37 
38  int num_of_samples;
39  int new_num_of_samples;
40  double dest_ratio;
41  double source_ratio;
42  bool isPrepared;
43 
44  public:
46  AudioResampler(int numChannels=2);
47 
50 
55  void SetBuffer(juce::AudioBuffer<float> *new_buffer, double sample_rate, double new_sample_rate);
56 
60  void SetBuffer(juce::AudioBuffer<float> *new_buffer, double ratio);
61 
64  };
65 
66 }
67 
68 #endif
openshot::AudioResampler::~AudioResampler
~AudioResampler()
Destructor.
Definition: AudioResampler.cpp:48
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
juce::AudioBuffer< float >
AudioBufferSource.h
Header file for AudioBufferSource class.
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::AudioBufferSource
This class is used to expose an AudioBuffer<float> as an AudioSource in JUCE.
Definition: AudioBufferSource.h:27
openshot::AudioResampler::GetResampledBuffer
juce::AudioBuffer< float > * GetResampledBuffer()
Get the resampled audio buffer.
Definition: AudioResampler.cpp:106
openshot::AudioResampler::AudioResampler
AudioResampler(int numChannels=2)
Default constructor.
Definition: AudioResampler.cpp:19