Browse Source

Clang: Fix warnings when building with clang 10

tags/2021-05-28
reuk 5 years ago
parent
commit
394c4fd475
100 changed files with 367 additions and 360 deletions
  1. +5
    -5
      examples/Audio/AudioAppDemo.h
  2. +3
    -3
      examples/Audio/AudioPlaybackDemo.h
  3. +8
    -8
      examples/Audio/MPEDemo.h
  4. +1
    -1
      examples/Audio/MidiDemo.h
  5. +4
    -4
      examples/Audio/PluckedStringsDemo.h
  6. +1
    -1
      examples/Audio/SimpleFFTDemo.h
  7. +2
    -2
      examples/BLOCKS/BlocksDrawingDemo.h
  8. +28
    -28
      examples/BLOCKS/BlocksMonitorDemo.h
  9. +3
    -3
      examples/BLOCKS/BlocksSynthDemo.h
  10. +8
    -12
      examples/CMakeLists.txt
  11. +4
    -4
      examples/DemoRunner/Source/Demos/IntroScreen.h
  12. +4
    -4
      examples/DemoRunner/Source/Main.cpp
  13. +2
    -2
      examples/DemoRunner/Source/UI/SettingsContent.h
  14. +4
    -4
      examples/GUI/AnimationAppDemo.h
  15. +5
    -5
      examples/GUI/AnimationDemo.h
  16. +5
    -5
      examples/GUI/BouncingBallWavetableDemo.h
  17. +2
    -2
      examples/GUI/FontsDemo.h
  18. +21
    -21
      examples/GUI/GraphicsDemo.h
  19. +23
    -23
      examples/GUI/LookAndFeelDemo.h
  20. +1
    -1
      examples/GUI/MenusDemo.h
  21. +2
    -2
      examples/GUI/OpenGLAppDemo.h
  22. +11
    -8
      examples/GUI/OpenGLDemo.h
  23. +1
    -1
      examples/GUI/WidgetsDemo.h
  24. +5
    -5
      examples/GUI/WindowsDemo.h
  25. +1
    -1
      examples/Plugins/AUv3SynthPluginDemo.h
  26. +8
    -8
      examples/Plugins/InterAppAudioEffectPluginDemo.h
  27. +3
    -3
      examples/Plugins/SamplerPluginDemo.h
  28. +5
    -1
      examples/Utilities/Box2DDemo.h
  29. +2
    -2
      examples/Utilities/InAppPurchasesDemo.h
  30. +2
    -2
      examples/Utilities/MultithreadingDemo.h
  31. +2
    -2
      examples/Utilities/XMLandJSONDemo.h
  32. +2
    -2
      extras/AudioPerformanceTest/Source/MainComponent.h
  33. +2
    -2
      extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp
  34. +4
    -4
      extras/NetworkGraphicsDemo/Source/MasterComponent.h
  35. +2
    -2
      extras/NetworkGraphicsDemo/Source/SlaveComponent.h
  36. +2
    -2
      extras/Projucer/Source/Application/UserAccount/jucer_LoginFormComponent.h
  37. +2
    -1
      extras/Projucer/Source/Application/jucer_MainWindow.cpp
  38. +1
    -1
      extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h
  39. +4
    -4
      extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h
  40. +1
    -1
      extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp
  41. +1
    -1
      extras/Projucer/Source/ComponentEditor/Components/jucer_TreeViewHandler.h
  42. +1
    -1
      extras/Projucer/Source/ComponentEditor/PaintElements/jucer_FillType.h
  43. +1
    -1
      extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementUndoableAction.h
  44. +2
    -2
      extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PointComponent.h
  45. +1
    -1
      extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h
  46. +2
    -2
      extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp
  47. +6
    -6
      extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h
  48. +1
    -1
      extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h
  49. +2
    -2
      extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h
  50. +4
    -4
      extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h
  51. +2
    -2
      extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h
  52. +3
    -3
      extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp
  53. +4
    -4
      extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h
  54. +1
    -1
      extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h
  55. +1
    -1
      extras/Projucer/Source/Utility/Helpers/jucer_VersionInfo.h
  56. +1
    -1
      extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h
  57. +1
    -1
      extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp
  58. +1
    -1
      extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h
  59. +2
    -2
      extras/Projucer/Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp
  60. +4
    -4
      modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp
  61. +2
    -2
      modules/juce_audio_basics/buffers/juce_AudioDataConverters.h
  62. +3
    -3
      modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp
  63. +1
    -1
      modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.cpp
  64. +1
    -1
      modules/juce_audio_basics/utilities/juce_Interpolators.cpp
  65. +6
    -4
      modules/juce_audio_basics/utilities/juce_Interpolators.h
  66. +1
    -1
      modules/juce_audio_basics/utilities/juce_SmoothedValue.h
  67. +6
    -6
      modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp
  68. +4
    -4
      modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
  69. +1
    -1
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  70. +2
    -2
      modules/juce_audio_formats/format/juce_AudioFormatReader.cpp
  71. +12
    -12
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  72. +8
    -8
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  73. +1
    -1
      modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
  74. +1
    -1
      modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp
  75. +1
    -1
      modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp
  76. +1
    -1
      modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp
  77. +1
    -1
      modules/juce_audio_processors/utilities/juce_AudioParameterChoice.cpp
  78. +1
    -1
      modules/juce_audio_processors/utilities/juce_AudioParameterFloat.cpp
  79. +8
    -8
      modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp
  80. +3
    -3
      modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp
  81. +1
    -1
      modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp
  82. +16
    -16
      modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp
  83. +2
    -2
      modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h
  84. +3
    -3
      modules/juce_blocks_basics/topology/internal/juce_ConnectedDeviceGroup.cpp
  85. +4
    -4
      modules/juce_blocks_basics/topology/internal/juce_Detector.cpp
  86. +5
    -5
      modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp
  87. +2
    -2
      modules/juce_core/files/juce_DirectoryIterator.cpp
  88. +1
    -1
      modules/juce_core/files/juce_File.cpp
  89. +1
    -1
      modules/juce_core/javascript/juce_Javascript.cpp
  90. +1
    -1
      modules/juce_core/maths/juce_Random.cpp
  91. +1
    -1
      modules/juce_core/native/juce_linux_SystemStats.cpp
  92. +1
    -1
      modules/juce_core/time/juce_PerformanceCounter.cpp
  93. +2
    -2
      modules/juce_core/time/juce_RelativeTime.cpp
  94. +1
    -1
      modules/juce_core/time/juce_Time.cpp
  95. +8
    -8
      modules/juce_dsp/filter_design/juce_FilterDesign.cpp
  96. +1
    -1
      modules/juce_dsp/frequency/juce_FFT.cpp
  97. +3
    -2
      modules/juce_dsp/frequency/juce_Windowing.cpp
  98. +1
    -1
      modules/juce_dsp/maths/juce_LookupTable.h
  99. +4
    -4
      modules/juce_dsp/processors/juce_Oversampling.cpp
  100. +8
    -8
      modules/juce_graphics/colour/juce_Colour.cpp

+ 5
- 5
examples/Audio/AudioAppDemo.h 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);


+ 3
- 3
examples/Audio/AudioPlaybackDemo.h 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


+ 8
- 8
examples/Audio/MPEDemo.h 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;
}
//==============================================================================


+ 1
- 1
examples/Audio/MidiDemo.h View File

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


+ 4
- 4
examples/Audio/PluckedStringsDemo.h 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);


+ 1
- 1
examples/Audio/SimpleFFTDemo.h 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);


+ 2
- 2
examples/BLOCKS/BlocksDrawingDemo.h View File

@@ -403,8 +403,8 @@ public:
if (auto grid = activeBlock->getLEDGrid())
{
// Work out scale factors to translate X and Y touches to LED indexes
scaleX = (float) (grid->getNumColumns() - 1) / activeBlock->getWidth();
scaleY = (float) (grid->getNumRows() - 1) / activeBlock->getHeight();
scaleX = (float) (grid->getNumColumns() - 1) / (float) activeBlock->getWidth();
scaleY = (float) (grid->getNumRows() - 1) / (float) activeBlock->getHeight();
setLEDProgram (*activeBlock);
}


+ 28
- 28
examples/BLOCKS/BlocksMonitorDemo.h View File

@@ -188,11 +188,11 @@ public:
case e::north:
return { 0.0f, static_cast<float> (port.index) };
case e::east:
return { static_cast<float> (-1.0f - port.index), static_cast<float> (block->getWidth()) };
return { static_cast<float> (-1.0f - (float) port.index), static_cast<float> (block->getWidth()) };
case e::south:
return { static_cast<float> (0.0f - block->getHeight()), static_cast<float> (port.index) };
return { static_cast<float> (0.0f - (float) block->getHeight()), static_cast<float> (port.index) };
case e::west:
return { static_cast<float> (-1.0f - port.index), 0.0f };
return { static_cast<float> (-1.0f - (float) port.index), 0.0f };
default:
break;
}
@@ -204,13 +204,13 @@ public:
switch (port.edge)
{
case e::north:
return { static_cast<float> (-1.0f - port.index), 0.0f };
return { static_cast<float> (-1.0f - (float) port.index), 0.0f };
case e::east:
return { static_cast<float> (0.0f - block->getWidth()), static_cast<float> (-1.0f - port.index) };
return { static_cast<float> (0.0f - (float) block->getWidth()), static_cast<float> (-1.0f - (float) port.index) };
case e::south:
return { static_cast<float> (-1.0f - port.index), static_cast<float> (0.0f - block->getHeight()) };
return { static_cast<float> (-1.0f - (float) port.index), static_cast<float> (0.0f - (float) block->getHeight()) };
case e::west:
return { 0.0f, static_cast<float> (-1.0f - port.index) };
return { 0.0f, static_cast<float> (-1.0f - (float) port.index) };
default:
break;
}
@@ -222,11 +222,11 @@ public:
switch (port.edge)
{
case e::north:
return { 0.0f, static_cast<float> (-1.0f - port.index) };
return { 0.0f, static_cast<float> (-1.0f - (float) port.index) };
case e::east:
return { static_cast<float> (port.index), static_cast<float> (0 - block->getWidth()) };
return { static_cast<float> (port.index), static_cast<float> (0 - (float) block->getWidth()) };
case e::south:
return { static_cast<float> (block->getHeight()), static_cast<float> (-1.0f - port.index) };
return { static_cast<float> (block->getHeight()), static_cast<float> (-1.0f - (float) port.index) };
case e::west:
return { static_cast<float> (port.index), 0.0f };
default:
@@ -309,10 +309,10 @@ public:
g.fillAll (Colours::black);
// size ration between physical and on-screen blocks
Point<float> ratio (r.getWidth() / block->getWidth(),
r.getHeight() / block->getHeight());
Point<float> ratio (r.getWidth() / (float) block->getWidth(),
r.getHeight() / (float) block->getHeight());
auto maxCircleSize = block->getWidth() / 3.0f;
auto maxCircleSize = (float) block->getWidth() / 3.0f;
// iterate over the list of current touches and draw them on the onscreen Block
for (auto touch : touches)
@@ -367,7 +367,7 @@ public:
addAndMakeVisible (roundedRectangleButton);
// Display the battery level on the LEDRow
auto numLedsToTurnOn = static_cast<int> (numLeds * block->getBatteryLevel());
auto numLedsToTurnOn = static_cast<int> ((float) numLeds * block->getBatteryLevel());
// add LEDs
for (auto i = 0; i < numLeds; ++i)
@@ -442,7 +442,7 @@ public:
void handleBatteryLevelUpdate (float batteryLevel) override
{
// Update the number of LEDs that are on to represent the battery level
auto numLedsOn = static_cast<int> (numLeds * batteryLevel);
auto numLedsOn = static_cast<int> ((float) numLeds * batteryLevel);
if (numLedsOn != previousNumLedsOn)
for (auto i = 0; i < numLeds; ++i)
@@ -600,11 +600,11 @@ public:
noBlocksLabel.setJustificationType (Justification::centred);
zoomOutButton.setButtonText ("+");
zoomOutButton.onClick = [this] { blockUnitInPixels = (int) (blockUnitInPixels * 1.05f); resized(); };
zoomOutButton.onClick = [this] { blockUnitInPixels = (int) ((float) blockUnitInPixels * 1.05f); resized(); };
zoomOutButton.setAlwaysOnTop (true);
zoomInButton.setButtonText ("-");
zoomInButton.onClick = [this] { blockUnitInPixels = (int) (blockUnitInPixels * 0.95f); resized(); };
zoomInButton.onClick = [this] { blockUnitInPixels = (int) ((float) blockUnitInPixels * 0.95f); resized(); };
zoomInButton.setAlwaysOnTop (true);
// Register BlocksMonitorDemo as a listener to the PhysicalTopologySource object
@@ -670,8 +670,8 @@ public:
else if (rotation == 90)
blockSize = blockComponent->block->getHeight();
if (topLeft.x - blockSize < maxArea.getX())
maxArea.setX (topLeft.x - blockSize);
if (topLeft.x - (float) blockSize < maxArea.getX())
maxArea.setX (topLeft.x - (float) blockSize);
blockSize = 0;
if (rotation == 0)
@@ -679,8 +679,8 @@ public:
else if (rotation == 270)
blockSize = blockComponent->block->getHeight();
if (topLeft.x + blockSize > maxArea.getRight())
maxArea.setWidth (topLeft.x + blockSize);
if (topLeft.x + (float) blockSize > maxArea.getRight())
maxArea.setWidth (topLeft.x + (float) blockSize);
blockSize = 0;
if (rotation == 180)
@@ -688,8 +688,8 @@ public:
else if (rotation == 270)
blockSize = blockComponent->block->getWidth();
if (topLeft.y - blockSize < maxArea.getY())
maxArea.setY (topLeft.y - blockSize);
if (topLeft.y - (float) blockSize < maxArea.getY())
maxArea.setY (topLeft.y - (float) blockSize);
blockSize = 0;
if (rotation == 0)
@@ -697,14 +697,14 @@ public:
else if (rotation == 90)
blockSize = blockComponent->block->getWidth();
if (topLeft.y + blockSize > maxArea.getBottom())
maxArea.setHeight (topLeft.y + blockSize);
if (topLeft.y + (float) blockSize > maxArea.getBottom())
maxArea.setHeight (topLeft.y + (float) blockSize);
}
auto totalWidth = std::abs (maxArea.getX()) + maxArea.getWidth();
auto totalHeight = std::abs (maxArea.getY()) + maxArea.getHeight();
blockUnitInPixels = static_cast<int> (jmin ((getHeight() / totalHeight) - 50, (getWidth() / totalWidth) - 50));
blockUnitInPixels = static_cast<int> (jmin (((float) getHeight() / totalHeight) - 50, ((float) getWidth() / totalWidth) - 50));
masterBlockComponent->centreWithSize (masterBlockComponent->block->getWidth() * blockUnitInPixels,
masterBlockComponent->block->getHeight() * blockUnitInPixels);
@@ -721,8 +721,8 @@ public:
if (blockComponent == masterBlockComponent)
continue;
blockComponent->setBounds (masterBlockComponent->getX() + static_cast<int> (blockComponent->topLeft.x * blockUnitInPixels),
masterBlockComponent->getY() + static_cast<int> (blockComponent->topLeft.y * blockUnitInPixels),
blockComponent->setBounds (masterBlockComponent->getX() + static_cast<int> (blockComponent->topLeft.x * (float) blockUnitInPixels),
masterBlockComponent->getY() + static_cast<int> (blockComponent->topLeft.y * (float) blockUnitInPixels),
blockComponent->block->getWidth() * blockUnitInPixels,
blockComponent->block->getHeight() * blockUnitInPixels);


+ 3
- 3
examples/BLOCKS/BlocksSynthDemo.h View File

@@ -665,8 +665,8 @@ public:
if (auto grid = activeBlock->getLEDGrid())
{
// Work out scale factors to translate X and Y touches to LED indexes
scaleX = static_cast<float> (grid->getNumColumns() - 1) / activeBlock->getWidth();
scaleY = static_cast<float> (grid->getNumRows() - 1) / activeBlock->getHeight();
scaleX = static_cast<float> (grid->getNumColumns() - 1) / (float) activeBlock->getWidth();
scaleY = static_cast<float> (grid->getNumRows() - 1) / (float) activeBlock->getHeight();
setLEDProgram (*activeBlock);
}
@@ -731,7 +731,7 @@ private:
layout.touchColour);
// Send pitch change and pressure values to the Audio class
audio.pitchChange (midiChannel, (touch.x - touch.startX) / activeBlock->getWidth());
audio.pitchChange (midiChannel, (touch.x - touch.startX) / (float) activeBlock->getWidth());
audio.pressureChange (midiChannel, touch.z);
}


