Audacity 3.2.0
LookAheadGainReduction.h
Go to the documentation of this file.
1/*
2 This file is part of the SimpleCompressor project.
3 https://github.com/DanielRudrich/SimpleCompressor
4 Copyright (c) 2019 Daniel Rudrich
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, version 3.
9
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20#pragma once
21#include <vector>
22
23namespace DanielRudrich {
27{
28public:
31
32 void setDelayTime (float delayTimeInSeconds);
33
34 const int getDelayInSamples() { return delayInSamples; }
35
38 void prepare (const double sampleRate, const int blockSize);
39
42 void pushSamples (const float* src, const int numSamples);
43
46 void process();
47
50 void readSamples (float* dest, const int numSamples);
51
52
53private:
56 inline void getProcessPositions (int startIndex, int numSamples, int& blockSize1, int& blockSize2);
57
58 inline void getWritePositions (int numSamples, int& startIndex, int& blockSize1, int& blockSize2);
59
60 inline void getReadPositions (int numSamples, int& startIndex, int& blockSize1, int& blockSize2);
61
62
63private:
64 //==============================================================================
65 double sampleRate;
67
68 float delay;
72 std::vector<float> buffer;
73};
74} // namespace DanielRudrich
void getReadPositions(int numSamples, int &startIndex, int &blockSize1, int &blockSize2)
void setDelayTime(float delayTimeInSeconds)
void getWritePositions(int numSamples, int &startIndex, int &blockSize1, int &blockSize2)
void prepare(const double sampleRate, const int blockSize)
void pushSamples(const float *src, const int numSamples)
void readSamples(float *dest, const int numSamples)
void getProcessPositions(int startIndex, int numSamples, int &blockSize1, int &blockSize2)