OpenShot Library | libopenshot
0.4.0
|
Go to the documentation of this file.
11 num_channels = (num_input_channels > 0) ? num_input_channels : 1;
25 for (
int channel = 0; channel <
num_channels; ++channel) {
26 float *channel_data = block.getWritePointer(channel);
33 for (
int sample = 0; sample <
num_samples; ++sample) {
34 const float input_sample = channel_data[sample];
49 modification(channel);
67 fft = std::make_unique<juce::dsp::FFT>(log2(
fft_size));
113 for (
int sample = 0; sample <
fft_size; ++sample)
118 for (
int sample = 0; sample <
fft_size; ++sample)
119 fft_window[sample] = 1.0f - fabs (2.0f * (
float)sample / (
float)(
fft_size - 1) - 1.0f);
123 for (
int sample = 0; sample <
fft_size; ++sample)
124 fft_window[sample] = 0.5f - 0.5f * cosf (2.0f * M_PI * (
float)sample / (
float)(
fft_size - 1));
128 for (
int sample = 0; sample <
fft_size; ++sample)
129 fft_window[sample] = 0.54f - 0.46f * cosf (2.0f * M_PI * (
float)sample / (
float)(
fft_size - 1));
134 float window_sum = 0.0f;
135 for (
int sample = 0; sample <
fft_size; ++sample)
139 if (
overlap != 0 && window_sum != 0.0f)
145 void STFT::analysis(
const int channel)
148 for (
int index = 0; index <
fft_size; ++index) {
153 input_buffer_index = 0;
157 void STFT::modification(
const int channel)
161 for (
int index = 0; index <
fft_size / 2 + 1; ++index) {
168 if (index > 0 && index <
fft_size / 2) {
177 void STFT::synthesis(
const int channel)
180 for (
int index = 0; index <
fft_size; ++index) {
181 float output_sample =
output_buffer.getSample(channel, output_buffer_index);
183 output_buffer.setSample(channel, output_buffer_index, output_sample);
186 output_buffer_index = 0;
This namespace is the default namespace for all code in the openshot library.
int current_output_buffer_write_position
std::unique_ptr< juce::dsp::FFT > fft
int current_input_buffer_write_position
virtual void updateFftSize(const int new_fft_size)
virtual void updateHopSize(const int new_overlap)
juce::HeapBlock< juce::dsp::Complex< float > > frequency_domain_buffer
int current_output_buffer_read_position
int samples_since_last_FFT
void process(juce::AudioBuffer< float > &block)
float window_scale_factor
juce::AudioBuffer< float > input_buffer
virtual void updateWindow(const int new_window_type)
int output_buffer_read_position
void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type)
juce::HeapBlock< juce::dsp::Complex< float > > time_domain_buffer
juce::AudioBuffer< float > output_buffer
int input_buffer_write_position
int output_buffer_write_position
void setup(const int num_input_channels)
juce::HeapBlock< float > fft_window
int current_samples_since_last_FFT