+ 8
- 12
examples/CMakeLists.txt View File

@@ -31,23 +31,19 @@ function(_juce_add_pips)
CONFIGURE_DEPENDS LIST_DIRECTORIES false
"${CMAKE_CURRENT_SOURCE_DIR}/*.h")

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(REMOVE_ITEM headers
"${CMAKE_CURRENT_SOURCE_DIR}/CameraDemo.h"
"${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h"
"${CMAKE_CURRENT_SOURCE_DIR}/VideoDemo.h")
endif()

foreach(header IN ITEMS ${headers})
juce_add_pip(${header} added_target)
target_link_libraries(${added_target} PRIVATE
target_link_libraries(${added_target} PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)

get_target_property(active_targets ${added_target} JUCE_ACTIVE_PLUGIN_TARGETS)

if(active_targets)
foreach(plugin_target IN LISTS active_targets)
target_link_libraries(${plugin_target} PRIVATE
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
endforeach()
endif()
endforeach()
endfunction()



+ 4
- 4
examples/DemoRunner/Source/Demos/IntroScreen.h View File

@@ -80,13 +80,13 @@ private:
Path wavePath;
auto waveStep = 10.0f;
auto waveY = getHeight() * 0.44f;
auto waveY = (float) getHeight() * 0.44f;
int i = 0;
for (auto x = waveStep * 0.5f; x < getWidth(); x += waveStep)
for (auto x = waveStep * 0.5f; x < (float) getWidth(); x += waveStep)
{
auto y1 = waveY + getHeight() * 0.05f * std::sin (i * 0.38f + elapsed);
auto y2 = waveY + getHeight() * 0.10f * std::sin (i * 0.20f + elapsed * 2.0f);
auto y1 = waveY + (float) getHeight() * 0.05f * std::sin ((float) i * 0.38f + elapsed);
auto y2 = waveY + (float) getHeight() * 0.10f * std::sin ((float) i * 0.20f + elapsed * 2.0f);
wavePath.addLineSegment ({ x, y1, x, y2 }, 2.0f);
wavePath.addEllipse (x - waveStep * 0.3f, y1 - waveStep * 0.3f, waveStep * 0.6f, waveStep * 0.6f);


+ 4
- 4
examples/DemoRunner/Source/Main.cpp View File

@@ -131,10 +131,10 @@ private:
setFullScreen (true);
Desktop::getInstance().setOrientationsEnabled (Desktop::rotatedClockwise | Desktop::rotatedAntiClockwise);
#else
setBounds ((int) (0.1f * getParentWidth()),
(int) (0.1f * getParentHeight()),
jmax (850, (int) (0.5f * getParentWidth())),
jmax (600, (int) (0.7f * getParentHeight())));
setBounds ((int) (0.1f * (float) getParentWidth()),
(int) (0.1f * (float) getParentHeight()),
jmax (850, (int) (0.5f * (float) getParentWidth())),
jmax (600, (int) (0.7f * (float) getParentHeight())));
#endif
setContentOwned (new MainComponent(), false);


+ 2
- 2
examples/DemoRunner/Source/UI/SettingsContent.h View File

@@ -119,8 +119,8 @@ private:
graphicsTitleLabel.setBounds (bounds.removeFromTop (30));
bounds.removeFromTop (space);
auto xPos = bounds.getX() + (bounds.getWidth() * 0.35f);
auto width = bounds.getWidth() * 0.6f;
auto xPos = (float) bounds.getX() + ((float) bounds.getWidth() * 0.35f);
auto width = (float) bounds.getWidth() * 0.6f;
lookAndFeelSelector.setBounds (bounds.removeFromTop (itemHeight).withWidth ((int) width).withX ((int) xPos));


+ 4
- 4
examples/GUI/AnimationAppDemo.h View File

@@ -80,13 +80,13 @@ public:
for (auto i = 0; i < fishLength; ++i)
{
auto radius = 100 + 10 * std::sin (getFrameCounter() * 0.1f + i * 0.5f);
auto radius = 100 + 10 * std::sin ((float) getFrameCounter() * 0.1f + (float) i * 0.5f);
Point<float> p (getWidth() / 2.0f + 1.5f * radius * std::sin (getFrameCounter() * 0.02f + i * 0.12f),
getHeight() / 2.0f + 1.0f * radius * std::cos (getFrameCounter() * 0.04f + i * 0.12f));
Point<float> p ((float) getWidth() / 2.0f + 1.5f * radius * std::sin ((float) getFrameCounter() * 0.02f + (float) i * 0.12f),
(float) getHeight() / 2.0f + 1.0f * radius * std::cos ((float) getFrameCounter() * 0.04f + (float) i * 0.12f));
// draw the circles along the fish
g.fillEllipse (p.x - i, p.y - i, 2.0f + 2.0f * i, 2.0f + 2.0f * i);
g.fillEllipse (p.x - (float) i, p.y - (float) i, 2.0f + 2.0f * (float) i, 2.0f + 2.0f * (float) i);
if (i == 0)
spinePath.startNewSubPath (p); // if this is the first point, start a new path..


+ 5
- 5
examples/GUI/AnimationDemo.h View File

@@ -123,10 +123,10 @@ struct BallComponent : public Component
void paint (Graphics& g) override
{
g.setColour (colour);
g.fillEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f);
g.fillEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f);
g.setColour (Colours::darkgrey);
g.drawEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f, 1.0f);
g.drawEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f, 1.0f);
}
Point<float> position, speed;
@@ -262,10 +262,10 @@ private:
auto newIndex = (componentsToAnimate.indexOf (component) + 3 * cycleCount)
% componentsToAnimate.size();
auto angle = newIndex * MathConstants<float>::twoPi / componentsToAnimate.size();
auto angle = (float) newIndex * MathConstants<float>::twoPi / (float) componentsToAnimate.size();
auto radius = useWidth ? width * 0.35f
: height * 0.35f;
auto radius = useWidth ? (float) width * 0.35f
: (float) height * 0.35f;
Rectangle<int> r (getWidth() / 2 + (int) (radius * std::sin (angle)) - 50,
getHeight() / 2 + (int) (radius * std::cos (angle)) - 50,


+ 5
- 5
examples/GUI/BouncingBallWavetableDemo.h View File

@@ -125,13 +125,13 @@ public:
auto nextPos = pos + delta;
if (nextPos.x < 10 || nextPos.x + 10 > getWidth())
if (nextPos.x < 10 || nextPos.x + 10 > (float) getWidth())
{
delta.x = -delta.x;
nextPos.x = pos.x + delta.x;
}
if (nextPos.y < 50 || nextPos.y + 10 > getHeight())
if (nextPos.y < 50 || nextPos.y + 10 > (float) getHeight())
{
delta.y = -delta.y;
nextPos.y = pos.y + delta.y;
@@ -234,17 +234,17 @@ public:
float amplitudeToY (float amp) const noexcept
{
return getHeight() - (amp + 1.0f) * getHeight() / 2.0f;
return (float) getHeight() - (amp + 1.0f) * (float) getHeight() / 2.0f;
}
float xToAmplitude (float x) const noexcept
{
return jlimit (-1.0f, 1.0f, 2.0f * (getWidth() - x) / getWidth() - 1.0f);
return jlimit (-1.0f, 1.0f, 2.0f * ((float) getWidth() - x) / (float) getWidth() - 1.0f);
}
float yToAmplitude (float y) const noexcept
{
return jlimit (-1.0f, 1.0f, 2.0f * (getHeight() - y) / getHeight() - 1.0f);
return jlimit (-1.0f, 1.0f, 2.0f * ((float) getHeight() - y) / (float) getHeight() - 1.0f);
}
void timerCallback() override


+ 2
- 2
examples/GUI/FontsDemo.h View File

@@ -197,8 +197,8 @@ public:
AttributedString s;
s.setWordWrap (AttributedString::none);
s.setJustification (Justification::centredLeft);
s.append (font.getTypefaceName(), font.withHeight (height * 0.7f), Colours::black);
s.append (" " + font.getTypefaceName(), Font (height * 0.5f, Font::italic), Colours::grey);
s.append (font.getTypefaceName(), font.withHeight ((float) height * 0.7f), Colours::black);
s.append (" " + font.getTypefaceName(), Font ((float) height * 0.5f, Font::italic), Colours::grey);
s.draw (g, Rectangle<int> (width, height).expanded (-4, 50).toFloat());
}


+ 21
- 21
examples/GUI/GraphicsDemo.h View File

@@ -125,8 +125,8 @@ public:
AffineTransform getTransform()
{
auto hw = 0.5f * getWidth();
auto hh = 0.5f * getHeight();
auto hw = 0.5f * (float) getWidth();
auto hh = 0.5f * (float) getHeight();
AffineTransform t;
@@ -197,7 +197,7 @@ public:
"Time: " + String (averageTimeMs, 2)
+ " ms\nEffective FPS: " + String (effectiveFPS, 1)
+ "\nActual FPS: " + String (averageActualFPS, 1),
0, 10.0f, getWidth() - 10.0f, (float) getHeight(), Justification::topRight, 3);
0, 10.0f, (float) getWidth() - 10.0f, (float) getHeight(), Justification::topRight, 3);
g.setColour (Colours::white.withAlpha (0.5f));
g.fillRect (ga.getBoundingBox (0, ga.getNumGlyphs(), true).getSmallestIntegerContainer().expanded (4));
@@ -213,8 +213,8 @@ public:
auto w = getWidth() / 2;
auto h = getHeight() / 2;
auto x = (int) (w * clipRectX.getValue());
auto y = (int) (h * clipRectY.getValue());
auto x = (int) ((float) w * clipRectX.getValue());
auto y = (int) ((float) h * clipRectY.getValue());
g.reduceClipRegion (x, y, w, h);
}
@@ -239,12 +239,12 @@ public:
if (! clipImage.isValid())
createClipImage();
AffineTransform transform (AffineTransform::translation (clipImage.getWidth() / -2.0f,
clipImage.getHeight() / -2.0f)
AffineTransform transform (AffineTransform::translation ((float) clipImage.getWidth() / -2.0f,
(float) clipImage.getHeight() / -2.0f)
.rotated (clipImageAngle.getValue() * MathConstants<float>::twoPi)
.scaled (2.0f + clipImageSize.getValue() * 3.0f)
.translated (getWidth() * 0.5f,
getHeight() * 0.5f));
.translated ((float) getWidth() * 0.5f,
(float) getHeight() * 0.5f));
g.reduceClipRegion (clipImage, transform);
}
@@ -297,17 +297,17 @@ public:
g.fillRect (-rectSize, -rectSize, rectSize, rectSize);
g.setGradientFill (ColourGradient (colour1, 10.0f, (float) -rectSize,
colour2, 10.0f + rectSize, 0.0f, false));
colour2, 10.0f + (float) rectSize, 0.0f, false));
g.setOpacity (getAlpha());
g.fillRect (10, -rectSize, rectSize, rectSize);
g.setGradientFill (ColourGradient (colour1, rectSize * -0.5f, 10.0f + rectSize * 0.5f,
colour2, 0, 10.0f + rectSize, true));
g.setGradientFill (ColourGradient (colour1, (float) rectSize * -0.5f, 10.0f + (float) rectSize * 0.5f,
colour2, 0, 10.0f + (float) rectSize, true));
g.setOpacity (getAlpha());
g.fillRect (-rectSize, 10, rectSize, rectSize);
g.setGradientFill (ColourGradient (colour1, 10.0f, 10.0f,
colour2, 10.0f + rectSize, 10.0f + rectSize, false));
colour2, 10.0f + (float) rectSize, 10.0f + (float) rectSize, false));
g.setOpacity (getAlpha());
g.drawRect (10, 10, rectSize, rectSize, 5);
}
@@ -349,10 +349,10 @@ public:
Colour c2 (gradientColours[3].getValue(), gradientColours[4].getValue(), gradientColours[5].getValue(), 1.0f);
Colour c3 (gradientColours[6].getValue(), gradientColours[7].getValue(), gradientColours[8].getValue(), 1.0f);
auto x1 = gradientPositions[0].getValue() * getWidth() * 0.25f;
auto y1 = gradientPositions[1].getValue() * getHeight() * 0.25f;
auto x2 = gradientPositions[2].getValue() * getWidth() * 0.75f;
auto y2 = gradientPositions[3].getValue() * getHeight() * 0.75f;
auto x1 = gradientPositions[0].getValue() * (float) getWidth() * 0.25f;
auto y1 = gradientPositions[1].getValue() * (float) getHeight() * 0.25f;
auto x2 = gradientPositions[2].getValue() * (float) getWidth() * 0.75f;
auto y2 = gradientPositions[3].getValue() * (float) getHeight() * 0.75f;
ColourGradient gradient (c1, x1, y1,
c2, x2, y2,
@@ -530,8 +530,8 @@ public:
for (int x = 0; x < getWidth(); ++x)
{
auto y = getHeight() * 0.3f;
auto length = y * std::abs (std::sin (x / 100.0f + 2.0f * pos));
auto y = (float) getHeight() * 0.3f;
auto length = y * std::abs (std::sin ((float) x / 100.0f + 2.0f * pos));
verticalLines.addWithoutMerging (Rectangle<float> ((float) x, y - length * 0.5f, 1.0f, length));
}
@@ -547,8 +547,8 @@ public:
for (int y = 0; y < getHeight(); ++y)
{
auto x = getWidth() * 0.3f;
auto length = x * std::abs (std::sin (y / 100.0f + 2.0f * pos));
auto x = (float) getWidth() * 0.3f;
auto length = x * std::abs (std::sin ((float) y / 100.0f + 2.0f * pos));
horizontalLines.addWithoutMerging (Rectangle<float> (x - length * 0.5f, (float) y, length, 1.0f));
}


+ 23
- 23
examples/GUI/LookAndFeelDemo.h View File

@@ -90,8 +90,8 @@ struct CustomLookAndFeel : public LookAndFeel_V4
auto flatOnTop = button.isConnectedOnTop();
auto flatOnBottom = button.isConnectedOnBottom();
auto width = button.getWidth() - 1.0f;
auto height = button.getHeight() - 1.0f;
auto width = (float) button.getWidth() - 1.0f;
auto height = (float) button.getHeight() - 1.0f;
if (width > 0 && height > 0)
{
@@ -168,13 +168,13 @@ struct CustomLookAndFeel : public LookAndFeel_V4
if (style == Slider::LinearVertical)
{
kx = x + width * 0.5f;
kx = (float) x + (float) width * 0.5f;
ky = sliderPos;
}
else
{
kx = sliderPos;
ky = y + height * 0.5f;
ky = (float) y + (float) height * 0.5f;
}
auto outlineThickness = slider.isEnabled() ? 0.8f : 0.3f;
@@ -203,9 +203,9 @@ struct CustomLookAndFeel : public LookAndFeel_V4
Path p;
if (style == Slider::LinearBarVertical)
p.addRectangle ((float) x, sliderPos, (float) width, 1.0f + height - sliderPos);
p.addRectangle ((float) x, sliderPos, (float) width, 1.0f + (float) height - sliderPos);
else
p.addRectangle ((float) x, (float) y, sliderPos - x, (float) height);
p.addRectangle ((float) x, (float) y, sliderPos - (float) x, (float) height);
auto baseColour = slider.findColour (Slider::rotarySliderFillColourId)
.withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f)
@@ -214,7 +214,7 @@ struct CustomLookAndFeel : public LookAndFeel_V4
g.setColour (baseColour);
g.fillPath (p);
auto lineThickness = jmin (15.0f, jmin (width, height) * 0.45f) * 0.1f;
auto lineThickness = jmin (15.0f, (float) jmin (width, height) * 0.45f) * 0.1f;
g.drawRect (slider.getLocalBounds().toFloat(), lineThickness);
}
else
@@ -230,13 +230,13 @@ struct CustomLookAndFeel : public LookAndFeel_V4
float /*maxSliderPos*/,
const Slider::SliderStyle /*style*/, Slider& slider) override
{
auto sliderRadius = getSliderThumbRadius (slider) - 5.0f;
auto sliderRadius = (float) getSliderThumbRadius (slider) - 5.0f;
Path on, off;
if (slider.isHorizontal())
{
auto iy = y + height * 0.5f - sliderRadius * 0.5f;
Rectangle<float> r (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius);
auto iy = (float) y + (float) height * 0.5f - sliderRadius * 0.5f;
Rectangle<float> r ((float) x - sliderRadius * 0.5f, iy, (float) width + sliderRadius, sliderRadius);
auto onW = r.getWidth() * ((float) slider.valueToProportionOfLength (slider.getValue()));
on.addRectangle (r.removeFromLeft (onW));
@@ -244,8 +244,8 @@ struct CustomLookAndFeel : public LookAndFeel_V4
}
else
{
auto ix = x + width * 0.5f - sliderRadius * 0.5f;
Rectangle<float> r (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius);
auto ix = (float) x + (float) width * 0.5f - sliderRadius * 0.5f;
Rectangle<float> r (ix, (float) y - sliderRadius * 0.5f, sliderRadius, (float) height + sliderRadius);
auto onH = r.getHeight() * ((float) slider.valueToProportionOfLength (slider.getValue()));
on.addRectangle (r.removeFromBottom (onH));
@@ -262,9 +262,9 @@ struct CustomLookAndFeel : public LookAndFeel_V4
void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override
{
auto radius = jmin (width / 2, height / 2) - 2.0f;
auto centreX = x + width * 0.5f;
auto centreY = y + height * 0.5f;
auto radius = (float) jmin (width / 2, height / 2) - 2.0f;
auto centreX = (float) x + (float) width * 0.5f;
auto centreY = (float) y + (float) height * 0.5f;
auto rx = centreX - radius;
auto ry = centreY - radius;
auto rw = radius * 2.0f;
@@ -283,7 +283,7 @@ struct CustomLookAndFeel : public LookAndFeel_V4
}
{
auto lineThickness = jmin (15.0f, jmin (width, height) * 0.45f) * 0.1f;
auto lineThickness = jmin (15.0f, (float) jmin (width, height) * 0.45f) * 0.1f;
Path outlineArc;
outlineArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, rotaryEndAngle, 0.0);
g.strokePath (outlineArc, PathStrokeType (lineThickness));
@@ -307,8 +307,8 @@ struct SquareLookAndFeel : public CustomLookAndFeel
if (isButtonDown || isMouseOverButton)
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.1f);
auto width = button.getWidth() - 1.0f;
auto height = button.getHeight() - 1.0f;
auto width = (float) button.getWidth() - 1.0f;
auto height = (float) button.getHeight() - 1.0f;
if (width > 0 && height > 0)
{
@@ -372,14 +372,14 @@ struct SquareLookAndFeel : public CustomLookAndFeel
if (style == Slider::LinearVertical)
{
kx = x + width * 0.5f;
kx = (float) x + (float) width * 0.5f;
ky = sliderPos;
g.fillRect (Rectangle<float> (kx - sliderRadius, ky - 2.5f, sliderRadius * 2.0f, 5.0f));
}
else
{
kx = sliderPos;
ky = y + height * 0.5f;
ky = (float) y + (float) height * 0.5f;
g.fillRect (Rectangle<float> (kx - 2.5f, ky - sliderRadius, 5.0f, sliderRadius * 2.0f));
}
}
@@ -393,10 +393,10 @@ struct SquareLookAndFeel : public CustomLookAndFeel
void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override
{
auto diameter = jmin (width, height) - 4.0f;
auto diameter = (float) jmin (width, height) - 4.0f;
auto radius = (diameter / 2.0f) * std::cos (MathConstants<float>::pi / 4.0f);
auto centreX = x + width * 0.5f;
auto centreY = y + height * 0.5f;
auto centreX = (float) x + (float) width * 0.5f;
auto centreY = (float) y + (float) height * 0.5f;
auto rx = centreX - radius;
auto ry = centreY - radius;
auto rw = radius * 2.0f;


+ 1
- 1
examples/GUI/MenusDemo.h View File

@@ -102,7 +102,7 @@ private:
burgerButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20));
titleLabel.setFont (Font (getHeight() * 0.5f, Font::plain));
titleLabel.setFont (Font ((float) getHeight() * 0.5f, Font::plain));
titleLabel.setBounds (r);
}


