27 if (delayTimeInSeconds <= 0.0f)
30 delay = delayTimeInSeconds;
50 int startIndex, blockSize1, blockSize2;
55 for (
int i = 0; i < blockSize1; ++i)
56 buffer[startIndex + i] = src[i];
59 for (
int i = 0; i < blockSize2; ++i)
60 buffer[i] = src[blockSize1 + i];
83 float nextGainReductionValue = 0.0f;
90 index +=
static_cast<int> (
buffer.size());
99 for (
int i = 0; i < size1; ++i)
101 const float smpl =
buffer[index];
103 if (smpl > nextGainReductionValue)
105 buffer[index] = nextGainReductionValue;
106 nextGainReductionValue += step;
111 nextGainReductionValue = smpl + step;
119 index =
static_cast<int> (
buffer.size()) - 1;
122 for (
int i = 0; i < size2; ++i)
124 const float smpl =
buffer[index];
126 if (smpl > nextGainReductionValue)
128 buffer[index] = nextGainReductionValue;
129 nextGainReductionValue += step;
134 nextGainReductionValue = smpl + step;
147 index =
static_cast<int> (
buffer.size()) - 1;
155 bool breakWasUsed =
false;
158 for (
int i = 0; i < size1; ++i)
160 const float smpl =
buffer[index];
162 if (smpl > nextGainReductionValue)
164 buffer[index] = nextGainReductionValue;
165 nextGainReductionValue += step;
176 if (! breakWasUsed && size2 > 0)
178 index =
static_cast<int> (
buffer.size()) - 1;
179 for (
int i = 0; i < size2; ++i)
181 const float smpl =
buffer[index];
184 if (smpl > nextGainReductionValue)
186 buffer[index] = nextGainReductionValue;
187 nextGainReductionValue += step;
199 int startIndex, blockSize1, blockSize2;
204 for (
int i = 0; i < blockSize1; ++i)
205 dest[i] =
buffer[startIndex + i];
208 for (
int i = 0; i < blockSize2; ++i)
209 dest[blockSize1 + i] =
buffer[i];
222 blockSize1 =
std::min (startIndex + 1, numSamples);
223 numSamples -= blockSize1;
224 blockSize2 = numSamples <= 0 ? 0 : numSamples;
230 const int L =
static_cast<int> (
buffer.size());
246 blockSize1 =
std::min (L - pos, numSamples);
247 numSamples -= blockSize1;
248 blockSize2 = numSamples <= 0 ? 0 : numSamples;
254 const int L =
static_cast<int> (
buffer.size());
270 blockSize1 =
std::min (L - pos, numSamples);
271 numSamples -= blockSize1;
272 blockSize2 = numSamples <= 0 ? 0 : numSamples;
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)
std::vector< float > buffer
void getProcessPositions(int startIndex, int numSamples, int &blockSize1, int &blockSize2)