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