+ 2
- 2
examples/GUI/OpenGLAppDemo.h View File

@@ -92,7 +92,7 @@ public:
Matrix3D<float> getViewMatrix() const
{
Matrix3D<float> viewMatrix ({ 0.0f, 0.0f, -10.0f });
Matrix3D<float> rotationMatrix = viewMatrix.rotation ({ -0.3f, 5.0f * std::sin (getFrameCounter() * 0.01f), 0.0f });
Matrix3D<float> rotationMatrix = viewMatrix.rotation ({ -0.3f, 5.0f * std::sin ((float) getFrameCounter() * 0.01f), 0.0f });
return rotationMatrix * viewMatrix;
}
@@ -107,7 +107,7 @@ public:
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glViewport (0, 0, roundToInt (desktopScale * getWidth()), roundToInt (desktopScale * getHeight()));
glViewport (0, 0, roundToInt (desktopScale * (float) getWidth()), roundToInt (desktopScale * (float) getHeight()));
shader->use();


+ 11
- 8
examples/GUI/OpenGLDemo.h View File

@@ -655,7 +655,10 @@ struct OpenGLUtils
g.drawRect (0, 0, size, size, 2);
g.setColour (Colours::green);
g.fillEllipse (x.getValue() * size * 0.9f, y.getValue() * size * 0.9f, size * 0.1f, size * 0.1f);
g.fillEllipse (x.getValue() * (float) size * 0.9f,
y.getValue() * (float) size * 0.9f,
(float) size * 0.1f,
(float) size * 0.1f);
g.setColour (Colours::black);
g.setFont (40);
@@ -827,7 +830,7 @@ public:
openGLContext.extensions.glActiveTexture (GL_TEXTURE0);
glEnable (GL_TEXTURE_2D);
glViewport (0, 0, roundToInt (desktopScale * getWidth()), roundToInt (desktopScale * getHeight()));
glViewport (0, 0, roundToInt (desktopScale * (float) getWidth()), roundToInt (desktopScale * (float) getHeight()));
texture.bind();
@@ -913,8 +916,8 @@ private:
{
// Create an OpenGLGraphicsContext that will draw into this GL window..
std::unique_ptr<LowLevelGraphicsContext> glRenderer (createOpenGLGraphicsContext (openGLContext,
roundToInt (desktopScale * getWidth()),
roundToInt (desktopScale * getHeight())));
roundToInt (desktopScale * (float) getWidth()),
roundToInt (desktopScale * (float) getHeight())));
if (glRenderer.get() != nullptr)
{
@@ -927,11 +930,11 @@ private:
// This stuff just creates a spinning star shape and fills it..
Path p;
p.addStar ({ getWidth() * s.x.getValue(),
getHeight() * s.y.getValue() },
p.addStar ({ (float) getWidth() * s.x.getValue(),
(float) getHeight() * s.y.getValue() },
7,
getHeight() * size * 0.5f,
getHeight() * size,
(float) getHeight() * size * 0.5f,
(float) getHeight() * size,
s.angle.getValue());
auto hue = s.hue.getValue();


+ 1
- 1
examples/GUI/WidgetsDemo.h View File

@@ -1106,7 +1106,7 @@ private:
g.fillAll (Colours::lightblue);
g.setColour (LookAndFeel::getDefaultLookAndFeel().findColour (Label::textColourId));
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
g.drawText ("Draggable Thing #" + String (rowNumber + 1),
5, 0, width, height,


+ 5
- 5
examples/GUI/WindowsDemo.h View File

@@ -116,7 +116,7 @@ public:
Random random;
auto size = 10.0f + random.nextInt (30);
auto size = 10.0f + (float) random.nextInt (30);
ballBounds.setBounds (random.nextFloat() * 100.0f,
random.nextFloat() * 100.0f,
@@ -142,10 +142,10 @@ public:
{
ballBounds += direction;
if (ballBounds.getX() < 0) direction.x = std::abs (direction.x);
if (ballBounds.getY() < 0) direction.y = std::abs (direction.y);
if (ballBounds.getRight() > getParentWidth()) direction.x = -std::abs (direction.x);
if (ballBounds.getBottom() > getParentHeight()) direction.y = -std::abs (direction.y);
if (ballBounds.getX() < 0) direction.x = std::abs (direction.x);
if (ballBounds.getY() < 0) direction.y = std::abs (direction.y);
if (ballBounds.getRight() > (float) getParentWidth()) direction.x = -std::abs (direction.x);
if (ballBounds.getBottom() > (float) getParentHeight()) direction.y = -std::abs (direction.y);
setBounds (ballBounds.getSmallestIntegerContainer());
}


+ 1
- 1
examples/Plugins/AUv3SynthPluginDemo.h View File

@@ -115,7 +115,7 @@ public:
sliderPos = (sliderPos - minSliderPos) / static_cast<float> (width);
auto knobPos = static_cast<int> (sliderPos * r.getWidth());
auto knobPos = static_cast<int> (sliderPos * (float) r.getWidth());
g.setColour (sliderActivePart);
g.fillRect (backgroundBar.removeFromLeft (knobPos));


+ 8
- 8
examples/Plugins/InterAppAudioEffectPluginDemo.h View File

@@ -303,7 +303,7 @@ private:
Path rewindShape;
rewindShape.addRectangle (0.0, 0.0, 5.0, buttonSize);
rewindShape.addTriangle (0.0, buttonSize / 2, buttonSize, 0.0, buttonSize, buttonSize);
rewindShape.addTriangle (0.0, buttonSize * 0.5f, buttonSize, 0.0, buttonSize, buttonSize);
rewindButton.setShape (rewindShape, true, true, false);
rewindButton.onClick = [this]
{
@@ -383,19 +383,19 @@ private:
area.removeFromLeft (20);
transportText.setBounds (area.removeFromTop (120));
auto navigationArea = area.removeFromTop (buttonSize);
auto navigationArea = area.removeFromTop ((int) buttonSize);
rewindButton.setTopLeftPosition (navigationArea.getPosition());
navigationArea.removeFromLeft (buttonSize + 10);
navigationArea.removeFromLeft ((int) buttonSize + 10);
playButton.setTopLeftPosition (navigationArea.getPosition());
navigationArea.removeFromLeft (buttonSize + 10);
navigationArea.removeFromLeft ((int) buttonSize + 10);
recordButton.setTopLeftPosition (navigationArea.getPosition());
area.removeFromTop (30);
auto appSwitchArea = area.removeFromTop (buttonSize);
auto appSwitchArea = area.removeFromTop ((int) buttonSize);
switchToHostButtonLabel.setBounds (appSwitchArea.removeFromLeft (100));
appSwitchArea.removeFromLeft (5);
switchToHostButton.setBounds (appSwitchArea.removeFromLeft (buttonSize));
switchToHostButton.setBounds (appSwitchArea.removeFromLeft ((int) buttonSize));
}
private:
@@ -513,7 +513,7 @@ private:
if (visible)
{
auto icon = hostType.getHostIcon (buttonSize);
auto icon = hostType.getHostIcon ((int) buttonSize);
switchToHostButton.setImages(false, true, true,
icon, 1.0, Colours::transparentBlack,
icon, 1.0, Colours::transparentBlack,
@@ -525,7 +525,7 @@ private:
IAAEffectProcessor& iaaEffectProcessor;
AudioProcessorValueTreeState& parameters;
const int buttonSize = 30;
const float buttonSize = 30.0f;
const Colour defaultButtonColour = Colours::darkgrey;
ShapeButton rewindButton {"Rewind", defaultButtonColour, defaultButtonColour, defaultButtonColour};
ShapeButton playButton {"Play", defaultButtonColour, defaultButtonColour, defaultButtonColour};


+ 3
- 3
examples/Plugins/SamplerPluginDemo.h View File

@@ -1005,7 +1005,7 @@ public:
double getSampleLengthSeconds() const
{
if (auto r = getSampleReader())
return r->lengthInSamples / r->sampleRate;
return (double) r->lengthInSamples / r->sampleRate;
return 1.0;
}
@@ -1538,7 +1538,7 @@ private:
void paint (Graphics& g) override
{
auto minDivisionWidth = 50.0f;
auto maxDivisions = getWidth() / minDivisionWidth;
auto maxDivisions = (float) getWidth() / minDivisionWidth;
auto lookFeel = dynamic_cast<LookAndFeel_V4*> (&getLookAndFeel());
auto bg = lookFeel->getCurrentColourScheme()
@@ -1593,7 +1593,7 @@ private:
{
// Work out the scale of the new range
auto unitDistance = 100.0f;
auto scaleFactor = 1.0 / std::pow (2, e.getDistanceFromDragStartY() / unitDistance);
auto scaleFactor = 1.0 / std::pow (2, (float) e.getDistanceFromDragStartY() / unitDistance);
// Now position it so that the mouse continues to point at the same
// place on the ruler.


+ 5
- 1
examples/Utilities/Box2DDemo.h View File

@@ -88,11 +88,15 @@ struct Test
std::unique_ptr<b2World> m_world { new b2World (b2Vec2 (0.0f, -10.0f)) };
};
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wimplicit-int-float-conversion")
#include "../Assets/Box2DTests/AddPair.h"
#include "../Assets/Box2DTests/ApplyForce.h"
#include "../Assets/Box2DTests/Dominos.h"
#include "../Assets/Box2DTests/Chain.h"
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
//==============================================================================
/** This list box just displays a StringArray and broadcasts a change message when the
selected row changes.
@@ -118,7 +122,7 @@ public:
lf.findColour (ListBox::backgroundColourId)));
g.setColour (lf.findColour (ListBox::textColourId));
g.setFont (h * 0.7f);
g.setFont ((float) h * 0.7f);
g.drawText (tests[row], Rectangle<int> (0, 0, w, h).reduced (2),
Justification::centredLeft, true);
}


+ 2
- 2
examples/Utilities/InAppPurchasesDemo.h View File

@@ -275,7 +275,7 @@ public:
Rectangle<int> r (0, 0, w, h);
auto& lf = Desktop::getInstance().getDefaultLookAndFeel();
g.setColour (lf.findColour (isSelected ? TextEditor::highlightColourId : ListBox::backgroundColourId));
g.setColour (lf.findColour (isSelected ? (int) TextEditor::highlightColourId : (int) ListBox::backgroundColourId));
g.fillRect (r);
g.setColour (lf.findColour (ListBox::textColourId));
@@ -461,7 +461,7 @@ public:
auto r = Rectangle<int> (0, 0, w, h).reduced (4);
auto& lf = Desktop::getInstance().getDefaultLookAndFeel();
g.setColour (lf.findColour (isSelected ? TextEditor::highlightColourId : ListBox::backgroundColourId));
g.setColour (lf.findColour (isSelected ? (int) TextEditor::highlightColourId : (int) ListBox::backgroundColourId));
g.fillRect (r);
}


+ 2
- 2
examples/Utilities/MultithreadingDemo.h View File

@@ -121,8 +121,8 @@ private:
{
const ScopedLock lock (drawing);
parentWidth = comp.getWidth() - size;
parentHeight = comp.getHeight() - size;
parentWidth = (float) comp.getWidth() - size;
parentHeight = (float) comp.getHeight() - size;
}
float x = 0.0f, y = 0.0f,


+ 2
- 2
examples/Utilities/XMLandJSONDemo.h View File

@@ -75,7 +75,7 @@ public:
// use a "colour" attribute in the xml tag for this node to set the text colour..
g.setColour (Colour::fromString (xml.getStringAttribute ("colour", "ff000000")));
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
// draw the xml element's tag name..
g.drawText (xml.getTagName(),
@@ -145,7 +145,7 @@ public:
g.fillAll (Colours::blue.withAlpha (0.3f));
g.setColour (Colours::black);
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
// draw the element's tag name..
g.drawText (getText(),


+ 2
- 2
extras/AudioPerformanceTest/Source/MainComponent.h View File

@@ -245,13 +245,13 @@ private:
//==============================================================================
static double getPreciseTimeMs() noexcept
{
return 1000.0 * Time::getHighResolutionTicks() / (double) Time::getHighResolutionTicksPerSecond();
return 1000.0 * (double) Time::getHighResolutionTicks() / (double) Time::getHighResolutionTicksPerSecond();
}
//==============================================================================
double getPhysicalTimeLimitMs() const noexcept
{
return 1000.0 * a.size() / currentSampleRate;
return 1000.0 * (double) a.size() / currentSampleRate;
}
//==============================================================================


+ 2
- 2
extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp View File

@@ -139,7 +139,7 @@ struct GraphEditorPanel::PinComponent : public Component,
auto colour = (pin.isMIDI() ? Colours::red : Colours::green);
g.setColour (colour.withRotatedHue (busIdx / 5.0f));
g.setColour (colour.withRotatedHue ((float) busIdx / 5.0f));
g.fillPath (p);
}
@@ -963,7 +963,7 @@ struct GraphDocumentComponent::TooltipBar : public Component,
void paint (Graphics& g) override
{
g.setFont (Font (getHeight() * 0.7f, Font::bold));
g.setFont (Font ((float) getHeight() * 0.7f, Font::bold));
g.setColour (Colours::black);
g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1);
}


+ 4
- 4
extras/NetworkGraphicsDemo/Source/MasterComponent.h View File

@@ -256,8 +256,8 @@ private:
{
auto total = currentCanvas.getLimits();
return { getWidth() * (p.x - total.getX()) / total.getWidth(),
getHeight() * (p.y - total.getY()) / total.getHeight() };
return { (float) getWidth() * (p.x - total.getX()) / total.getWidth(),
(float) getHeight() * (p.y - total.getY()) / total.getHeight() };
}
Rectangle<float> virtualSpaceToLocal (Rectangle<float> p) const
@@ -270,8 +270,8 @@ private:
{
auto total = currentCanvas.getLimits();
return { total.getX() + total.getWidth() * (p.x / getWidth()),
total.getY() + total.getHeight() * (p.y / getHeight()) };
return { total.getX() + total.getWidth() * (p.x / (float) getWidth()),
total.getY() + total.getHeight() * (p.y / (float) getHeight()) };
}
//==============================================================================


+ 2
- 2
extras/NetworkGraphicsDemo/Source/SlaveComponent.h View File

@@ -80,8 +80,8 @@ private:
OSCMessage message (userInputOSCAddress);
message.addString (clientName);
message.addFloat32 (e.position.x * clientArea.getWidth() / getWidth() + clientArea.getX());
message.addFloat32 (e.position.y * clientArea.getHeight() / getHeight() + clientArea.getY());
message.addFloat32 (e.position.x * clientArea.getWidth() / (float) getWidth() + clientArea.getX());
message.addFloat32 (e.position.y * clientArea.getHeight() / (float) getHeight() + clientArea.getY());
send (message);
}


+ 2
- 2
extras/Projucer/Source/Application/UserAccount/jucer_LoginFormComponent.h View File

@@ -104,8 +104,8 @@ public:
passwordBox.setBounds (bounds.removeFromTop (textEditorHeight));
bounds.removeFromTop (spacing * 2);
emailBox.setFont (Font (textEditorHeight / 2.5f));
passwordBox.setFont (Font (textEditorHeight / 2.5f));
emailBox.setFont (Font ((float) textEditorHeight / 2.5f));
passwordBox.setFont (Font ((float) textEditorHeight / 2.5f));
logInButton.setBounds (bounds.removeFromTop (textEditorHeight));


+ 2
- 1
extras/Projucer/Source/Application/jucer_MainWindow.cpp View File

@@ -97,7 +97,8 @@ private:
auto parentBounds = mainWindow.getBounds();
componentImage = mainWindow.createComponentSnapshot (mainWindow.getLocalBounds())
.rescaled (roundToInt (parentBounds.getWidth() / 1.75f), roundToInt (parentBounds.getHeight() / 1.75f));
.rescaled (roundToInt ((float) parentBounds.getWidth() / 1.75f),
roundToInt ((float) parentBounds.getHeight() / 1.75f));
kernel.applyToImage (componentImage, componentImage, getLocalBounds());


+ 1
- 1
extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h View File

@@ -53,7 +53,7 @@ public:
}
auto area = RectanglePlacement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize)
.appliedTo (contentBounds, Rectangle<float> (4.0f, 22.0f, getWidth() - 8.0f, getHeight() - 26.0f));
.appliedTo (contentBounds, Rectangle<float> (4.0f, 22.0f, (float) getWidth() - 8.0f, (float) getHeight() - 26.0f));
Path p;
p.addRectangle (area);


+ 4
- 4
extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h View File

@@ -150,7 +150,7 @@ private:
const auto charArea = codeEditor->getCharacterBounds (startPosition);
const int height = charArea.getHeight() + 8;
Font f (height * 0.7f);
Font f ((float) height * 0.7f);
const int width = jmin (height * 2 + f.getStringWidth (launchButton.getName()),
jmax (120, codeEditor->proportionOfWidth (0.2f)));
@@ -191,7 +191,7 @@ private:
.draw (g, r.removeFromLeft (getHeight()).toFloat(), false);
g.setColour (Colours::white);
g.setFont (getHeight() * 0.7f);
g.setFont ((float) getHeight() * 0.7f);
g.drawFittedText (getName(), r, Justification::centredLeft, 1);
}
@@ -324,9 +324,9 @@ private:
g.fillRect (getLocalBounds().withTrimmedBottom (lineOffset));
Path path;
const float bottomY = getHeight() - (lineOffset / 2.0f);
const float bottomY = (float) getHeight() - ((float) lineOffset / 2.0f);
path.addTriangle ((float) arrowXMin, bottomY,
(arrowXMax + arrowXMin) / 2.0f, (float) lineOffset,
(float) (arrowXMax + arrowXMin) / 2.0f, (float) lineOffset,
(float) arrowXMax, bottomY);
g.setColour (diagColour.withAlpha (0.8f));


+ 1
- 1
extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp View File

@@ -403,7 +403,7 @@ public:
void paint (Graphics& g) override
{
Path outline;
outline.addRoundedRectangle (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 8.0f);
outline.addRoundedRectangle (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 8.0f);
g.setColour (Colours::black.withAlpha (0.6f));
g.fillPath (outline);


+ 1
- 1
extras/Projucer/Source/ComponentEditor/Components/jucer_TreeViewHandler.h View File

@@ -146,7 +146,7 @@ private:
g.fillAll (Colours::lightblue);
g.setColour (Colours::black);
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
g.drawText (name, 4, 0, width - 4, height, Justification::centredLeft, true);
}


+ 1
- 1
extras/Projucer/Source/ComponentEditor/PaintElements/jucer_FillType.h View File

@@ -407,7 +407,7 @@ private:
Graphics g (image);
g.fillCheckerBoard (image.getBounds().toFloat(),
image.getWidth() * 0.5f, image.getHeight() * 0.5f,
(float) image.getWidth() * 0.5f, (float) image.getHeight() * 0.5f,
Colours::white, Colours::lightgrey);
g.setFont (12.0f);


+ 1
- 1
extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementUndoableAction.h View File

@@ -83,7 +83,7 @@ protected:
void changed() const
{
jassert (routine.getDocument() != 0);
jassert (routine.getDocument() != nullptr);
routine.getDocument()->changed();
}


+ 2
- 2
extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PointComponent.h View File

@@ -57,10 +57,10 @@ public:
void paint (Graphics& g) override
{
g.setColour (Colours::white);
g.drawEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f, 2.0f);
g.drawEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f, 2.0f);
g.setColour (Colours::black);
g.drawEllipse (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 2.0f);
g.drawEllipse (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 2.0f);
}
//==============================================================================


+ 1
- 1
extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h View File

@@ -66,7 +66,7 @@ public:
Colour (0xffffffff).overlaidWith (colour));
g.setColour (Colours::white.overlaidWith (colour).contrasting());
g.setFont (Font (getHeight() * 0.6f, Font::bold));
g.setFont (Font ((float) getHeight() * 0.6f, Font::bold));
g.drawFittedText (colour.toDisplayString (true),
2, 1, getWidth() - 4, getHeight() - 1,
Justification::centred, 1);


+ 2
- 2
extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp View File

@@ -78,7 +78,7 @@ public:
g.setColour (findColour (defaultTextColourId));
}
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row],
30, 0, width - 32, height,
Justification::centredLeft, true);
@@ -1037,7 +1037,7 @@ bool JucerDocumentEditor::perform (const InvocationInfo& info)
else if (info.commandID == JucerCommandIDs::compOverlay100)
amount = 100;
document->setComponentOverlayOpacity (amount * 0.01f);
document->setComponentOverlayOpacity ((float) amount * 0.01f);
}
break;


+ 6
- 6
extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h View File

@@ -74,8 +74,8 @@ public:
*/
PositionedRectangle() noexcept
: x (0.0), y (0.0), w (0.0), h (0.0),
xMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
yMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
xMode ((int) anchorAtLeftOrTop | (int) absoluteFromParentTopLeft),
yMode ((int) anchorAtLeftOrTop | (int) absoluteFromParentTopLeft),
wMode (absoluteSize), hMode (absoluteSize)
{
}
@@ -283,23 +283,23 @@ public:
const SizeMode widthMode, const SizeMode heightMode,
const Rectangle<int>& target) noexcept
{
if (xMode != (xAnchor | xMode_) || wMode != widthMode)
if (xMode != ((int) xAnchor | (int) xMode_) || wMode != widthMode)
{
double tx, tw;
applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth());
xMode = (uint8) (xAnchor | xMode_);
xMode = (uint8) ((int) xAnchor | (int) xMode_);
wMode = (uint8) widthMode;
updatePosAndSize (x, w, tx, tw, xMode, wMode, target.getX(), target.getWidth());
}
if (yMode != (yAnchor | yMode_) || hMode != heightMode)
if (yMode != ((int) yAnchor | (int) yMode_) || hMode != heightMode)
{
double ty, th;
applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight());
yMode = (uint8) (yAnchor | yMode_);
yMode = (uint8) ((int) yAnchor | (int) yMode_);
hMode = (uint8) heightMode;
updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight());


+ 1
- 1
extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h View File

@@ -65,7 +65,7 @@ public:
{
g.setColour (findColour (defaultTextColourId));
g.setFont (height * 0.7f);
g.setFont ((float) height * 0.7f);
g.drawText (activities [rowNumber],
4, 0, width - 5, height, Justification::centredLeft, true);
}


+ 2
- 2
extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h View File

@@ -206,14 +206,14 @@ public:
jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels()));
concertinaPanel.setPanelSize (concertinaPanel.getPanel (panelIndex),
roundToInt (prop * (concertinaPanel.getHeight() - 90)), false);
roundToInt (prop * (float) (concertinaPanel.getHeight() - 90)), false);
}
float getPanelHeightProportion (int panelIndex)
{
jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels()));
return ((float) (concertinaPanel.getPanel (panelIndex)->getHeight()) / (concertinaPanel.getHeight() - 90));
return ((float) (concertinaPanel.getPanel (panelIndex)->getHeight()) / (float) (concertinaPanel.getHeight() - 90));
}
private:


