OpenShot Library | libopenshot  0.3.1
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
Header file for AudioBufferSource class.
This class is used to expose an AudioBuffer<float> as an AudioSource in JUCE.
This class is used to resample audio data for many sequential frames.
void SetBuffer(juce::AudioBuffer< float > *new_buffer, double sample_rate, double new_sample_rate)
Sets the audio buffer and key settings.
AudioResampler(int numChannels=2)
Default constructor.
juce::AudioBuffer< float > * GetResampledBuffer()
Get the resampled audio buffer.
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:29