Skip to content

Commit

Permalink
Types update
Browse files Browse the repository at this point in the history
  • Loading branch information
austrianAudioJV committed Dec 4, 2023
1 parent 895b374 commit d918cfe
Show file tree
Hide file tree
Showing 4 changed files with 1,462 additions and 1,424 deletions.
29 changes: 18 additions & 11 deletions resources/Delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Delay : private ProcessorBase
{
public:

Delay() {};
Delay() {}

~Delay() override {} ;
~Delay() override {}

void setDelayTime (float delayTimeInSeconds)
{
Expand All @@ -67,18 +67,25 @@ class Delay : private ProcessorBase
prepare(spec);
}

const int getDelayInSamples()
unsigned int getDelayInSamples()
{
return bypassed ? 0 : delayInSamples;
if (bypassed)
{
return 0;
}
else
{
return delayInSamples;
}
}

void prepare (const ProcessSpec& specs) override
{
spec = specs;

delayInSamples = roundToInt(delay * specs.sampleRate);
delayInSamples = static_cast<unsigned int> (roundToInt (delay * specs.sampleRate));

buffer.setSize(specs.numChannels, specs.maximumBlockSize + delayInSamples);
buffer.setSize(static_cast<int> (specs.numChannels), static_cast<int> (specs.maximumBlockSize + delayInSamples));
buffer.clear();
writePosition = 0;
}
Expand All @@ -101,22 +108,22 @@ class Delay : private ProcessorBase
getReadWritePositions(false, (int) L, startIndex, blockSize1, blockSize2);

for (int ch = 0; ch < nCh; ch++)
buffer.copyFrom(ch, startIndex, abIn.getChannelPointer(ch), blockSize1);
buffer.copyFrom(ch, startIndex, abIn.getChannelPointer(static_cast<size_t> (ch)), blockSize1);

if (blockSize2 > 0)
for (int ch = 0; ch < nCh; ch++)
buffer.copyFrom(ch, 0, abIn.getChannelPointer(ch) + blockSize1, blockSize2);
buffer.copyFrom(ch, 0, abIn.getChannelPointer(static_cast<size_t> (ch)) + blockSize1, blockSize2);


// read from delay line
getReadWritePositions(true, (int) L, startIndex, blockSize1, blockSize2);

for (int ch = 0; ch < nCh; ch++)
FloatVectorOperations::copy(abOut.getChannelPointer(ch), buffer.getReadPointer(ch) + startIndex, blockSize1);
FloatVectorOperations::copy(abOut.getChannelPointer(static_cast<size_t> (ch)), buffer.getReadPointer(ch) + startIndex, blockSize1);

if (blockSize2 > 0)
for (int ch = 0; ch < nCh; ch++)
FloatVectorOperations::copy(abOut.getChannelPointer(ch) + blockSize1, buffer.getReadPointer(ch), blockSize2);
FloatVectorOperations::copy(abOut.getChannelPointer(static_cast<size_t> (ch)) + blockSize1, buffer.getReadPointer(ch), blockSize2);


writePosition += L;
Expand All @@ -135,7 +142,7 @@ class Delay : private ProcessorBase
int pos = writePosition;
if (read)
{
pos = writePosition - delayInSamples;
pos = static_cast<int> (static_cast<unsigned int> (writePosition) - delayInSamples);
}
if (pos < 0)
pos = pos + L;
Expand Down
1 change: 1 addition & 0 deletions source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ PolarDesignerAudioProcessorEditor::PolarDesignerAudioProcessorEditor (PolarDesig
zeroDelayModeChange();

addAndMakeVisible(&trimSlider);
trimSlider.addListener(this);

addAndMakeVisible(&tbTrimSliderCenterPointer);
tbTrimSliderCenterPointer.setButtonText("Trim Slider Pointer");
Expand Down
Loading

0 comments on commit d918cfe

Please sign in to comment.