+ 4
- 4
extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h View File

@@ -60,7 +60,7 @@ public:
for (auto s : columnHeaders)
{
addAndMakeVisible (headers.add (new Label (s, s)));
widths.add (1.0f / columnHeaders.size());
widths.add (1.0f / (float) columnHeaders.size());
}
setSize (200, 40);
@@ -90,7 +90,7 @@ public:
auto index = 0;
for (auto h : headers)
{
auto headerWidth = roundToInt (width * widths.getUnchecked (index));
auto headerWidth = roundToInt ((float) width * widths.getUnchecked (index));
h->setBounds (bounds.removeFromLeft (headerWidth));
++index;
}
@@ -114,7 +114,7 @@ public:
for (int i = 0; i < index; ++i)
prop += widths.getUnchecked (i);
return roundToInt (prop * getWidth());
return roundToInt (prop * (float) getWidth());
}
float getProportionAtIndex (int index)
@@ -372,7 +372,7 @@ private:
if (availableTextWidth == 0)
return 0;
return static_cast<int> (nameWidth / availableTextWidth);
return static_cast<int> (nameWidth / (float) availableTextWidth);
}
//==============================================================================


+ 2
- 2
extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h View File

@@ -155,7 +155,7 @@ private:
{
if (header != nullptr)
{
auto textBounds = getLocalBounds().removeFromLeft (roundToInt (header->getProportionAtIndex (0) * getWidth()));
auto textBounds = getLocalBounds().removeFromLeft (roundToInt (header->getProportionAtIndex (0) * (float) getWidth()));
auto iconBounds = textBounds.removeFromLeft (25);
@@ -175,7 +175,7 @@ private:
if (header != nullptr)
{
auto bounds = getLocalBounds();
auto width = getWidth();
auto width = (float) getWidth();
bounds.removeFromLeft (roundToInt (header->getProportionAtIndex (0) * width));


+ 3
- 3
extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp View File

@@ -70,7 +70,7 @@ HeaderComponent::~HeaderComponent()
void HeaderComponent::resized()
{
auto bounds = getLocalBounds();
configLabel.setFont ({ bounds.getHeight() / 3.0f });
configLabel.setFont ({ (float) bounds.getHeight() / 3.0f });
{
auto headerBounds = bounds.removeFromLeft (tabsWidth);
@@ -96,11 +96,11 @@ void HeaderComponent::resized()
saveAndOpenInIDEButton.setBounds (exporterBounds.removeFromRight (exporterBounds.getHeight()).reduced (2));
exporterBounds.removeFromRight (5);
exporterBox.setBounds (exporterBounds.removeFromBottom (roundToInt (exporterBounds.getHeight() / 1.8f)));
exporterBox.setBounds (exporterBounds.removeFromBottom (roundToInt ((float) exporterBounds.getHeight() / 1.8f)));
configLabel.setBounds (exporterBounds);
}
userAvatar.setBounds (bounds.removeFromRight (userAvatar.isDisplaingGPLLogo() ? roundToInt (bounds.getHeight() * 1.9f)
userAvatar.setBounds (bounds.removeFromRight (userAvatar.isDisplaingGPLLogo() ? roundToInt ((float) bounds.getHeight() * 1.9f)
: bounds.getHeight()).reduced (2));
}


+ 4
- 4
extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h View File

@@ -125,18 +125,18 @@ public:
//==============================================================================
auto moduleID = project.getEnabledModules().getModuleID (rowNumber);
g.drawFittedText (moduleID, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (0) * width)), Justification::centredLeft, 1);
g.drawFittedText (moduleID, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (0) * (float) width)), Justification::centredLeft, 1);
//==============================================================================
auto version = project.getEnabledModules().getModuleInfo (moduleID).getVersion();
if (version.isEmpty())
version = "?";
g.drawFittedText (version, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (1) * width)), Justification::centredLeft, 1);
g.drawFittedText (version, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (1) * (float) width)), Justification::centredLeft, 1);
//==============================================================================
g.drawFittedText (String (project.getEnabledModules().shouldCopyModuleFilesLocally (moduleID) ? "Yes" : "No"),
bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (2) * width)), Justification::centredLeft, 1);
bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (2) * (float) width)), Justification::centredLeft, 1);
//==============================================================================
String pathText;
@@ -155,7 +155,7 @@ public:
pathText = paths.joinIntoString (", ");
}
g.drawFittedText (pathText, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (3) * width)), Justification::centredLeft, 1);
g.drawFittedText (pathText, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (3) * (float) width)), Justification::centredLeft, 1);
}
void listBoxItemDoubleClicked (int row, const MouseEvent&) override


