Skip to content

Commit

Permalink
type and casts dilemma continues...
Browse files Browse the repository at this point in the history
  • Loading branch information
austrianAudioJV committed Dec 7, 2023
1 parent 44627bf commit 8ebbd53
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
10 changes: 5 additions & 5 deletions resources/Delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Delay : private ProcessorBase
{
auto abIn = context.getInputBlock();
auto abOut = context.getOutputBlock();
auto L = abIn.getNumSamples();
size_t L = abIn.getNumSamples();
auto nCh = jmin((int) spec.numChannels, (int) abIn.getNumChannels());

int startIndex, blockSize1, blockSize2;
Expand Down Expand Up @@ -139,7 +139,7 @@ class Delay : private ProcessorBase
void getReadWritePositions (bool read, int numSamples, int& startIndex, int& blockSize1, int& blockSize2)
{
const int L = buffer.getNumSamples();
int pos = writePosition;
size_t pos = writePosition;
if (read)
{
pos = static_cast<int> (static_cast<unsigned int> (writePosition) - delayInSamples);
Expand All @@ -158,8 +158,8 @@ class Delay : private ProcessorBase
}
else
{
startIndex = pos;
blockSize1 = jmin (L - pos, numSamples);
startIndex = static_cast<int>(pos);
blockSize1 = jmin (static_cast<int>(L - pos), numSamples);
numSamples -= blockSize1;
blockSize2 = numSamples <= 0 ? 0 : numSamples;
}
Expand All @@ -171,6 +171,6 @@ class Delay : private ProcessorBase
float delay;
unsigned int delayInSamples = 0;
bool bypassed = false;
int writePosition = 0;
size_t writePosition = 0;
AudioBuffer<float> buffer;
};
32 changes: 18 additions & 14 deletions resources/lookAndFeel/AA_LaF.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,19 @@ class LaF : public LookAndFeel_V4

if (! label.isBeingEdited())
{
const float alpha = label.isEnabled() ? 1.0f : 0.5f;
const float editingAlpha = label.isEnabled() ? 1.0f : 0.5f;
const Font font (aaRegular);

//g.setColour (ClText.withMultipliedAlpha (alpha));
g.setColour (ClText.withMultipliedAlpha(alpha));
g.setColour (ClText.withMultipliedAlpha(editingAlpha));
g.setFont (getLabelFont(label));

Rectangle<int> textArea (label.getBorderSize().subtractedFrom (label.getLocalBounds()));

g.drawFittedText (label.getText(), textArea, label.getJustificationType(), 1,
label.getMinimumHorizontalScale());

g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (alpha));
g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (editingAlpha));
}
else if (label.isEnabled())
{
Expand All @@ -275,9 +275,9 @@ class LaF : public LookAndFeel_V4
g.setColour (Colours::white.withMultipliedAlpha(0.5f));

Path triangle;
triangle.startNewSubPath(w, h);
triangle.lineTo(0.5 * w, h);
triangle.lineTo(w, 0.5 * h);
triangle.startNewSubPath(static_cast<float>(w), static_cast<float>(h));
triangle.lineTo(static_cast<float>(0.5 * w), static_cast<float>(h));
triangle.lineTo(static_cast<float>(w), static_cast<float>(0.5 * h));
triangle.closeSubPath();

g.fillPath(triangle);
Expand All @@ -296,7 +296,7 @@ class LaF : public LookAndFeel_V4
else
{
Path p;
p.addRoundedRectangle(0, 0, width, height, 12.0f);
p.addRoundedRectangle(static_cast<float>(0), static_cast<float>(0), static_cast<float>(width), static_cast<float>(height), 12.0f);
//g.setColour (ClTextTextboxbg);
g.setColour (textEditor.findColour (TextEditor::backgroundColourId));
g.fillPath (p);
Expand All @@ -313,13 +313,13 @@ class LaF : public LookAndFeel_V4
if (textEditor.hasKeyboardFocus (true) && ! textEditor.isReadOnly())
{
g.setColour (Colours::white.withMultipliedAlpha(0.8f));
g.drawRoundedRectangle (0.5, 0.5, width-1, height-1, (height-1)/2.0f, 0.8);
g.drawRoundedRectangle (0.5, 0.5, static_cast<float>(width-1), static_cast<float>(height-1), static_cast<float>(height-1)/2.0f, 0.8f);

}
else
{
g.setColour (Colours::white.withMultipliedAlpha(0.8f));
g.drawRoundedRectangle (0, 0, width, height, height/2.0f, 0);
g.drawRoundedRectangle (0, 0, static_cast<float>(width), static_cast<float>(height), static_cast<float>(height)/2.0f, 0);
}
}
}
Expand Down Expand Up @@ -425,9 +425,9 @@ class LaF : public LookAndFeel_V4
Colour statusColour = slider.findColour(Slider::rotarySliderOutlineColourId).withMultipliedAlpha (0.8f);


const float min = slider.getMinimum();
const float max = slider.getMaximum();
const float zeroPos = -min/(max-min);
const double min = slider.getMinimum();
const double max = slider.getMaximum();
const auto zeroPos = -min/(max-min);
bool isTwoValue = (style == Slider::SliderStyle::TwoValueVertical || style == Slider::SliderStyle::TwoValueHorizontal);

if (slider.isHorizontal())
Expand All @@ -438,11 +438,15 @@ class LaF : public LookAndFeel_V4

if (isTwoValue)
{
clbar.addRoundedRectangle(Rectangle<float>(Point<float>(minSliderPos, iy), Point<float>(maxSliderPos, iy+sliderRadius)),sliderRadius/2.0,sliderRadius/2.0);
clbar.addRoundedRectangle(
Rectangle<float>(Point<float>(minSliderPos, iy), Point<float>(maxSliderPos, iy+sliderRadius)),
sliderRadius/2.0,sliderRadius/2.0);
}
else
{
clbar.addRoundedRectangle(Rectangle<float>(Point<float>(x+width*zeroPos, iy), Point<float>(sliderPos, iy+sliderRadius)),sliderRadius/2.0,sliderRadius/2.0);
clbar.addRoundedRectangle(
Rectangle<float>(Point<float>(x+width*zeroPos, iy), Point<float>(sliderPos, iy+sliderRadius)),
sliderRadius/2.0,sliderRadius/2.0);
}
}
else
Expand Down

0 comments on commit 8ebbd53

Please sign in to comment.