Skip to content

Commit

Permalink
LaF float
Browse files Browse the repository at this point in the history
  • Loading branch information
austrianAudioJV committed Dec 13, 2023
1 parent e1958e1 commit 66aa796
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion resources/customComponents/PolarPatternVisualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PolarPatternVisualizer : public TextButton
{
const float deg2rad = static_cast<float>(M_PI / 180.0f);
const int degStep = 4;
const int nLookUpSamples = 360;
// const int nLookUpSamples = 360;

public:
PolarPatternVisualizer()
Expand Down
94 changes: 47 additions & 47 deletions resources/lookAndFeel/AA_LaF.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,27 @@
class LaF : public LookAndFeel_V4
{
public:
const Colour AAGrey = Colour(180,180,185);
// const Colour AAGrey = Colour(180,180,185);
const Colour AARed = Colour(155,35,35);
const Colour ClBackground = Colour(0xFF2D2D2D);
const Colour ClFace = Colour(0xFFD8D8D8);
const Colour ClFaceShadow = Colour(0XFF272727);
const Colour ClFaceShadowOutline = Colour(0xFF212121);
const Colour ClFaceShadowOutlineActive = Colour(0xFF7C7C7C);
// const Colour ClFaceShadowOutlineActive = Colour(0xFF7C7C7C);
const Colour ClRotSliderArrow = Colour(0xFF4A4A4A);
const Colour ClRotSliderArrowShadow = Colour(0x445D5D5D);
const Colour ClSliderFace = Colour(0xFF191919);
const Colour ClText = Colour(0xFFFFFFFF);
const Colour ClTextTextboxbg = Colour(0xFF000000);
const Colour ClSeperator = Colour(0xFF979797);
const Colour ClWidgetColours[4] = {
Colour(0xFF00CAFF), Colour(0xFF4FFF00), Colour(0xFFFF9F00), Colour(0xFFD0011B)
};
// const Colour ClWidgetColours[4] = {
// Colour(0xFF00CAFF), Colour(0xFF4FFF00), Colour(0xFFFF9F00), Colour(0xFFD0011B)
// };

Typeface::Ptr aaLight, aaRegular, aaMedium, terminator;

//float sliderThumbDiameter = 14.0f;
float sliderBarSize = 8.0f;
// float sliderBarSize = 8.0f;

LaF()
{
Expand Down Expand Up @@ -105,7 +105,7 @@ class LaF : public LookAndFeel_V4

}

~LaF() override {}
~LaF() override = default;

Typeface::Ptr getTypefaceForFont (const Font& f) override
{
Expand Down Expand Up @@ -232,13 +232,13 @@ class LaF : public LookAndFeel_V4

void drawLabel (Graphics& g, Label& label) override
{
float alpha = label.isEnabled() ? 1.0f : 0.4f;
auto alpha = label.isEnabled() ? 1.0f : 0.4f;
g.fillAll (label.findColour (Label::backgroundColourId));
Rectangle<int> bounds = label.getLocalBounds();
float x = (float) bounds.getX();
float y = (float) bounds.getY();
float w = (float) bounds.getWidth();
float h = (float) bounds.getHeight();
auto x = (float) bounds.getX();
auto y = (float) bounds.getY();
auto w = (float) bounds.getWidth();
auto h = (float) bounds.getHeight();
Path p;
p.addRoundedRectangle(x, y, w, h, h/2.0f);
g.setColour (ClTextTextboxbg.withMultipliedAlpha(alpha));
Expand Down Expand Up @@ -372,7 +372,7 @@ class LaF : public LookAndFeel_V4

g.setColour (header.findColour (TableHeaderComponent::textColourId));
g.setFont (aaRegular);
g.setFont (height * 0.6f);
g.setFont (static_cast<float> (height) * 0.6f);
g.drawFittedText (columnName, area, Justification::centred, 1);
}

Expand All @@ -387,7 +387,7 @@ class LaF : public LookAndFeel_V4

if (style == Slider::LinearBar || style == Slider::LinearBarVertical)
{
const float fx = (float) x, fy = (float) y, fw = (float) width, fh = (float) height;
const auto fx = (float) x, fy = (float) y, fw = (float) width, fh = (float) height;

Path p;

Expand All @@ -404,7 +404,7 @@ class LaF : public LookAndFeel_V4
g.setColour (baseColour);
g.fillPath (p);

const float lineThickness = jmin (15.0f, jmin (width, height) * 0.45f) * 0.1f;
const auto lineThickness = jmin (15.0f, static_cast<float> (jmin (width, height)) * 0.45f) * 0.1f;
g.drawRect (slider.getLocalBounds().toFloat(), lineThickness);
}
else
Expand Down Expand Up @@ -434,29 +434,29 @@ class LaF : public LookAndFeel_V4

if (slider.isHorizontal())
{
const float iy = y + height * 0.5f - sliderRadius * 0.5f;
Rectangle<float> r (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius);
slbg.addRoundedRectangle (r,sliderRadius/2.0,sliderRadius/2.0);
const auto iy = static_cast<float> (static_cast<float> (y) + static_cast<float> (height) * 0.5f - sliderRadius * 0.5f);
Rectangle<float> r (static_cast<float> (static_cast<float> (x) - sliderRadius * 0.5f), iy, static_cast<float> (static_cast<float> (width) + sliderRadius), sliderRadius);
slbg.addRoundedRectangle (r,static_cast<float> (sliderRadius/2.0),static_cast<float> (sliderRadius/2.0));

if (isTwoValue)
{
clbar.addRoundedRectangle(
Rectangle<float>(Point<float>(minSliderPos, iy), Point<float>(maxSliderPos, iy+sliderRadius)),
sliderRadius/2.0,sliderRadius/2.0);
static_cast<float> (sliderRadius/2.0),static_cast<float> (sliderRadius/2.0));
}
else
{
clbar.addRoundedRectangle(
Rectangle<float>(Point<float>(static_cast<float> (x + width * (zeroPos)), iy), Point<float>(sliderPos, iy+sliderRadius)),
sliderRadius/2.0,sliderRadius/2.0);
static_cast<float> (sliderRadius/2.0),static_cast<float> (sliderRadius/2.0));
}
}
else
{
const float ix = x + width * 0.5f - sliderRadius * 0.5f;
Rectangle<float> r (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius);
slbg.addRoundedRectangle (r,sliderRadius/2.0,sliderRadius/2.0);
clbar.addRoundedRectangle(Rectangle<float>(Point<float>(ix+1.0f, static_cast<float> (y + height * (1.0f - zeroPos))), Point<float>(ix-1.0f+sliderRadius,sliderPos)),sliderRadius/2.0,sliderRadius/2.0);
const auto ix = static_cast<float> (static_cast<float> (x) + static_cast<float> (width) * 0.5f - sliderRadius * 0.5f);
Rectangle<float> r (ix, static_cast<float> (y) - sliderRadius * 0.5f, sliderRadius, static_cast<float> (height) + sliderRadius);
slbg.addRoundedRectangle (r,static_cast<float> (sliderRadius/2.0),static_cast<float> (sliderRadius/2.0));
clbar.addRoundedRectangle(Rectangle<float>(Point<float>(ix+1.0f, static_cast<float> (y + height * (1.0f - zeroPos))), Point<float>(ix-1.0f+sliderRadius,sliderPos)),static_cast<float> (sliderRadius/2.0),static_cast<float> (sliderRadius/2.0));
}


Expand Down Expand Up @@ -485,15 +485,15 @@ class LaF : public LookAndFeel_V4
{
bool isEnabled = slider.isEnabled();
const float alpha = isEnabled ? 1.0f : 0.4f;
const float radius = jmin (width / 2, height / 2);
const float centreX = x + width * 0.5f;
const float centreY = y + height * 0.5f;
const auto radius = static_cast<const float> (jmin (width / 2, height / 2));
const float centreX = static_cast<float> (x) + static_cast<float> (width) * 0.5f;
const float centreY = static_cast<float> (y) + static_cast<float> (height) * 0.5f;
const float rx = centreX - radius;
const float ry = centreY - radius;
const float rw = radius * 2.0f;

const float min = static_cast<const float> (slider.getMinimum());
const float max = static_cast<const float> (slider.getMaximum());
const auto min = static_cast<const float> (slider.getMinimum());
const auto max = static_cast<const float> (slider.getMaximum());
const float zeroPos = -min/(max-min);
const float zeroAngle =rotaryStartAngle + zeroPos * (rotaryEndAngle - rotaryStartAngle);
const float angle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
Expand Down Expand Up @@ -571,13 +571,13 @@ class LaF : public LookAndFeel_V4

if (style == Slider::LinearVertical)
{
kx = x + width * 0.5f;
kx = static_cast<float> (x + width) * 0.5f;
ky = sliderPos;
}
else
{
kx = sliderPos;
ky = y + height * 0.5f;
ky = static_cast<float>(y + height) * 0.5f;
}


Expand All @@ -591,13 +591,13 @@ class LaF : public LookAndFeel_V4
else if (style == Slider::TwoValueVertical)
{
drawRoundThumb (g,
jmax (sliderRadius, x + width * 0.5f),
jmax (sliderRadius, static_cast<float>(x + width) * 0.5f),
minSliderPos,
sliderRadius * 2.0f,
knobColour, outlineThickness);

drawRoundThumb (g,
jmax (sliderRadius, x + width * 0.5f),
jmax (sliderRadius, static_cast<float>(x + width) * 0.5f),
maxSliderPos,
sliderRadius * 2.0f,
knobColour, outlineThickness);
Expand All @@ -606,13 +606,13 @@ class LaF : public LookAndFeel_V4
{
drawRoundThumb (g,
minSliderPos,
jmax (sliderRadius, y + height * 0.5f),
jmax (sliderRadius, static_cast<float>(y + height) * 0.5f),
sliderRadius * 2.0f,
knobColour, outlineThickness);

drawRoundThumb (g,
maxSliderPos,
jmax (sliderRadius, y + height * 0.5f),
jmax (sliderRadius, static_cast<float>(y + height) * 0.5f),
sliderRadius * 2.0f,
knobColour, outlineThickness);

Expand Down Expand Up @@ -656,7 +656,7 @@ class LaF : public LookAndFeel_V4
void drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown) override
{
Rectangle<float> buttonArea(0.0f, 0.0f, button.getWidth(), button.getHeight());
Rectangle<float> buttonArea(0.0f, 0.0f, static_cast<float> (button.getWidth()), static_cast<float> (button.getHeight()));
buttonArea.reduce(1.0f, 1.0f);

g.setColour(backgroundColour);
Expand Down Expand Up @@ -714,8 +714,8 @@ class LaF : public LookAndFeel_V4
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.8f));


const float width = button.getWidth();
const float height = button.getHeight() ;
const auto width = static_cast<const float> (button.getWidth());
const auto height = static_cast<const float>(button.getHeight());
bool isOn = button.getToggleState();
const float cornerSize = jmin (15.0f, jmin (width, height) * 0.45f);

Expand All @@ -742,10 +742,10 @@ class LaF : public LookAndFeel_V4
else
{

const auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);
const auto fontSize = jmin (15.0f, static_cast<float> (button.getHeight()) * 0.75f);
const auto tickWidth = fontSize * 1.1f;

drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
drawTickBox (g, button, 4.0f, (static_cast<float> (button.getHeight()) - tickWidth) * 0.5f,
tickWidth, tickWidth,
button.getToggleState(),
button.isEnabled(),
Expand Down Expand Up @@ -821,7 +821,7 @@ class LaF : public LookAndFeel_V4
g.drawFittedText (text, r, position,1,0.f);

g.setColour(ClSeperator);
g.drawLine(0, 18, width, 18 ,.8f);
g.drawLine(0, 18, static_cast<float> (width), 18 ,.8f);
}
void positionComboBoxText (ComboBox& box, Label& label) override
{
Expand Down Expand Up @@ -852,9 +852,9 @@ class LaF : public LookAndFeel_V4

Rectangle<int> buttonArea (buttonX, buttonY, buttonW, buttonH);
Path path;
path.startNewSubPath (buttonX + 3.0f, buttonArea.getCentreY() - 2.0f);
path.lineTo (buttonArea.getCentreX(), buttonArea.getCentreY() + 3.0f);
path.lineTo (buttonArea.getRight() - 3.0f, buttonArea.getCentreY() - 2.0f);
path.startNewSubPath (static_cast<float> (buttonX) + 3.0f, static_cast<float> (buttonArea.getCentreY()) - 2.0f);
path.lineTo (static_cast<float> (buttonArea.getCentreX()), static_cast<float> (buttonArea.getCentreY()) + 3.0f);
path.lineTo (static_cast<float> (buttonArea.getRight()) - 3.0f, static_cast<float> (buttonArea.getCentreY()) - 2.0f);

g.setColour (Colours::white.withAlpha ((box.isEnabled() ? 0.9f : 0.2f)));
g.strokePath (path, PathStrokeType (2.0f));
Expand All @@ -867,7 +867,7 @@ class LaF : public LookAndFeel_V4
g.setColour (findColour (PopupMenu::headerTextColourId));

g.drawFittedText (sectionName,
area.getX() + 12, area.getY(), area.getWidth() - 16, (int) (area.getHeight() * 0.8f),
area.getX() + 12, area.getY(), area.getWidth() - 16, (int) (static_cast<float> (area.getHeight()) * 0.8f),
Justification::bottomLeft, 1);
}

Expand Down Expand Up @@ -916,7 +916,7 @@ class LaF : public LookAndFeel_V4
Font font (getPopupMenuFont());
font.setHeight(18.0f);

const float maxFontHeight = area.getHeight() / 1.3f;
const float maxFontHeight = static_cast<float> (area.getHeight()) / 1.3f;

if (font.getHeight() > maxFontHeight)
font.setHeight (maxFontHeight);
Expand All @@ -940,7 +940,7 @@ class LaF : public LookAndFeel_V4
const float arrowH = 0.6f * getPopupMenuFont().getAscent();

const float x = (float) r.removeFromRight ((int) arrowH).getX();
const float halfH = (float) r.getCentreY();
const auto halfH = static_cast<float>(r.getCentreY());

Path p;
p.addTriangle (x, halfH - arrowH * 0.5f,
Expand Down
4 changes: 2 additions & 2 deletions source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class PolarDesignerAudioProcessorEditor : public AudioProcessorEditor, private
const int maxNumberBands = 5;
int nActiveBands;
int syncChannelIdx;
int oldAbLayerState;
// int oldAbLayerState;

float trimSliderPrevPos = 0.22f;
float minBandValueDistances[5];
Expand All @@ -118,7 +118,7 @@ class PolarDesignerAudioProcessorEditor : public AudioProcessorEditor, private
int maxIt = 0;

bool loadingFile;
bool recordingDisturber;
// bool recordingDisturber;
bool presetListVisible;
bool presetLoaded = false;

Expand Down
2 changes: 1 addition & 1 deletion source/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class PolarDesignerAudioProcessor : public AudioProcessor, public AudioProcesso

std::atomic<float>* nBandsPtr;
std::atomic<float>* syncChannelPtr;
float oldSyncChannelPtr;
// float oldSyncChannelPtr;
std::atomic<float>* xOverFreqs[4];
std::atomic<float>* dirFactors[5];
float oldDirFactors[5];
Expand Down

0 comments on commit 66aa796

Please sign in to comment.