+ 1
- 1
extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h View File

@@ -218,7 +218,7 @@ private:
{
auto buttonBounds = bounds.removeFromBottom (buttonHeight);
auto buttonWidth = roundToInt (buttonBounds.getWidth() / 3.5f);
auto buttonWidth = roundToInt ((float) buttonBounds.getWidth() / 3.5f);
auto requiredWidth = (numButtons * buttonWidth) + ((numButtons - 1) * buttonSpacing);
buttonBounds.reduce ((buttonBounds.getWidth() - requiredWidth) / 2, 0);


+ 1
- 1
extras/Projucer/Source/Utility/Helpers/jucer_VersionInfo.h View File

@@ -47,7 +47,7 @@ public:
const std::vector<Asset> assets;
private:
VersionInfo() = default;
VersionInfo() = delete;
static std::unique_ptr<VersionInfo> fetch (const String&);
};

+ 1
- 1
extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h View File

@@ -71,7 +71,7 @@ private:
Colour (0xffffffff).overlaidWith (colour));
g.setColour (Colours::white.overlaidWith (colour).contrasting());
g.setFont (Font (getHeight() * 0.6f, Font::bold));
g.setFont (Font ((float) getHeight() * 0.6f, Font::bold));
g.drawFittedText (colour.toDisplayString (true), getLocalBounds().reduced (2, 1),
Justification::centred, 1);
}


+ 1
- 1
extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp View File

@@ -80,7 +80,7 @@ void JucerTreeViewBase::refreshSubItems()
Font JucerTreeViewBase::getFont() const
{
return Font (getItemHeight() * 0.6f);
return Font ((float) getItemHeight() * 0.6f);
}
void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour /*backgroundColour*/, bool isMouseOver)


+ 1
- 1
extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h View File

@@ -214,7 +214,7 @@ public:
auto bounds = getLocalBounds().toFloat();
auto iconBounds = bounds.removeFromLeft ((float) iconWidth).reduced (7, 5);
bounds.removeFromRight (buttons.size() * bounds.getHeight());
bounds.removeFromRight ((float) buttons.size() * bounds.getHeight());
item.paintIcon (g, iconBounds);
item.paintContent (g, bounds.toNearestInt());


+ 2
- 2
extras/Projucer/Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp View File

@@ -206,7 +206,7 @@ void ProjucerLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, b
{
bounds.removeFromLeft (5);
const auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);
const auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
g.setFont (fontSize);
g.setColour (isPropertyComponentChild ? findColour (widgetTextColourId)
@@ -475,7 +475,7 @@ Path ProjucerLookAndFeel::getArrowPath (Rectangle<float> arrowZone, const int di
if (filled)
path.closeSubPath();
path.applyTransform (AffineTransform::rotation (direction * MathConstants<float>::halfPi,
path.applyTransform (AffineTransform::rotation ((float) direction * MathConstants<float>::halfPi,
arrowZone.getCentreX(), arrowZone.getCentreY()));
return path;


+ 4
- 4
modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp View File

@@ -319,7 +319,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest
{
for (int i = 0; i < numSamples; ++i)
{
dest[i] = scale * (int) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint32*> (intData));
dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint32*> (intData));
intData += srcBytesPerSample;
}
}
@@ -330,7 +330,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest
for (int i = numSamples; --i >= 0;)
{
intData -= srcBytesPerSample;
dest[i] = scale * (int) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint32*> (intData));
dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*reinterpret_cast<const uint32*> (intData));
}
}
}
@@ -344,7 +344,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest
{
for (int i = 0; i < numSamples; ++i)
{
dest[i] = scale * (int) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData));
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData));
intData += srcBytesPerSample;
}
}
@@ -355,7 +355,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest
for (int i = numSamples; --i >= 0;)
{
intData -= srcBytesPerSample;
dest[i] = scale * (int) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData));
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData));
}
}
}


+ 2
- 2
modules/juce_audio_basics/buffers/juce_AudioDataConverters.h View File

@@ -528,8 +528,8 @@ public:
if (v < mn) mn = v;
}
return Range<float> (mn * (float) (1.0 / (1.0 + (double) Int32::maxValue)),
mx * (float) (1.0 / (1.0 + (double) Int32::maxValue)));
return Range<float> ((float) mn * (float) (1.0 / (1.0 + (double) Int32::maxValue)),
(float) mx * (float) (1.0 / (1.0 + (double) Int32::maxValue)));
}
/** Scans a block of data, returning the lowest and highest levels as floats */


