7 num_channels = (num_input_channels > 0) ? num_input_channels : 1;
21 for (
int channel = 0; channel <
num_channels; ++channel) {
22 float *channel_data = block.getWritePointer(channel);
29 for (
int sample = 0; sample <
num_samples; ++sample) {
30 const float input_sample = channel_data[sample];
45 modification(channel);
63 fft = std::make_unique<juce::dsp::FFT>(log2(
fft_size));
109 for (
int sample = 0; sample <
fft_size; ++sample)
114 for (
int sample = 0; sample <
fft_size; ++sample)
115 fft_window[sample] = 1.0f - fabs (2.0f * (
float)sample / (
float)(
fft_size - 1) - 1.0f);
119 for (
int sample = 0; sample <
fft_size; ++sample)
120 fft_window[sample] = 0.5f - 0.5f * cosf (2.0f * M_PI * (
float)sample / (
float)(
fft_size - 1));
124 for (
int sample = 0; sample <
fft_size; ++sample)
125 fft_window[sample] = 0.54f - 0.46f * cosf (2.0f * M_PI * (
float)sample / (
float)(
fft_size - 1));
130 float window_sum = 0.0f;
131 for (
int sample = 0; sample <
fft_size; ++sample)
135 if (
overlap != 0 && window_sum != 0.0f)
141 void STFT::analysis(
const int channel)
144 for (
int index = 0; index <
fft_size; ++index) {
149 input_buffer_index = 0;
153 void STFT::modification(
const int channel)
157 for (
int index = 0; index <
fft_size / 2 + 1; ++index) {
164 if (index > 0 && index <
fft_size / 2) {
173 void STFT::synthesis(
const int channel)
176 for (
int index = 0; index <
fft_size; ++index) {
177 float output_sample =
output_buffer.getSample(channel, output_buffer_index);
179 output_buffer.setSample(channel, output_buffer_index, output_sample);
182 output_buffer_index = 0;
int output_buffer_read_position
int input_buffer_write_position
void setup(const int num_input_channels)
void process(juce::AudioSampleBuffer &block)
juce::AudioSampleBuffer output_buffer
virtual void updateWindow(const int new_window_type)
int current_input_buffer_write_position
juce::HeapBlock< juce::dsp::Complex< float > > frequency_domain_buffer
std::unique_ptr< juce::dsp::FFT > fft
void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type)
int output_buffer_write_position
juce::HeapBlock< float > fft_window
virtual void updateHopSize(const int new_overlap)
int current_output_buffer_read_position
juce::AudioSampleBuffer input_buffer
float window_scale_factor
int current_samples_since_last_FFT
juce::HeapBlock< juce::dsp::Complex< float > > time_domain_buffer
virtual void updateFftSize(const int new_fft_size)
int samples_since_last_FFT
int current_output_buffer_write_position
This namespace is the default namespace for all code in the openshot library.