1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Clang: Fix warnings when building with clang 10

This commit is contained in:
reuk 2020-06-29 19:59:58 +01:00
parent 286bb40a9e
commit 394c4fd475
144 changed files with 896 additions and 839 deletions

View file

@ -114,7 +114,7 @@ public:
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
auto centreY = getHeight() / 2.0f;
auto centreY = (float) getHeight() / 2.0f;
auto radius = amplitude * 200.0f;
if (radius >= 0.0f)
@ -131,8 +131,8 @@ public:
Path wavePath;
wavePath.startNewSubPath (0, centreY);
for (auto x = 1.0f; x < getWidth(); ++x)
wavePath.lineTo (x, centreY + amplitude * getHeight() * 2.0f
for (auto x = 1.0f; x < (float) getWidth(); ++x)
wavePath.lineTo (x, centreY + amplitude * (float) getHeight() * 2.0f
* std::sin (x * frequency * 0.0001f));
g.setColour (getLookAndFeel().findColour (Slider::thumbColourId));
@ -149,8 +149,8 @@ public:
{
lastMousePosition = e.position;
frequency = (getHeight() - e.y) * 10.0f;
amplitude = jmin (0.9f, 0.2f * e.position.x / getWidth());
frequency = (float) (getHeight() - e.y) * 10.0f;
amplitude = jmin (0.9f, 0.2f * e.position.x / (float) getWidth());
phaseDelta = (float) (MathConstants<double>::twoPi * frequency / sampleRate);

View file

@ -116,7 +116,7 @@ public:
if (thumbnail.getTotalLength() > 0)
{
auto newScale = jmax (0.001, thumbnail.getTotalLength() * (1.0 - jlimit (0.0, 0.99, amount)));
auto timeAtCentre = xToTime (getWidth() / 2.0f);
auto timeAtCentre = xToTime ((float) getWidth() / 2.0f);
setRange ({ timeAtCentre - newScale * 0.5, timeAtCentre + newScale * 0.5 });
}
@ -229,12 +229,12 @@ private:
if (visibleRange.getLength() <= 0)
return 0;
return getWidth() * (float) ((time - visibleRange.getStart()) / visibleRange.getLength());
return (float) getWidth() * (float) ((time - visibleRange.getStart()) / visibleRange.getLength());
}
double xToTime (const float x) const
{
return (x / getWidth()) * (visibleRange.getLength()) + visibleRange.getStart();
return (x / (float) getWidth()) * (visibleRange.getLength()) + visibleRange.getStart();
}
bool canMoveTransport() const noexcept

View file

@ -209,7 +209,7 @@ public:
auto noteDistance = float (getWidth()) / 128;
for (auto i = 0; i < 128; ++i)
{
auto x = noteDistance * i;
auto x = noteDistance * (float) i;
auto noteHeight = int (MidiMessage::isMidiNoteBlack (i) ? 0.7 * getHeight() : getHeight());
g.setColour (MidiMessage::isMidiNoteBlack (i) ? Colours::white : Colours::grey);
@ -302,8 +302,8 @@ private:
Point<float> getCentrePositionForNote (MPENote note) const
{
auto n = float (note.initialNote) + float (note.totalPitchbendInSemitones);
auto x = getWidth() * n / 128;
auto y = getHeight() * (1 - note.timbre.asUnsignedFloat());
auto x = (float) getWidth() * n / 128;
auto y = (float) getHeight() * (1 - note.timbre.asUnsignedFloat());
return { x, y };
}
@ -656,8 +656,8 @@ private:
auto xPos = zone.isLowerZone() ? 0 : zone.getLastMemberChannel() - 1;
Rectangle<int> zoneRect { int (channelWidth * (xPos)), 20,
int (channelWidth * (zone.numMemberChannels + 1)), getHeight() - 20 };
Rectangle<int> zoneRect { int (channelWidth * (float) xPos), 20,
int (channelWidth * (float) (zone.numMemberChannels + 1)), getHeight() - 20 };
g.setColour (zoneColour);
g.drawRect (zoneRect, 3);
@ -680,8 +680,8 @@ private:
auto numChannels = legacyModeChannelRange.getEnd() - startChannel - 1;
Rectangle<int> zoneRect (int (getChannelRectangleWidth() * startChannel), 0,
int (getChannelRectangleWidth() * numChannels), getHeight());
Rectangle<int> zoneRect (int (getChannelRectangleWidth() * (float) startChannel), 0,
int (getChannelRectangleWidth() * (float) numChannels), getHeight());
zoneRect.removeFromTop (20);
@ -694,7 +694,7 @@ private:
//==============================================================================
float getChannelRectangleWidth() const noexcept
{
return float (getWidth()) / numMidiChannels;
return (float) getWidth() / (float) numMidiChannels;
}
//==============================================================================

View file

@ -273,7 +273,7 @@ private:
g.setColour (textColour);
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
if (isInput)
{

View file

@ -201,11 +201,11 @@ public:
Path generateStringPath() const
{
auto y = height / 2.0f;
auto y = (float) height / 2.0f;
Path stringPath;
stringPath.startNewSubPath (0, y);
stringPath.quadraticTo (length / 2.0f, y + (std::sin (phase) * amplitude), (float) length, y);
stringPath.quadraticTo ((float) length / 2.0f, y + (std::sin (phase) * amplitude), (float) length, y);
return stringPath;
}
@ -227,7 +227,7 @@ public:
{
// this determines the visible vibration frequency.
// just an arbitrary number chosen to look OK:
auto phaseStep = 400.0f / length;
auto phaseStep = 400.0f / (float) length;
phase += phaseStep;
@ -337,7 +337,7 @@ private:
if (stringLine->getBounds().contains (e.getPosition()))
{
auto position = (e.position.x - stringLine->getX()) / stringLine->getWidth();
auto position = (e.position.x - (float) stringLine->getX()) / (float) stringLine->getWidth();
stringLine->stringPlucked (position);
stringSynths.getUnchecked (i)->stringPlucked (position);

View file

@ -162,7 +162,7 @@ public:
for (auto y = 1; y < imageHeight; ++y)
{
auto skewedProportionY = 1.0f - std::exp (std::log (y / (float) imageHeight) * 0.2f);
auto skewedProportionY = 1.0f - std::exp (std::log ((float) y / (float) imageHeight) * 0.2f);
auto fftDataIndex = jlimit (0, fftSize / 2, (int) (skewedProportionY * (int) fftSize / 2));
auto level = jmap (fftData[fftDataIndex], 0.0f, jmax (maxLevel.getEnd(), 1e-5f), 0.0f, 1.0f);