+ 3
- 3
modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp View File

@@ -491,7 +491,7 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note)
{
if (legacyMode.isEnabled)
{
note.totalPitchbendInSemitones = note.pitchbend.asSignedFloat() * legacyMode.pitchbendRange;
note.totalPitchbendInSemitones = note.pitchbend.asSignedFloat() * (float) legacyMode.pitchbendRange;
}
else
{
@@ -516,11 +516,11 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note)
auto notePitchbendInSemitones = 0.0f;
if (zone.isUsingChannelAsMemberChannel (note.midiChannel))
notePitchbendInSemitones = note.pitchbend.asSignedFloat() * zone.perNotePitchbendRange;
notePitchbendInSemitones = note.pitchbend.asSignedFloat() * (float) zone.perNotePitchbendRange;
auto masterPitchbendInSemitones = pitchbendDimension.lastValueReceivedOnChannel[zone.getMasterChannel() - 1]
.asSignedFloat()
* zone.masterPitchbendRange;
* (float) zone.masterPitchbendRange;
note.totalPitchbendInSemitones = notePitchbendInSemitones + masterPitchbendInSemitones;
}


+ 1
- 1
modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.cpp View File

@@ -345,7 +345,7 @@ namespace
const auto& e = synth.events;
expectWithinAbsoluteError (float (e.blocks.size()),
std::ceil (float (blockSize) / subblockSize),
std::ceil ((float) blockSize / (float) subblockSize),
1.0f);
expect (e.messages.size() == blockSize);
expect (std::is_sorted (e.blocks.begin(), e.blocks.end()));


+ 1
- 1
modules/juce_audio_basics/utilities/juce_Interpolators.cpp View File

@@ -167,7 +167,7 @@ private:
(int) input.size(), (int) input.size());
std::vector<float> secondGaussian (doubleLengthOutput.size());
createGaussian (secondGaussian, 1.0f, expectedGaussianMidpoint + outputBufferSize, expectedGaussianWidth);
createGaussian (secondGaussian, 1.0f, expectedGaussianMidpoint + (float) outputBufferSize, expectedGaussianWidth);
FloatVectorOperations::add (expectedDoubleLengthOutput.data(), secondGaussian.data(), (int) expectedDoubleLengthOutput.size());
expectAllElementsWithin (doubleLengthOutput, expectedDoubleLengthOutput, 0.02f);


+ 6
- 4
modules/juce_audio_basics/utilities/juce_Interpolators.h View File

@@ -54,7 +54,8 @@ private:
static forcedinline float valueAtOffset (const float* const inputs, const float offset, int indexBuffer) noexcept
{
int numCrossings = 100;
const int numCrossings = 100;
const float floatCrossings = (float) numCrossings;
float result = 0.0f;
auto samplePosition = indexBuffer;
@@ -69,14 +70,15 @@ private:
if (i == -numCrossings || (sincPosition >= 0 && lastSincPosition < 0))
{
auto indexFloat = (sincPosition >= 0.f ? sincPosition : -sincPosition) * 100.0f;
index = (int) std::floor (indexFloat);
firstFrac = indexFloat - index;
auto indexFloored = std::floor (indexFloat);
index = (int) indexFloored;
firstFrac = indexFloat - indexFloored;
sign = (sincPosition < 0 ? -1 : 1);
}
if (sincPosition == 0.0f)
result += inputs[samplePosition];
else if (sincPosition < numCrossings && sincPosition > -numCrossings)
else if (sincPosition < floatCrossings && sincPosition > -floatCrossings)
result += inputs[samplePosition] * windowedSinc (firstFrac, index);
if (++samplePosition == numCrossings * 2)


+ 1
- 1
modules/juce_audio_basics/utilities/juce_SmoothedValue.h View File

@@ -369,7 +369,7 @@ private:
template <typename T = SmoothingType>
MultiplicativeVoid<T> setStepSize()
{
step = std::exp ((std::log (std::abs (this->target)) - std::log (std::abs (this->currentValue))) / this->countdown);
step = std::exp ((std::log (std::abs (this->target)) - std::log (std::abs (this->currentValue))) / (FloatType) this->countdown);
}
//==============================================================================


+ 6
- 6
modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp View File

@@ -1968,8 +1968,8 @@ private:
{
const uint8 n0 = si.allocation[i][0];
const uint8 n1 = si.allocation[i][1];
fraction[0][i] = n0 > 0 ? (float) ((-(1 << n0) + getBitsUint16 (n0 + 1) + 1) * constants.muls[n0 + 1][si.scaleFactor[i][0]]) : 0;
fraction[1][i] = n1 > 0 ? (float) ((-(1 << n1) + getBitsUint16 (n1 + 1) + 1) * constants.muls[n1 + 1][si.scaleFactor[i][1]]) : 0;
fraction[0][i] = n0 > 0 ? ((float) (-(1 << n0) + getBitsUint16 (n0 + 1) + 1) * constants.muls[n0 + 1][si.scaleFactor[i][0]]) : 0.0f;
fraction[1][i] = n1 > 0 ? ((float) (-(1 << n1) + getBitsUint16 (n1 + 1) + 1) * constants.muls[n1 + 1][si.scaleFactor[i][1]]) : 0.0f;
}
for (i = jsbound; i < 32; ++i)
@@ -1979,8 +1979,8 @@ private:
if (n > 0)
{
const uint32 w = ((uint32) -(1 << n) + getBitsUint16 (n + 1) + 1);
fraction[0][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][0]]);
fraction[1][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][1]]);
fraction[0][i] = ((float) w * constants.muls[n + 1][si.scaleFactor[i][0]]);
fraction[1][i] = ((float) w * constants.muls[n + 1][si.scaleFactor[i][1]]);
}
else
fraction[0][i] = fraction[1][i] = 0;
@@ -1994,7 +1994,7 @@ private:
const uint8 j = si.scaleFactor[i][0];
if (n > 0)
fraction[0][i] = (float) ((-(1 << n) + getBitsUint16 (n + 1) + 1) * constants.muls[n + 1][j]);
fraction[0][i] = ((float) (-(1 << n) + getBitsUint16 (n + 1) + 1) * constants.muls[n + 1][j]);
else
fraction[0][i] = 0;
}
@@ -3113,7 +3113,7 @@ private:
const int bytesPerFrame = stream.frame.frameSize + 4;
if (bytesPerFrame == 417 || bytesPerFrame == 418)
numFrames = roundToInt ((streamSize - streamStartPos) / 417.95918); // more accurate for 128k
numFrames = roundToInt ((double) (streamSize - streamStartPos) / 417.95918); // more accurate for 128k
else
numFrames = (streamSize - streamStartPos) / bytesPerFrame;
}


+ 4
- 4
modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp View File

@@ -135,7 +135,7 @@ public:
lengthInSamples = (uint32) ov_pcm_total (&ovFile, -1);
numChannels = (unsigned int) info->channels;
bitsPerSample = 16;
sampleRate = info->rate;
sampleRate = (double) info->rate;
reservoir.setSize ((int) numChannels, (int) jmin (lengthInSamples, (int64) 4096));
}
@@ -276,7 +276,7 @@ public:
vorbis_info_init (&vi);
if (vorbis_encode_init_vbr (&vi, (int) numChans, (int) rate,
jlimit (0.0f, 1.0f, qualityIndex * 0.1f)) == 0)
jlimit (0.0f, 1.0f, (float) qualityIndex * 0.1f)) == 0)
{
vorbis_comment_init (&vc);
@@ -483,8 +483,8 @@ int OggVorbisAudioFormat::estimateOggFileQuality (const File& source)
{
if (auto r = std::unique_ptr<AudioFormatReader> (createReaderFor (in.release(), true)))
{
auto lengthSecs = r->lengthInSamples / r->sampleRate;
auto approxBitsPerSecond = (int) (source.getSize() * 8 / lengthSecs);
auto lengthSecs = (double) r->lengthInSamples / r->sampleRate;
auto approxBitsPerSecond = (int) ((double) source.getSize() * 8 / lengthSecs);
auto qualities = getQualityOptions();
int bestIndex = 0;


+ 1
- 1
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -1474,7 +1474,7 @@ private:
output->writeShort ((short) numChannels);
output->writeInt ((int) sampleRate);
output->writeInt ((int) (bytesPerFrame * sampleRate)); // nAvgBytesPerSec
output->writeInt ((int) ((double) bytesPerFrame * sampleRate)); // nAvgBytesPerSec
output->writeShort ((short) bytesPerFrame); // nBlockAlign
output->writeShort ((short) bitsPerSample); // wBitsPerSample


+ 2
- 2
modules/juce_audio_formats/format/juce_AudioFormatReader.cpp View File

@@ -235,8 +235,8 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile, int64 numSamples
{
auto intRange = Range<int>::findMinAndMax (intBuffer[i], numToDo);
r = Range<float> (intRange.getStart() / (float) std::numeric_limits<int>::max(),
intRange.getEnd() / (float) std::numeric_limits<int>::max());
r = Range<float> ((float) intRange.getStart() / (float) std::numeric_limits<int>::max(),
(float) intRange.getEnd() / (float) std::numeric_limits<int>::max());
}
results[i] = isFirstBlock ? r : results[i].getUnionWith (r);


+ 12
- 12
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -1262,10 +1262,10 @@ private:
auto transformScale = std::sqrt (std::abs (editor->getTransform().getDeterminant()));
auto minW = (double) (constrainer->getMinimumWidth() * transformScale);
auto maxW = (double) (constrainer->getMaximumWidth() * transformScale);
auto minH = (double) (constrainer->getMinimumHeight() * transformScale);
auto maxH = (double) (constrainer->getMaximumHeight() * transformScale);
auto minW = (double) ((float) constrainer->getMinimumWidth() * transformScale);
auto maxW = (double) ((float) constrainer->getMaximumWidth() * transformScale);
auto minH = (double) ((float) constrainer->getMinimumHeight() * transformScale);
auto maxH = (double) ((float) constrainer->getMaximumHeight() * transformScale);
auto width = (double) (rectToCheck->right - rectToCheck->left);
auto height = (double) (rectToCheck->bottom - rectToCheck->top);
@@ -1381,10 +1381,10 @@ private:
if (approximatelyEqual (desktopScale, 1.0f))
return pluginRect;
return { roundToInt (pluginRect.left * desktopScale),
roundToInt (pluginRect.top * desktopScale),
roundToInt (pluginRect.right * desktopScale),
roundToInt (pluginRect.bottom * desktopScale) };
return { roundToInt ((float) pluginRect.left * desktopScale),
roundToInt ((float) pluginRect.top * desktopScale),
roundToInt ((float) pluginRect.right * desktopScale),
roundToInt ((float) pluginRect.bottom * desktopScale) };
}
static ViewRect convertFromHostBounds (ViewRect hostRect)
@@ -1394,10 +1394,10 @@ private:
if (approximatelyEqual (desktopScale, 1.0f))
return hostRect;
return { roundToInt (hostRect.left / desktopScale),
roundToInt (hostRect.top / desktopScale),
roundToInt (hostRect.right / desktopScale),
roundToInt (hostRect.bottom / desktopScale) };
return { roundToInt ((float) hostRect.left / desktopScale),
roundToInt ((float) hostRect.top / desktopScale),
roundToInt ((float) hostRect.right / desktopScale),
roundToInt ((float) hostRect.bottom / desktopScale) };
}
//==============================================================================


+ 8
- 8
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -1359,13 +1359,13 @@ struct VST3PluginWindow : public AudioProcessorEditor,
if (wasResized && view->canResize() == kResultTrue)
{
rect.right = (Steinberg::int32) roundToInt (getWidth() * nativeScaleFactor);
rect.bottom = (Steinberg::int32) roundToInt (getHeight() * nativeScaleFactor);
rect.right = (Steinberg::int32) roundToInt ((float) getWidth() * nativeScaleFactor);
rect.bottom = (Steinberg::int32) roundToInt ((float) getHeight() * nativeScaleFactor);
view->checkSizeConstraint (&rect);
auto w = roundToInt (rect.getWidth() / nativeScaleFactor);
auto h = roundToInt (rect.getHeight() / nativeScaleFactor);
auto w = roundToInt ((float) rect.getWidth() / nativeScaleFactor);
auto h = roundToInt ((float) rect.getHeight() / nativeScaleFactor);
setSize (w, h);
@@ -1459,10 +1459,10 @@ private:
//==============================================================================
static void resizeWithRect (Component& comp, const ViewRect& rect, float scaleFactor)
{
comp.setBounds (roundToInt (rect.left / scaleFactor),
roundToInt (rect.top / scaleFactor),
jmax (10, std::abs (roundToInt (rect.getWidth() / scaleFactor))),
jmax (10, std::abs (roundToInt (rect.getHeight() / scaleFactor))));
comp.setBounds (roundToInt ((float) rect.left / scaleFactor),
roundToInt ((float) rect.top / scaleFactor),
jmax (10, std::abs (roundToInt ((float) rect.getWidth() / scaleFactor))),
jmax (10, std::abs (roundToInt ((float) rect.getHeight() / scaleFactor))));
}
void attachPluginWindow()


+ 1
- 1
modules/juce_audio_processors/processors/juce_AudioProcessor.cpp View File

@@ -1545,7 +1545,7 @@ StringArray AudioProcessorParameter::getAllValueStrings() const
auto maxIndex = getNumSteps() - 1;
for (int i = 0; i < getNumSteps(); ++i)
valueStrings.add (getText ((float) i / maxIndex, 1024));
valueStrings.add (getText ((float) i / (float) maxIndex, 1024));
}
return valueStrings;


+ 1
- 1
modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp View File

@@ -284,7 +284,7 @@ private:
{
// The parameter is producing some unexpected text, so we'll do
// some linear interpolation.
index = roundToInt (getParameter().getValue() * (parameterValues.size() - 1));
index = roundToInt (getParameter().getValue() * (float) (parameterValues.size() - 1));
}
box.setSelectedItemIndex (index);


+ 1
- 1
modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp View File

@@ -77,7 +77,7 @@ String PluginDirectoryScanner::getNextPluginFileThatWillBeScanned() const
void PluginDirectoryScanner::updateProgress()
{
progress = (1.0f - nextIndex.get() / (float) filesOrIdentifiersToScan.size());
progress = (1.0f - (float) nextIndex.get() / (float) filesOrIdentifiersToScan.size());
}
bool PluginDirectoryScanner::scanNextFile (bool dontRescanIfAlreadyInList,


+ 1
- 1
modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp View File

@@ -88,7 +88,7 @@ public:
g.setColour (isBlacklisted ? Colours::red
: columnId == nameCol ? defaultTextColour
: defaultTextColour.interpolatedWith (Colours::transparentBlack, 0.3f));
g.setFont (Font (height * 0.7f, Font::bold));
g.setFont (Font ((float) height * 0.7f, Font::bold));
g.drawFittedText (text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f);
}
}


