OpenShot Library | libopenshot 0.2.7
STFT.h
Go to the documentation of this file.
1#pragma once
2
3#ifndef OPENSHOT_STFT_AUDIO_EFFECT_H
4#define OPENSHOT_STFT_AUDIO_EFFECT_H
5#define _USE_MATH_DEFINES
6
7#include "../EffectBase.h"
8#include "../Enums.h"
9
10namespace openshot
11{
12
13 class STFT
14 {
15 public:
16 STFT() : num_channels (1) { }
17
18 virtual ~STFT() { }
19
20 void setup(const int num_input_channels);
21
22 void process(juce::AudioSampleBuffer &block);
23
24 void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type);
25
26 virtual void updateFftSize(const int new_fft_size);
27
28 virtual void updateHopSize(const int new_overlap);
29
30 virtual void updateWindow(const int new_window_type);
31
32 private:
33
34 virtual void modification(const int channel);
35
36 virtual void analysis(const int channel);
37
38 virtual void synthesis(const int channel);
39
40 protected:
43
45 std::unique_ptr<juce::dsp::FFT> fft;
46
48 juce::AudioSampleBuffer input_buffer;
49
51 juce::AudioSampleBuffer output_buffer;
52
53 juce::HeapBlock<float> fft_window;
54 juce::HeapBlock<juce::dsp::Complex<float>> time_domain_buffer;
55 juce::HeapBlock<juce::dsp::Complex<float>> frequency_domain_buffer;
56
61
66
71 };
72}
73
74#endif
int input_buffer_length
Definition: STFT.h:47
int output_buffer_read_position
Definition: STFT.h:64
int input_buffer_write_position
Definition: STFT.h:62
int output_buffer_length
Definition: STFT.h:50
int hop_size
Definition: STFT.h:58
int num_samples
Definition: STFT.h:42
void setup(const int num_input_channels)
Definition: STFT.cpp:5
int num_channels
Definition: STFT.h:41
void process(juce::AudioSampleBuffer &block)
Definition: STFT.cpp:17
juce::AudioSampleBuffer output_buffer
Definition: STFT.h:51
virtual void updateWindow(const int new_window_type)
Definition: STFT.cpp:103
int current_input_buffer_write_position
Definition: STFT.h:67
juce::HeapBlock< juce::dsp::Complex< float > > frequency_domain_buffer
Definition: STFT.h:55
std::unique_ptr< juce::dsp::FFT > fft
Definition: STFT.h:45
void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type)
Definition: STFT.cpp:10
int output_buffer_write_position
Definition: STFT.h:63
juce::HeapBlock< float > fft_window
Definition: STFT.h:53
virtual void updateHopSize(const int new_overlap)
Definition: STFT.cpp:89
int current_output_buffer_read_position
Definition: STFT.h:69
juce::AudioSampleBuffer input_buffer
Definition: STFT.h:48
virtual ~STFT()
Definition: STFT.h:18
int fft_size
Definition: STFT.h:44
float window_scale_factor
Definition: STFT.h:60
int overlap
Definition: STFT.h:57
int current_samples_since_last_FFT
Definition: STFT.h:70
juce::HeapBlock< juce::dsp::Complex< float > > time_domain_buffer
Definition: STFT.h:54
int window_type
Definition: STFT.h:59
virtual void updateFftSize(const int new_fft_size)
Definition: STFT.cpp:58
int samples_since_last_FFT
Definition: STFT.h:65
int current_output_buffer_write_position
Definition: STFT.h:68
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:47