Loading...
Searching...
No Matches
STFT.h
Go to the documentation of this file.
// © OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
#ifndef OPENSHOT_STFT_AUDIO_EFFECT_H
#define OPENSHOT_STFT_AUDIO_EFFECT_H
#define _USE_MATH_DEFINES
#include "EffectBase.h"
#include "Enums.h"
#include <AppConfig.h>
#include <juce_audio_basics/juce_audio_basics.h>
#include <juce_dsp/juce_dsp.h>
namespace openshot
{
class STFT
{
public:
STFT() : num_channels (1) { }
virtual ~STFT() { }
void setup(const int num_input_channels);
void process(juce::AudioBuffer<float> &block);
void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type);
virtual void updateFftSize(const int new_fft_size);
virtual void updateHopSize(const int new_overlap);
virtual void updateWindow(const int new_window_type);
private:
virtual void modification(const int channel);
virtual void analysis(const int channel);
virtual void synthesis(const int channel);
protected:
int num_channels;
int num_samples;
int fft_size;
std::unique_ptr<juce::dsp::FFT> fft;
int input_buffer_length;
juce::AudioBuffer<float> input_buffer;
int output_buffer_length;
juce::AudioBuffer<float> output_buffer;
juce::HeapBlock<float> fft_window;
juce::HeapBlock<juce::dsp::Complex<float>> time_domain_buffer;
juce::HeapBlock<juce::dsp::Complex<float>> frequency_domain_buffer;
int overlap;
int hop_size;
int window_type;
float window_scale_factor;
int input_buffer_write_position;
int output_buffer_write_position;
int output_buffer_read_position;
int samples_since_last_FFT;
int current_input_buffer_write_position;
int current_output_buffer_write_position;
int current_output_buffer_read_position;
int current_samples_since_last_FFT;
};
}
#endif
EffectBase.h
Header file for EffectBase class.
Enums.h
Header file for TextReader class.
juce::AudioBuffer
Definition Frame.h:38
openshot::STFT
Definition STFT.h:22
openshot::STFT::input_buffer_length
int input_buffer_length
Definition STFT.h:55
openshot::STFT::output_buffer_read_position
int output_buffer_read_position
Definition STFT.h:72
openshot::STFT::input_buffer_write_position
int input_buffer_write_position
Definition STFT.h:70
openshot::STFT::output_buffer_length
int output_buffer_length
Definition STFT.h:58
openshot::STFT::hop_size
int hop_size
Definition STFT.h:66
openshot::STFT::num_samples
int num_samples
Definition STFT.h:50
openshot::STFT::process
void process(juce::AudioBuffer< float > &block)
Definition STFT.cpp:21
openshot::STFT::setup
void setup(const int num_input_channels)
Definition STFT.cpp:9
openshot::STFT::num_channels
int num_channels
Definition STFT.h:49
openshot::STFT::updateWindow
virtual void updateWindow(const int new_window_type)
Definition STFT.cpp:107
openshot::STFT::current_input_buffer_write_position
int current_input_buffer_write_position
Definition STFT.h:75
openshot::STFT::frequency_domain_buffer
juce::HeapBlock< juce::dsp::Complex< float > > frequency_domain_buffer
Definition STFT.h:63
openshot::STFT::fft
std::unique_ptr< juce::dsp::FFT > fft
Definition STFT.h:53
openshot::STFT::updateParameters
void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type)
Definition STFT.cpp:14
openshot::STFT::input_buffer
juce::AudioBuffer< float > input_buffer
Definition STFT.h:56
openshot::STFT::output_buffer_write_position
int output_buffer_write_position
Definition STFT.h:71
openshot::STFT::fft_window
juce::HeapBlock< float > fft_window
Definition STFT.h:61
openshot::STFT::updateHopSize
virtual void updateHopSize(const int new_overlap)
Definition STFT.cpp:93
openshot::STFT::current_output_buffer_read_position
int current_output_buffer_read_position
Definition STFT.h:77
openshot::STFT::~STFT
virtual ~STFT()
Definition STFT.h:26
openshot::STFT::fft_size
int fft_size
Definition STFT.h:52
openshot::STFT::output_buffer
juce::AudioBuffer< float > output_buffer
Definition STFT.h:59
openshot::STFT::window_scale_factor
float window_scale_factor
Definition STFT.h:68
openshot::STFT::overlap
int overlap
Definition STFT.h:65
openshot::STFT::current_samples_since_last_FFT
int current_samples_since_last_FFT
Definition STFT.h:78
openshot::STFT::STFT
STFT()
Definition STFT.h:24
openshot::STFT::time_domain_buffer
juce::HeapBlock< juce::dsp::Complex< float > > time_domain_buffer
Definition STFT.h:62
openshot::STFT::window_type
int window_type
Definition STFT.h:67
openshot::STFT::updateFftSize
virtual void updateFftSize(const int new_fft_size)
Definition STFT.cpp:62
openshot::STFT::samples_since_last_FFT
int samples_since_last_FFT
Definition STFT.h:73
openshot::STFT::current_output_buffer_write_position
int current_output_buffer_write_position
Definition STFT.h:76
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29