+ 1
- 1
modules/juce_audio_processors/utilities/juce_AudioParameterChoice.cpp View File

@@ -33,7 +33,7 @@ AudioParameterChoice::AudioParameterChoice (const String& idToUse, const String&
: RangedAudioParameter (idToUse, nameToUse, labelToUse), choices (c),
range ([this]
{
NormalisableRange<float> rangeWithInterval { 0.0f, choices.size() - 1.0f,
NormalisableRange<float> rangeWithInterval { 0.0f, (float) choices.size() - 1.0f,
[] (float, float end, float v) { return jlimit (0.0f, end, v * end); },
[] (float, float end, float v) { return jlimit (0.0f, 1.0f, v / end); },
[] (float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } };


+ 1
- 1
modules/juce_audio_processors/utilities/juce_AudioParameterFloat.cpp View File

@@ -44,7 +44,7 @@ AudioParameterFloat::AudioParameterFloat (const String& idToUse, const String& n
if (range.interval != 0.0f)
{
if (approximatelyEqual (std::abs (range.interval - (int) range.interval), 0.0f))
if (approximatelyEqual (std::abs (range.interval - std::floor (range.interval)), 0.0f))
return 0;
auto v = std::abs (roundToInt (range.interval * pow (10, numDecimalPlaces)));


+ 8
- 8
modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp View File

@@ -109,12 +109,12 @@ public:
bool enabled = deviceManager.isMidiInputDeviceEnabled (item.identifier);
auto x = getTickX();
auto tickW = height * 0.75f;
auto tickW = (float) height * 0.75f;
getLookAndFeel().drawTickBox (g, *this, x - tickW, (height - tickW) / 2, tickW, tickW,
getLookAndFeel().drawTickBox (g, *this, (float) x - tickW, ((float) height - tickW) * 0.5f, tickW, tickW,
enabled, true, true, false);
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.setColour (findColour (ListBox::textColourId, true).withMultipliedAlpha (enabled ? 1.0f : 0.6f));
g.drawText (item.name, x + 5, 0, width - x - 5, height, Justification::centredLeft, true);
}
@@ -145,7 +145,7 @@ public:
if (items.isEmpty())
{
g.setColour (Colours::grey);
g.setFont (0.5f * getRowHeight());
g.setFont (0.5f * (float) getRowHeight());
g.drawText (noItemsMessage,
0, 0, getWidth(), getHeight() / 2,
Justification::centred, true);
@@ -800,12 +800,12 @@ public:
}
auto x = getTickX();
auto tickW = height * 0.75f;
auto tickW = (float) height * 0.75f;
getLookAndFeel().drawTickBox (g, *this, x - tickW, (height - tickW) / 2, tickW, tickW,
getLookAndFeel().drawTickBox (g, *this, (float) x - tickW, ((float) height - tickW) * 0.5f, tickW, tickW,
enabled, true, true, false);
g.setFont (height * 0.6f);
g.setFont ((float) height * 0.6f);
g.setColour (findColour (ListBox::textColourId, true).withMultipliedAlpha (enabled ? 1.0f : 0.6f));
g.drawText (item, x + 5, 0, width - x - 5, height, Justification::centredLeft, true);
}
@@ -836,7 +836,7 @@ public:
if (items.isEmpty())
{
g.setColour (Colours::grey);
g.setFont (0.5f * getRowHeight());
g.setFont (0.5f * (float) getRowHeight());
g.drawText (noItemsMessage,
0, 0, getWidth(), getHeight() / 2,
Justification::centred, true);


+ 3
- 3
modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp View File

@@ -753,7 +753,7 @@ int AudioThumbnail::getNumChannels() const noexcept
double AudioThumbnail::getTotalLength() const noexcept
{
return sampleRate > 0 ? (totalSamples / sampleRate) : 0;
return sampleRate > 0 ? ((double) totalSamples / sampleRate) : 0.0;
}
bool AudioThumbnail::isFullyLoaded() const noexcept
@@ -763,7 +763,7 @@ bool AudioThumbnail::isFullyLoaded() const noexcept
double AudioThumbnail::getProportionComplete() const noexcept
{
return jlimit (0.0, 1.0, numSamplesFinished / (double) jmax ((int64) 1, totalSamples.load()));
return jlimit (0.0, 1.0, (double) numSamplesFinished / (double) jmax ((int64) 1, totalSamples.load()));
}
int64 AudioThumbnail::getNumSamplesFinished() const noexcept
@@ -779,7 +779,7 @@ float AudioThumbnail::getApproximatePeak() const
for (auto* c : channels)
peak = jmax (peak, c->getPeak());
return jlimit (0, 127, peak) / 127.0f;
return (float) jlimit (0, 127, peak) / 127.0f;
}
void AudioThumbnail::getApproximateMinMax (double startTime, double endTime, int channelIndex,


+ 1
- 1
modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp View File

@@ -178,7 +178,7 @@ void AudioVisualiserComponent::paint (Graphics& g)
g.fillAll (backgroundColour);
auto r = getLocalBounds().toFloat();
auto channelHeight = r.getHeight() / channels.size();
auto channelHeight = r.getHeight() / (float) channels.size();
g.setColour (waveformColour);


+ 16
- 16
modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp View File

@@ -220,7 +220,7 @@ Range<float> MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, float ta
auto octave = midiNoteNumber / 12;
auto note = midiNoteNumber % 12;
auto start = octave * 7.0f * targetKeyWidth + notePos[note] * targetKeyWidth;
auto start = (float) octave * 7.0f * targetKeyWidth + notePos[note] * targetKeyWidth;
auto width = MidiMessage::isMidiNoteBlack (note) ? blackNoteWidthRatio * targetKeyWidth : targetKeyWidth;
return { start, start + width };
@@ -248,8 +248,8 @@ Rectangle<float> MidiKeyboardComponent::getRectangleForKey (int note) const
switch (orientation)
{
case horizontalKeyboard: return { x, 0, w, blackNoteLength };
case verticalKeyboardFacingLeft: return { getWidth() - blackNoteLength, x, blackNoteLength, w };
case verticalKeyboardFacingRight: return { 0, getHeight() - x - w, blackNoteLength, w };
case verticalKeyboardFacingLeft: return { (float) getWidth() - blackNoteLength, x, blackNoteLength, w };
case verticalKeyboardFacingRight: return { 0, (float) getHeight() - x - w, blackNoteLength, w };
default: jassertfalse; break;
}
}
@@ -259,7 +259,7 @@ Rectangle<float> MidiKeyboardComponent::getRectangleForKey (int note) const
{
case horizontalKeyboard: return { x, 0, w, (float) getHeight() };
case verticalKeyboardFacingLeft: return { 0, x, (float) getWidth(), w };
case verticalKeyboardFacingRight: return { 0, getHeight() - x - w, (float) getWidth(), w };
case verticalKeyboardFacingRight: return { 0, (float) getHeight() - x - w, (float) getWidth(), w };
default: jassertfalse; break;
}
}
@@ -295,9 +295,9 @@ int MidiKeyboardComponent::xyToNote (Point<float> pos, float& mousePositionVeloc
p = { p.y, p.x };
if (orientation == verticalKeyboardFacingLeft)
p = { p.x, getWidth() - p.y };
p = { p.x, (float) getWidth() - p.y };
else
p = { getHeight() - p.x, p.y };
p = { (float) getHeight() - p.x, p.y };
}
return remappedXYToNote (p + Point<float> (xOffset, 0), mousePositionVelocity);
@@ -382,8 +382,8 @@ void MidiKeyboardComponent::paint (Graphics& g)
if (orientation == verticalKeyboardFacingLeft)
{
x1 = width - 1.0f;
x2 = width - 5.0f;
x1 = (float) width - 1.0f;
x2 = (float) width - 5.0f;
}
else if (orientation == verticalKeyboardFacingRight)
x2 = 5.0f;
@@ -400,7 +400,7 @@ void MidiKeyboardComponent::paint (Graphics& g)
switch (orientation)
{
case horizontalKeyboard: g.fillRect (0.0f, 0.0f, x, 5.0f); break;
case verticalKeyboardFacingLeft: g.fillRect (width - 5.0f, 0.0f, 5.0f, x); break;
case verticalKeyboardFacingLeft: g.fillRect ((float) width - 5.0f, 0.0f, 5.0f, x); break;
case verticalKeyboardFacingRight: g.fillRect (0.0f, 0.0f, 5.0f, x); break;
default: break;
}
@@ -412,9 +412,9 @@ void MidiKeyboardComponent::paint (Graphics& g)
switch (orientation)
{
case horizontalKeyboard: g.fillRect (0.0f, height - 1.0f, x, 1.0f); break;
case horizontalKeyboard: g.fillRect (0.0f, (float) height - 1.0f, x, 1.0f); break;
case verticalKeyboardFacingLeft: g.fillRect (0.0f, 0.0f, 1.0f, x); break;
case verticalKeyboardFacingRight: g.fillRect (width - 1.0f, 0.0f, 1.0f, x); break;
case verticalKeyboardFacingRight: g.fillRect ((float) width - 1.0f, 0.0f, 1.0f, x); break;
default: break;
}
}
@@ -561,7 +561,7 @@ void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,
g.setColour (findColour (upDownButtonArrowColourId)
.withAlpha (buttonDown ? 1.0f : (mouseOver ? 0.6f : 0.4f)));
g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, w - 2.0f, h - 2.0f, true));
g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, (float) w - 2.0f, (float) h - 2.0f, true));
}
void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept
@@ -578,7 +578,7 @@ void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept
float MidiKeyboardComponent::getBlackNoteLength() const noexcept
{
auto whiteNoteLength = orientation == horizontalKeyboard ? getHeight() : getWidth();
return whiteNoteLength * blackNoteLengthRatio;
return (float) whiteNoteLength * blackNoteLengthRatio;
}
void MidiKeyboardComponent::setBlackNoteWidthProportion (float ratio) noexcept
@@ -608,7 +608,7 @@ void MidiKeyboardComponent::resized()
{
auto kx1 = getKeyPos (rangeStart).getStart();
if (kx2 - kx1 <= w)
if (kx2 - kx1 <= (float) w)
{
firstKey = (float) rangeStart;
sendChangeMessage();
@@ -645,7 +645,7 @@ void MidiKeyboardComponent::resized()
float mousePositionVelocity;
auto spaceAvailable = w;
auto lastStartKey = remappedXYToNote ({ endOfLastKey - spaceAvailable, 0 }, mousePositionVelocity) + 1;
auto lastStartKey = remappedXYToNote ({ endOfLastKey - (float) spaceAvailable, 0 }, mousePositionVelocity) + 1;
if (lastStartKey >= 0 && ((int) firstKey) > lastStartKey)
{
@@ -660,7 +660,7 @@ void MidiKeyboardComponent::resized()
firstKey = (float) rangeStart;
}
scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > w);
scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > (float) w);
repaint();
}
}


+ 2
- 2
modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h View File

@@ -79,8 +79,8 @@ struct IntegerWithBitSize
: (uint32) (value >> (numBits - 8)));
}
float toUnipolarFloat() const noexcept { return value / (float) maxValue; }
float toBipolarFloat() const noexcept { return static_cast<int32> (value << (32 - numBits)) / (float) 0x80000000u; }
float toUnipolarFloat() const noexcept { return (float) value / (float) maxValue; }
float toBipolarFloat() const noexcept { return (float) static_cast<int32> (value << (32 - numBits)) / (float) 0x80000000u; }
static IntegerWithBitSize fromUnipolarFloat (float value) noexcept
{


+ 3
- 3
modules/juce_blocks_basics/topology/internal/juce_ConnectedDeviceGroup.cpp View File

@@ -167,9 +167,9 @@ struct ConnectedDeviceGroup : private AsyncUpdater,
TouchSurface::Touch touch;
touch.index = (int) touchIndex.get();
touch.x = position.x.toUnipolarFloat();
touch.y = position.y.toUnipolarFloat();
touch.z = position.z.toUnipolarFloat();
touch.x = (float) position.x.toUnipolarFloat();
touch.y = (float) position.y.toUnipolarFloat();
touch.z = (float) position.z.toUnipolarFloat();
touch.xVelocity = velocity.vx.toBipolarFloat();
touch.yVelocity = velocity.vy.toBipolarFloat();
touch.zVelocity = velocity.vz.toBipolarFloat();


+ 4
- 4
modules/juce_blocks_basics/topology/internal/juce_Detector.cpp View File

@@ -350,10 +350,10 @@ struct Detector : public ReferenceCountedObject,
{
TouchSurface::Touch scaledEvent (touchEvent);
scaledEvent.x *= block->getWidth();
scaledEvent.y *= block->getHeight();
scaledEvent.startX *= block->getWidth();
scaledEvent.startY *= block->getHeight();
scaledEvent.x *= (float) block->getWidth();
scaledEvent.y *= (float) block->getHeight();
scaledEvent.startX *= (float) block->getWidth();
scaledEvent.startY *= (float) block->getHeight();
surface->broadcastTouchChange (scaledEvent);
}


+ 5
- 5
modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp View File

@@ -27,14 +27,14 @@ DrumPadGridProgram::DrumPadGridProgram (Block& b) : Program (b) {}
int DrumPadGridProgram::getPadIndex (float posX, float posY) const
{
posX = jmin (0.99f, posX / block.getWidth());
posY = jmin (0.99f, posY / block.getHeight());
posX = jmin (0.99f, posX / (float) block.getWidth());
posY = jmin (0.99f, posY / (float) block.getHeight());
const uint32 offset = block.getDataByte (visiblePads_byte) ? numColumns1_byte : numColumns0_byte;
const int numColumns = block.getDataByte (offset + numColumns0_byte);
const int numRows = block.getDataByte (offset + numRows0_byte);
return int (posX * numColumns) + int (posY * numRows) * numColumns;
return int (posX * (float) numColumns) + int (posY * (float) numRows) * numColumns;
}
void DrumPadGridProgram::startTouch (float startX, float startY)
@@ -65,8 +65,8 @@ void DrumPadGridProgram::sendTouch (float x, float y, float z, LEDColour colour)
Block::ProgramEventMessage e;
e.values[0] = 0x20000000
+ (jlimit (0, 255, roundToInt (x * (255.0f / block.getWidth()))) << 16)
+ (jlimit (0, 255, roundToInt (y * (255.0f / block.getHeight()))) << 8)
+ (jlimit (0, 255, roundToInt (x * (255.0f / (float) block.getWidth()))) << 16)
+ (jlimit (0, 255, roundToInt (y * (255.0f / (float) block.getHeight()))) << 8)
+ jlimit (0, 255, roundToInt (z * 255.0f));
e.values[1] = (int32) colour.getARGB();


+ 2
- 2
modules/juce_core/files/juce_DirectoryIterator.cpp View File

@@ -159,10 +159,10 @@ float DirectoryIterator::getEstimatedProgress() const
if (totalNumFiles <= 0)
return 0.0f;
auto detailedIndex = (subIterator != nullptr) ? index + subIterator->getEstimatedProgress()
auto detailedIndex = (subIterator != nullptr) ? (float) index + subIterator->getEstimatedProgress()
: (float) index;
return jlimit (0.0f, 1.0f, detailedIndex / totalNumFiles);
return jlimit (0.0f, 1.0f, detailedIndex / (float) totalNumFiles);
}
} // namespace juce

+ 1
- 1
modules/juce_core/files/juce_File.cpp View File

@@ -485,7 +485,7 @@ String File::descriptionOfSizeInBytes (const int64 bytes)
else if (bytes < 1024 * 1024 * 1024) { suffix = " MB"; divisor = 1024.0 * 1024.0; }
else { suffix = " GB"; divisor = 1024.0 * 1024.0 * 1024.0; }
return (divisor > 0 ? String (bytes / divisor, 1) : String (bytes)) + suffix;
return (divisor > 0 ? String ((double) bytes / divisor, 1) : String (bytes)) + suffix;
}
//==============================================================================


+ 1
- 1
modules/juce_core/javascript/juce_Javascript.cpp View File

@@ -594,7 +594,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
{
DivideOp (const CodeLocation& l, ExpPtr& a, ExpPtr& b) noexcept : BinaryOperator (l, a, b, TokenTypes::divide) {}
var getWithDoubles (double a, double b) const override { return b != 0 ? a / b : std::numeric_limits<double>::infinity(); }
var getWithInts (int64 a, int64 b) const override { return b != 0 ? var (a / (double) b) : var (std::numeric_limits<double>::infinity()); }
var getWithInts (int64 a, int64 b) const override { return b != 0 ? var ((double) a / (double) b) : var (std::numeric_limits<double>::infinity()); }
};
struct ModuloOp : public BinaryOperator


+ 1
- 1
modules/juce_core/maths/juce_Random.cpp View File

@@ -105,7 +105,7 @@ bool Random::nextBool() noexcept
float Random::nextFloat() noexcept
{
auto result = static_cast<uint32> (nextInt())
auto result = static_cast<float> (static_cast<uint32> (nextInt()))
/ (static_cast<float> (std::numeric_limits<uint32>::max()) + 1.0f);
return result == 1.0f ? 1.0f - std::numeric_limits<float>::epsilon() : result;
}


+ 1
- 1
modules/juce_core/native/juce_linux_SystemStats.cpp View File

@@ -209,7 +209,7 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept
double Time::getMillisecondCounterHiRes() noexcept
{
return getHighResolutionTicks() * 0.001;
return (double) getHighResolutionTicks() * 0.001;
}
bool Time::setSystemTimeToThisTime() const


+ 1
- 1
modules/juce_core/time/juce_PerformanceCounter.cpp View File

@@ -124,7 +124,7 @@ PerformanceCounter::Statistics PerformanceCounter::getStatisticsAndReset()
stats.clear();
if (s.numRuns > 0)
s.averageSeconds = s.totalSeconds / s.numRuns;
s.averageSeconds = s.totalSeconds / (float) s.numRuns;
return s;
}


+ 2
- 2
modules/juce_core/time/juce_RelativeTime.cpp View File

@@ -28,8 +28,8 @@ RelativeTime::RelativeTime (const RelativeTime& other) noexcept : numSeconds (
RelativeTime::~RelativeTime() noexcept {}
//==============================================================================
RelativeTime RelativeTime::milliseconds (int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
RelativeTime RelativeTime::milliseconds (int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); }
RelativeTime RelativeTime::milliseconds (int milliseconds) noexcept { return RelativeTime ((double) milliseconds * 0.001); }
RelativeTime RelativeTime::milliseconds (int64 milliseconds) noexcept { return RelativeTime ((double) milliseconds * 0.001); }
RelativeTime RelativeTime::seconds (double s) noexcept { return RelativeTime (s); }
RelativeTime RelativeTime::minutes (double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); }
RelativeTime RelativeTime::hours (double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); }


+ 1
- 1
modules/juce_core/time/juce_Time.cpp View File

@@ -277,7 +277,7 @@ void Time::waitForMillisecondCounter (uint32 targetTime) noexcept
//==============================================================================
double Time::highResolutionTicksToSeconds (const int64 ticks) noexcept
{
return ticks / (double) getHighResolutionTicksPerSecond();
return (double) ticks / (double) getHighResolutionTicksPerSecond();
}
int64 Time::secondsToHighResolutionTicks (const double seconds) noexcept


+ 8
- 8
modules/juce_dsp/filter_design/juce_FilterDesign.cpp View File

@@ -45,7 +45,7 @@ typename FIR::Coefficients<FloatType>::Ptr
for (size_t i = 0; i <= order; ++i)
{
if (i == order * 0.5)
if (i == order / 2)
{
c[i] = static_cast<FloatType> (normalisedFrequency * 2);
}
@@ -113,8 +113,8 @@ typename FIR::Coefficients<FloatType>::Ptr
}
else
{
auto indice = MathConstants<double>::pi * (i - 0.5 * order);
auto indice2 = MathConstants<double>::pi * normalisedTransitionWidth * (i - 0.5 * order) / spline;
auto indice = MathConstants<double>::pi * ((double) i - 0.5 * (double) order);
auto indice2 = MathConstants<double>::pi * normalisedTransitionWidth * ((double) i - 0.5 * (double) order) / spline;
c[i] = static_cast<FloatType> (std::sin (2 * indice * normalisedFrequency)
/ indice * std::pow (std::sin (indice2) / indice2, spline));
}
@@ -160,12 +160,12 @@ typename FIR::Coefficients<FloatType>::Ptr
auto factors = ws / MathConstants<double>::pi;
for (size_t i = 0; i <= M; ++i)
b (i, 0) = factorp * sinc (factorp * i);
b (i, 0) = factorp * sinc (factorp * (double) i);
q (0, 0) = factorp + stopBandWeight * (1.0 - factors);
for (size_t i = 1; i <= 2 * M; ++i)
q (i, 0) = factorp * sinc (factorp * i) - stopBandWeight * factors * sinc (factors * i);
q (i, 0) = factorp * sinc (factorp * (double) i) - stopBandWeight * factors * sinc (factors * (double) i);
auto Q1 = Matrix<double>::toeplitz (q, M + 1);
auto Q2 = Matrix<double>::hankel (q, M + 1, 0);
@@ -198,12 +198,12 @@ typename FIR::Coefficients<FloatType>::Ptr
auto factors = ws / MathConstants<double>::pi;
for (size_t i = 0; i < M; ++i)
b (i, 0) = factorp * sinc (factorp * (i + 0.5));
b (i, 0) = factorp * sinc (factorp * ((double) i + 0.5));
for (size_t i = 0; i < 2 * M; ++i)
{
qp (i, 0) = 0.25 * factorp * sinc (factorp * i);
qs (i, 0) = -0.25 * stopBandWeight * factors * sinc (factors * i);
qp (i, 0) = 0.25 * factorp * sinc (factorp * (double) i);
qs (i, 0) = -0.25 * stopBandWeight * factors * sinc (factors * (double) i);
}
auto Q1p = Matrix<double>::toeplitz (qp, M);


+ 1
- 1
modules/juce_dsp/frequency/juce_FFT.cpp View File

@@ -113,7 +113,7 @@ struct FFTFallback : public FFT::Instance
{
configInverse->perform (input, output);
const float scaleFactor = 1.0f / size;
const float scaleFactor = 1.0f / (float) size;
for (int i = 0; i < size; ++i)
output[i] *= scaleFactor;


+ 3
- 2
modules/juce_dsp/frequency/juce_Windowing.cpp View File

@@ -136,10 +136,11 @@ void WindowingFunction<FloatType>::fillWindowingTables (FloatType* samples, size
case kaiser:
{
const double factor = 1.0 / SpecialFunctions::besselI0 (beta);
const auto doubleSize = (double) size;
for (size_t i = 0; i < size; ++i)
samples[i] = static_cast<FloatType> (SpecialFunctions::besselI0 (beta * std::sqrt (1.0 - std::pow ((i - 0.5 * (size - 1.0))
/ ( 0.5 * (size - 1.0)), 2.0)))
samples[i] = static_cast<FloatType> (SpecialFunctions::besselI0 (beta * std::sqrt (1.0 - std::pow (((double) i - 0.5 * (doubleSize - 1.0))
/ ( 0.5 * (doubleSize - 1.0)), 2.0)))
* factor);
}
break;


+ 1
- 1
modules/juce_dsp/maths/juce_LookupTable.h View File

@@ -122,7 +122,7 @@ public:
*/
FloatType get (FloatType index) const noexcept
{
if (index >= getNumPoints())
if (index >= (FloatType) getNumPoints())
index = static_cast<FloatType> (getGuardIndex());
else if (index < 0)
index = {};


+ 4
- 4
modules/juce_dsp/processors/juce_Oversampling.cpp View File

@@ -563,8 +563,8 @@ Oversampling<SampleType>::Oversampling (size_t newNumChannels, size_t newFactor,
auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f);
addOversamplingStage (FilterType::filterHalfBandPolyphaseIIR,
twUp, gaindBStartUp + gaindBFactorUp * n,
twDown, gaindBStartDown + gaindBFactorDown * n);
twUp, gaindBStartUp + gaindBFactorUp * (float) n,
twDown, gaindBStartDown + gaindBFactorDown * (float) n);
}
}
else if (newType == FilterType::filterHalfBandFIREquiripple)
@@ -580,8 +580,8 @@ Oversampling<SampleType>::Oversampling (size_t newNumChannels, size_t newFactor,
auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f);
addOversamplingStage (FilterType::filterHalfBandFIREquiripple,
twUp, gaindBStartUp + gaindBFactorUp * n,
twDown, gaindBStartDown + gaindBFactorDown * n);
twUp, gaindBStartUp + gaindBFactorUp * (float) n,
twDown, gaindBStartDown + gaindBFactorDown * (float) n);
}
}
}


+ 8
- 8
modules/juce_graphics/colour/juce_Colour.cpp View File

@@ -46,11 +46,11 @@ namespace ColourHelpers
if (hi > 0)
{
auto invDiff = 1.0f / (hi - lo);
auto invDiff = 1.0f / (float) (hi - lo);
auto red = (hi - r) * invDiff;
auto green = (hi - g) * invDiff;
auto blue = (hi - b) * invDiff;
auto red = (float) (hi - r) * invDiff;
auto green = (float) (hi - g) * invDiff;
auto blue = (float) (hi - b) * invDiff;
if (r == hi) hue = blue - green;
else if (g == hi) hue = 2.0f + red - blue;
@@ -79,12 +79,12 @@ namespace ColourHelpers
if (hi > 0)
{
lightness = ((hi + lo) / 2.0f) / 255.0f;
lightness = ((float) (hi + lo) / 2.0f) / 255.0f;
if (lightness > 0.0f)
hue = getHue (col);
saturation = (hi - lo) / (1.0f - std::abs ((2.0f * lightness) - 1.0f));
saturation = (float) (hi - lo) / (1.0f - std::abs ((2.0f * lightness) - 1.0f));
}
}
@@ -136,12 +136,12 @@ namespace ColourHelpers
if (hi > 0)
{
saturation = (hi - lo) / (float) hi;
saturation = (float) (hi - lo) / (float) hi;
if (saturation > 0.0f)
hue = getHue (col);
brightness = hi / 255.0f;
brightness = (float) hi / 255.0f;
}
}


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save