@@ -114,7 +114,7 @@ public: | |||||
// (Our component is opaque, so we must completely fill the background with a solid colour) | // (Our component is opaque, so we must completely fill the background with a solid colour) | ||||
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); | g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); | ||||
auto centreY = getHeight() / 2.0f; | |||||
auto centreY = (float) getHeight() / 2.0f; | |||||
auto radius = amplitude * 200.0f; | auto radius = amplitude * 200.0f; | ||||
if (radius >= 0.0f) | if (radius >= 0.0f) | ||||
@@ -131,8 +131,8 @@ public: | |||||
Path wavePath; | Path wavePath; | ||||
wavePath.startNewSubPath (0, centreY); | 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)); | * std::sin (x * frequency * 0.0001f)); | ||||
g.setColour (getLookAndFeel().findColour (Slider::thumbColourId)); | g.setColour (getLookAndFeel().findColour (Slider::thumbColourId)); | ||||
@@ -149,8 +149,8 @@ public: | |||||
{ | { | ||||
lastMousePosition = e.position; | 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); | phaseDelta = (float) (MathConstants<double>::twoPi * frequency / sampleRate); | ||||
@@ -116,7 +116,7 @@ public: | |||||
if (thumbnail.getTotalLength() > 0) | if (thumbnail.getTotalLength() > 0) | ||||
{ | { | ||||
auto newScale = jmax (0.001, thumbnail.getTotalLength() * (1.0 - jlimit (0.0, 0.99, amount))); | 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 }); | setRange ({ timeAtCentre - newScale * 0.5, timeAtCentre + newScale * 0.5 }); | ||||
} | } | ||||
@@ -229,12 +229,12 @@ private: | |||||
if (visibleRange.getLength() <= 0) | if (visibleRange.getLength() <= 0) | ||||
return 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 | 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 | bool canMoveTransport() const noexcept | ||||
@@ -209,7 +209,7 @@ public: | |||||
auto noteDistance = float (getWidth()) / 128; | auto noteDistance = float (getWidth()) / 128; | ||||
for (auto i = 0; i < 128; ++i) | 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()); | auto noteHeight = int (MidiMessage::isMidiNoteBlack (i) ? 0.7 * getHeight() : getHeight()); | ||||
g.setColour (MidiMessage::isMidiNoteBlack (i) ? Colours::white : Colours::grey); | g.setColour (MidiMessage::isMidiNoteBlack (i) ? Colours::white : Colours::grey); | ||||
@@ -302,8 +302,8 @@ private: | |||||
Point<float> getCentrePositionForNote (MPENote note) const | Point<float> getCentrePositionForNote (MPENote note) const | ||||
{ | { | ||||
auto n = float (note.initialNote) + float (note.totalPitchbendInSemitones); | 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 }; | return { x, y }; | ||||
} | } | ||||
@@ -656,8 +656,8 @@ private: | |||||
auto xPos = zone.isLowerZone() ? 0 : zone.getLastMemberChannel() - 1; | 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.setColour (zoneColour); | ||||
g.drawRect (zoneRect, 3); | g.drawRect (zoneRect, 3); | ||||
@@ -680,8 +680,8 @@ private: | |||||
auto numChannels = legacyModeChannelRange.getEnd() - startChannel - 1; | 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); | zoneRect.removeFromTop (20); | ||||
@@ -694,7 +694,7 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
float getChannelRectangleWidth() const noexcept | float getChannelRectangleWidth() const noexcept | ||||
{ | { | ||||
return float (getWidth()) / numMidiChannels; | |||||
return (float) getWidth() / (float) numMidiChannels; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -273,7 +273,7 @@ private: | |||||
g.setColour (textColour); | g.setColour (textColour); | ||||
g.setFont (height * 0.7f); | |||||
g.setFont ((float) height * 0.7f); | |||||
if (isInput) | if (isInput) | ||||
{ | { | ||||
@@ -201,11 +201,11 @@ public: | |||||
Path generateStringPath() const | Path generateStringPath() const | ||||
{ | { | ||||
auto y = height / 2.0f; | |||||
auto y = (float) height / 2.0f; | |||||
Path stringPath; | Path stringPath; | ||||
stringPath.startNewSubPath (0, y); | 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; | return stringPath; | ||||
} | } | ||||
@@ -227,7 +227,7 @@ public: | |||||
{ | { | ||||
// this determines the visible vibration frequency. | // this determines the visible vibration frequency. | ||||
// just an arbitrary number chosen to look OK: | // just an arbitrary number chosen to look OK: | ||||
auto phaseStep = 400.0f / length; | |||||
auto phaseStep = 400.0f / (float) length; | |||||
phase += phaseStep; | phase += phaseStep; | ||||
@@ -337,7 +337,7 @@ private: | |||||
if (stringLine->getBounds().contains (e.getPosition())) | 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); | stringLine->stringPlucked (position); | ||||
stringSynths.getUnchecked (i)->stringPlucked (position); | stringSynths.getUnchecked (i)->stringPlucked (position); | ||||
@@ -162,7 +162,7 @@ public: | |||||
for (auto y = 1; y < imageHeight; ++y) | 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 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); | auto level = jmap (fftData[fftDataIndex], 0.0f, jmax (maxLevel.getEnd(), 1e-5f), 0.0f, 1.0f); | ||||
@@ -403,8 +403,8 @@ public: | |||||
if (auto grid = activeBlock->getLEDGrid()) | if (auto grid = activeBlock->getLEDGrid()) | ||||
{ | { | ||||
// Work out scale factors to translate X and Y touches to LED indexes | // 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); | setLEDProgram (*activeBlock); | ||||
} | } | ||||
@@ -188,11 +188,11 @@ public: | |||||
case e::north: | case e::north: | ||||
return { 0.0f, static_cast<float> (port.index) }; | return { 0.0f, static_cast<float> (port.index) }; | ||||
case e::east: | 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: | 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: | 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: | default: | ||||
break; | break; | ||||
} | } | ||||
@@ -204,13 +204,13 @@ public: | |||||
switch (port.edge) | switch (port.edge) | ||||
{ | { | ||||
case e::north: | 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: | 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: | 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: | 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: | default: | ||||
break; | break; | ||||
} | } | ||||
@@ -222,11 +222,11 @@ public: | |||||
switch (port.edge) | switch (port.edge) | ||||
{ | { | ||||
case e::north: | 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: | 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: | 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: | case e::west: | ||||
return { static_cast<float> (port.index), 0.0f }; | return { static_cast<float> (port.index), 0.0f }; | ||||
default: | default: | ||||
@@ -309,10 +309,10 @@ public: | |||||
g.fillAll (Colours::black); | g.fillAll (Colours::black); | ||||
// size ration between physical and on-screen blocks | // 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 | // iterate over the list of current touches and draw them on the onscreen Block | ||||
for (auto touch : touches) | for (auto touch : touches) | ||||
@@ -367,7 +367,7 @@ public: | |||||
addAndMakeVisible (roundedRectangleButton); | addAndMakeVisible (roundedRectangleButton); | ||||
// Display the battery level on the LEDRow | // 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 | // add LEDs | ||||
for (auto i = 0; i < numLeds; ++i) | for (auto i = 0; i < numLeds; ++i) | ||||
@@ -442,7 +442,7 @@ public: | |||||
void handleBatteryLevelUpdate (float batteryLevel) override | void handleBatteryLevelUpdate (float batteryLevel) override | ||||
{ | { | ||||
// Update the number of LEDs that are on to represent the battery level | // 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) | if (numLedsOn != previousNumLedsOn) | ||||
for (auto i = 0; i < numLeds; ++i) | for (auto i = 0; i < numLeds; ++i) | ||||
@@ -600,11 +600,11 @@ public: | |||||
noBlocksLabel.setJustificationType (Justification::centred); | noBlocksLabel.setJustificationType (Justification::centred); | ||||
zoomOutButton.setButtonText ("+"); | zoomOutButton.setButtonText ("+"); | ||||
zoomOutButton.onClick = [this] { blockUnitInPixels = (int) (blockUnitInPixels * 1.05f); resized(); }; | |||||
zoomOutButton.onClick = [this] { blockUnitInPixels = (int) ((float) blockUnitInPixels * 1.05f); resized(); }; | |||||
zoomOutButton.setAlwaysOnTop (true); | zoomOutButton.setAlwaysOnTop (true); | ||||
zoomInButton.setButtonText ("-"); | zoomInButton.setButtonText ("-"); | ||||
zoomInButton.onClick = [this] { blockUnitInPixels = (int) (blockUnitInPixels * 0.95f); resized(); }; | |||||
zoomInButton.onClick = [this] { blockUnitInPixels = (int) ((float) blockUnitInPixels * 0.95f); resized(); }; | |||||
zoomInButton.setAlwaysOnTop (true); | zoomInButton.setAlwaysOnTop (true); | ||||
// Register BlocksMonitorDemo as a listener to the PhysicalTopologySource object | // Register BlocksMonitorDemo as a listener to the PhysicalTopologySource object | ||||
@@ -670,8 +670,8 @@ public: | |||||
else if (rotation == 90) | else if (rotation == 90) | ||||
blockSize = blockComponent->block->getHeight(); | 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; | blockSize = 0; | ||||
if (rotation == 0) | if (rotation == 0) | ||||
@@ -679,8 +679,8 @@ public: | |||||
else if (rotation == 270) | else if (rotation == 270) | ||||
blockSize = blockComponent->block->getHeight(); | 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; | blockSize = 0; | ||||
if (rotation == 180) | if (rotation == 180) | ||||
@@ -688,8 +688,8 @@ public: | |||||
else if (rotation == 270) | else if (rotation == 270) | ||||
blockSize = blockComponent->block->getWidth(); | 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; | blockSize = 0; | ||||
if (rotation == 0) | if (rotation == 0) | ||||
@@ -697,14 +697,14 @@ public: | |||||
else if (rotation == 90) | else if (rotation == 90) | ||||
blockSize = blockComponent->block->getWidth(); | 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 totalWidth = std::abs (maxArea.getX()) + maxArea.getWidth(); | ||||
auto totalHeight = std::abs (maxArea.getY()) + maxArea.getHeight(); | 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->centreWithSize (masterBlockComponent->block->getWidth() * blockUnitInPixels, | ||||
masterBlockComponent->block->getHeight() * blockUnitInPixels); | masterBlockComponent->block->getHeight() * blockUnitInPixels); | ||||
@@ -721,8 +721,8 @@ public: | |||||
if (blockComponent == masterBlockComponent) | if (blockComponent == masterBlockComponent) | ||||
continue; | 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->getWidth() * blockUnitInPixels, | ||||
blockComponent->block->getHeight() * blockUnitInPixels); | blockComponent->block->getHeight() * blockUnitInPixels); | ||||
@@ -665,8 +665,8 @@ public: | |||||
if (auto grid = activeBlock->getLEDGrid()) | if (auto grid = activeBlock->getLEDGrid()) | ||||
{ | { | ||||
// Work out scale factors to translate X and Y touches to LED indexes | // 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); | setLEDProgram (*activeBlock); | ||||
} | } | ||||
@@ -731,7 +731,7 @@ private: | |||||
layout.touchColour); | layout.touchColour); | ||||
// Send pitch change and pressure values to the Audio class | // 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); | audio.pressureChange (midiChannel, touch.z); | ||||
} | } | ||||
@@ -31,23 +31,19 @@ function(_juce_add_pips) | |||||
CONFIGURE_DEPENDS LIST_DIRECTORIES false | CONFIGURE_DEPENDS LIST_DIRECTORIES false | ||||
"${CMAKE_CURRENT_SOURCE_DIR}/*.h") | "${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}) | foreach(header IN ITEMS ${headers}) | ||||
juce_add_pip(${header} added_target) | 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_config_flags | ||||
juce::juce_recommended_lto_flags | juce::juce_recommended_lto_flags | ||||
juce::juce_recommended_warning_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() | endforeach() | ||||
endfunction() | endfunction() | ||||
@@ -80,13 +80,13 @@ private: | |||||
Path wavePath; | Path wavePath; | ||||
auto waveStep = 10.0f; | auto waveStep = 10.0f; | ||||
auto waveY = getHeight() * 0.44f; | |||||
auto waveY = (float) getHeight() * 0.44f; | |||||
int i = 0; | 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.addLineSegment ({ x, y1, x, y2 }, 2.0f); | ||||
wavePath.addEllipse (x - waveStep * 0.3f, y1 - waveStep * 0.3f, waveStep * 0.6f, waveStep * 0.6f); | wavePath.addEllipse (x - waveStep * 0.3f, y1 - waveStep * 0.3f, waveStep * 0.6f, waveStep * 0.6f); | ||||
@@ -131,10 +131,10 @@ private: | |||||
setFullScreen (true); | setFullScreen (true); | ||||
Desktop::getInstance().setOrientationsEnabled (Desktop::rotatedClockwise | Desktop::rotatedAntiClockwise); | Desktop::getInstance().setOrientationsEnabled (Desktop::rotatedClockwise | Desktop::rotatedAntiClockwise); | ||||
#else | #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 | #endif | ||||
setContentOwned (new MainComponent(), false); | setContentOwned (new MainComponent(), false); | ||||
@@ -119,8 +119,8 @@ private: | |||||
graphicsTitleLabel.setBounds (bounds.removeFromTop (30)); | graphicsTitleLabel.setBounds (bounds.removeFromTop (30)); | ||||
bounds.removeFromTop (space); | 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)); | lookAndFeelSelector.setBounds (bounds.removeFromTop (itemHeight).withWidth ((int) width).withX ((int) xPos)); | ||||
@@ -80,13 +80,13 @@ public: | |||||
for (auto i = 0; i < fishLength; ++i) | 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 | // 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) | if (i == 0) | ||||
spinePath.startNewSubPath (p); // if this is the first point, start a new path.. | spinePath.startNewSubPath (p); // if this is the first point, start a new path.. | ||||
@@ -123,10 +123,10 @@ struct BallComponent : public Component | |||||
void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
{ | { | ||||
g.setColour (colour); | 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.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; | Point<float> position, speed; | ||||
@@ -262,10 +262,10 @@ private: | |||||
auto newIndex = (componentsToAnimate.indexOf (component) + 3 * cycleCount) | auto newIndex = (componentsToAnimate.indexOf (component) + 3 * cycleCount) | ||||
% componentsToAnimate.size(); | % 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, | Rectangle<int> r (getWidth() / 2 + (int) (radius * std::sin (angle)) - 50, | ||||
getHeight() / 2 + (int) (radius * std::cos (angle)) - 50, | getHeight() / 2 + (int) (radius * std::cos (angle)) - 50, | ||||
@@ -125,13 +125,13 @@ public: | |||||
auto nextPos = pos + delta; | 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; | delta.x = -delta.x; | ||||
nextPos.x = pos.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; | delta.y = -delta.y; | ||||
nextPos.y = pos.y + delta.y; | nextPos.y = pos.y + delta.y; | ||||
@@ -234,17 +234,17 @@ public: | |||||
float amplitudeToY (float amp) const noexcept | 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 | 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 | 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 | void timerCallback() override | ||||
@@ -197,8 +197,8 @@ public: | |||||
AttributedString s; | AttributedString s; | ||||
s.setWordWrap (AttributedString::none); | s.setWordWrap (AttributedString::none); | ||||
s.setJustification (Justification::centredLeft); | 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()); | s.draw (g, Rectangle<int> (width, height).expanded (-4, 50).toFloat()); | ||||
} | } | ||||
@@ -125,8 +125,8 @@ public: | |||||
AffineTransform getTransform() | 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; | AffineTransform t; | ||||
@@ -197,7 +197,7 @@ public: | |||||
"Time: " + String (averageTimeMs, 2) | "Time: " + String (averageTimeMs, 2) | ||||
+ " ms\nEffective FPS: " + String (effectiveFPS, 1) | + " ms\nEffective FPS: " + String (effectiveFPS, 1) | ||||
+ "\nActual FPS: " + String (averageActualFPS, 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.setColour (Colours::white.withAlpha (0.5f)); | ||||
g.fillRect (ga.getBoundingBox (0, ga.getNumGlyphs(), true).getSmallestIntegerContainer().expanded (4)); | g.fillRect (ga.getBoundingBox (0, ga.getNumGlyphs(), true).getSmallestIntegerContainer().expanded (4)); | ||||
@@ -213,8 +213,8 @@ public: | |||||
auto w = getWidth() / 2; | auto w = getWidth() / 2; | ||||
auto h = getHeight() / 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); | g.reduceClipRegion (x, y, w, h); | ||||
} | } | ||||
@@ -239,12 +239,12 @@ public: | |||||
if (! clipImage.isValid()) | if (! clipImage.isValid()) | ||||
createClipImage(); | 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) | .rotated (clipImageAngle.getValue() * MathConstants<float>::twoPi) | ||||
.scaled (2.0f + clipImageSize.getValue() * 3.0f) | .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); | g.reduceClipRegion (clipImage, transform); | ||||
} | } | ||||
@@ -297,17 +297,17 @@ public: | |||||
g.fillRect (-rectSize, -rectSize, rectSize, rectSize); | g.fillRect (-rectSize, -rectSize, rectSize, rectSize); | ||||
g.setGradientFill (ColourGradient (colour1, 10.0f, (float) -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.setOpacity (getAlpha()); | ||||
g.fillRect (10, -rectSize, rectSize, rectSize); | 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.setOpacity (getAlpha()); | ||||
g.fillRect (-rectSize, 10, rectSize, rectSize); | g.fillRect (-rectSize, 10, rectSize, rectSize); | ||||
g.setGradientFill (ColourGradient (colour1, 10.0f, 10.0f, | 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.setOpacity (getAlpha()); | ||||
g.drawRect (10, 10, rectSize, rectSize, 5); | 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 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); | 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, | ColourGradient gradient (c1, x1, y1, | ||||
c2, x2, y2, | c2, x2, y2, | ||||
@@ -530,8 +530,8 @@ public: | |||||
for (int x = 0; x < getWidth(); ++x) | 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)); | 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) | 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)); | horizontalLines.addWithoutMerging (Rectangle<float> (x - length * 0.5f, (float) y, length, 1.0f)); | ||||
} | } | ||||
@@ -90,8 +90,8 @@ struct CustomLookAndFeel : public LookAndFeel_V4 | |||||
auto flatOnTop = button.isConnectedOnTop(); | auto flatOnTop = button.isConnectedOnTop(); | ||||
auto flatOnBottom = button.isConnectedOnBottom(); | 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) | if (width > 0 && height > 0) | ||||
{ | { | ||||
@@ -168,13 +168,13 @@ struct CustomLookAndFeel : public LookAndFeel_V4 | |||||
if (style == Slider::LinearVertical) | if (style == Slider::LinearVertical) | ||||
{ | { | ||||
kx = x + width * 0.5f; | |||||
kx = (float) x + (float) width * 0.5f; | |||||
ky = sliderPos; | ky = sliderPos; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
kx = sliderPos; | kx = sliderPos; | ||||
ky = y + height * 0.5f; | |||||
ky = (float) y + (float) height * 0.5f; | |||||
} | } | ||||
auto outlineThickness = slider.isEnabled() ? 0.8f : 0.3f; | auto outlineThickness = slider.isEnabled() ? 0.8f : 0.3f; | ||||
@@ -203,9 +203,9 @@ struct CustomLookAndFeel : public LookAndFeel_V4 | |||||
Path p; | Path p; | ||||
if (style == Slider::LinearBarVertical) | 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 | 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) | auto baseColour = slider.findColour (Slider::rotarySliderFillColourId) | ||||
.withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f) | .withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f) | ||||
@@ -214,7 +214,7 @@ struct CustomLookAndFeel : public LookAndFeel_V4 | |||||
g.setColour (baseColour); | g.setColour (baseColour); | ||||
g.fillPath (p); | 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); | g.drawRect (slider.getLocalBounds().toFloat(), lineThickness); | ||||
} | } | ||||
else | else | ||||
@@ -230,13 +230,13 @@ struct CustomLookAndFeel : public LookAndFeel_V4 | |||||
float /*maxSliderPos*/, | float /*maxSliderPos*/, | ||||
const Slider::SliderStyle /*style*/, Slider& slider) override | const Slider::SliderStyle /*style*/, Slider& slider) override | ||||
{ | { | ||||
auto sliderRadius = getSliderThumbRadius (slider) - 5.0f; | |||||
auto sliderRadius = (float) getSliderThumbRadius (slider) - 5.0f; | |||||
Path on, off; | Path on, off; | ||||
if (slider.isHorizontal()) | 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())); | auto onW = r.getWidth() * ((float) slider.valueToProportionOfLength (slider.getValue())); | ||||
on.addRectangle (r.removeFromLeft (onW)); | on.addRectangle (r.removeFromLeft (onW)); | ||||
@@ -244,8 +244,8 @@ struct CustomLookAndFeel : public LookAndFeel_V4 | |||||
} | } | ||||
else | 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())); | auto onH = r.getHeight() * ((float) slider.valueToProportionOfLength (slider.getValue())); | ||||
on.addRectangle (r.removeFromBottom (onH)); | 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, | void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos, | ||||
float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override | 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 rx = centreX - radius; | ||||
auto ry = centreY - radius; | auto ry = centreY - radius; | ||||
auto rw = radius * 2.0f; | 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; | Path outlineArc; | ||||
outlineArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, rotaryEndAngle, 0.0); | outlineArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, rotaryEndAngle, 0.0); | ||||
g.strokePath (outlineArc, PathStrokeType (lineThickness)); | g.strokePath (outlineArc, PathStrokeType (lineThickness)); | ||||
@@ -307,8 +307,8 @@ struct SquareLookAndFeel : public CustomLookAndFeel | |||||
if (isButtonDown || isMouseOverButton) | if (isButtonDown || isMouseOverButton) | ||||
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.1f); | 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) | if (width > 0 && height > 0) | ||||
{ | { | ||||
@@ -372,14 +372,14 @@ struct SquareLookAndFeel : public CustomLookAndFeel | |||||
if (style == Slider::LinearVertical) | if (style == Slider::LinearVertical) | ||||
{ | { | ||||
kx = x + width * 0.5f; | |||||
kx = (float) x + (float) width * 0.5f; | |||||
ky = sliderPos; | ky = sliderPos; | ||||
g.fillRect (Rectangle<float> (kx - sliderRadius, ky - 2.5f, sliderRadius * 2.0f, 5.0f)); | g.fillRect (Rectangle<float> (kx - sliderRadius, ky - 2.5f, sliderRadius * 2.0f, 5.0f)); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
kx = sliderPos; | 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)); | 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, | void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos, | ||||
float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override | 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 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 rx = centreX - radius; | ||||
auto ry = centreY - radius; | auto ry = centreY - radius; | ||||
auto rw = radius * 2.0f; | auto rw = radius * 2.0f; | ||||
@@ -102,7 +102,7 @@ private: | |||||
burgerButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20)); | 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); | titleLabel.setBounds (r); | ||||
} | } | ||||
@@ -92,7 +92,7 @@ public: | |||||
Matrix3D<float> getViewMatrix() const | Matrix3D<float> getViewMatrix() const | ||||
{ | { | ||||
Matrix3D<float> viewMatrix ({ 0.0f, 0.0f, -10.0f }); | 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; | return rotationMatrix * viewMatrix; | ||||
} | } | ||||
@@ -107,7 +107,7 @@ public: | |||||
glEnable (GL_BLEND); | glEnable (GL_BLEND); | ||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 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(); | shader->use(); | ||||
@@ -655,7 +655,10 @@ struct OpenGLUtils | |||||
g.drawRect (0, 0, size, size, 2); | g.drawRect (0, 0, size, size, 2); | ||||
g.setColour (Colours::green); | 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.setColour (Colours::black); | ||||
g.setFont (40); | g.setFont (40); | ||||
@@ -827,7 +830,7 @@ public: | |||||
openGLContext.extensions.glActiveTexture (GL_TEXTURE0); | openGLContext.extensions.glActiveTexture (GL_TEXTURE0); | ||||
glEnable (GL_TEXTURE_2D); | 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(); | texture.bind(); | ||||
@@ -913,8 +916,8 @@ private: | |||||
{ | { | ||||
// Create an OpenGLGraphicsContext that will draw into this GL window.. | // Create an OpenGLGraphicsContext that will draw into this GL window.. | ||||
std::unique_ptr<LowLevelGraphicsContext> glRenderer (createOpenGLGraphicsContext (openGLContext, | 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) | if (glRenderer.get() != nullptr) | ||||
{ | { | ||||
@@ -927,11 +930,11 @@ private: | |||||
// This stuff just creates a spinning star shape and fills it.. | // This stuff just creates a spinning star shape and fills it.. | ||||
Path p; | 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, | 7, | ||||
getHeight() * size * 0.5f, | |||||
getHeight() * size, | |||||
(float) getHeight() * size * 0.5f, | |||||
(float) getHeight() * size, | |||||
s.angle.getValue()); | s.angle.getValue()); | ||||
auto hue = s.hue.getValue(); | auto hue = s.hue.getValue(); | ||||
@@ -1106,7 +1106,7 @@ private: | |||||
g.fillAll (Colours::lightblue); | g.fillAll (Colours::lightblue); | ||||
g.setColour (LookAndFeel::getDefaultLookAndFeel().findColour (Label::textColourId)); | 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), | g.drawText ("Draggable Thing #" + String (rowNumber + 1), | ||||
5, 0, width, height, | 5, 0, width, height, | ||||
@@ -116,7 +116,7 @@ public: | |||||
Random random; | Random random; | ||||
auto size = 10.0f + random.nextInt (30); | |||||
auto size = 10.0f + (float) random.nextInt (30); | |||||
ballBounds.setBounds (random.nextFloat() * 100.0f, | ballBounds.setBounds (random.nextFloat() * 100.0f, | ||||
random.nextFloat() * 100.0f, | random.nextFloat() * 100.0f, | ||||
@@ -142,10 +142,10 @@ public: | |||||
{ | { | ||||
ballBounds += direction; | 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()); | setBounds (ballBounds.getSmallestIntegerContainer()); | ||||
} | } | ||||
@@ -115,7 +115,7 @@ public: | |||||
sliderPos = (sliderPos - minSliderPos) / static_cast<float> (width); | 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.setColour (sliderActivePart); | ||||
g.fillRect (backgroundBar.removeFromLeft (knobPos)); | g.fillRect (backgroundBar.removeFromLeft (knobPos)); | ||||
@@ -303,7 +303,7 @@ private: | |||||
Path rewindShape; | Path rewindShape; | ||||
rewindShape.addRectangle (0.0, 0.0, 5.0, buttonSize); | 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.setShape (rewindShape, true, true, false); | ||||
rewindButton.onClick = [this] | rewindButton.onClick = [this] | ||||
{ | { | ||||
@@ -383,19 +383,19 @@ private: | |||||
area.removeFromLeft (20); | area.removeFromLeft (20); | ||||
transportText.setBounds (area.removeFromTop (120)); | transportText.setBounds (area.removeFromTop (120)); | ||||
auto navigationArea = area.removeFromTop (buttonSize); | |||||
auto navigationArea = area.removeFromTop ((int) buttonSize); | |||||
rewindButton.setTopLeftPosition (navigationArea.getPosition()); | rewindButton.setTopLeftPosition (navigationArea.getPosition()); | ||||
navigationArea.removeFromLeft (buttonSize + 10); | |||||
navigationArea.removeFromLeft ((int) buttonSize + 10); | |||||
playButton.setTopLeftPosition (navigationArea.getPosition()); | playButton.setTopLeftPosition (navigationArea.getPosition()); | ||||
navigationArea.removeFromLeft (buttonSize + 10); | |||||
navigationArea.removeFromLeft ((int) buttonSize + 10); | |||||
recordButton.setTopLeftPosition (navigationArea.getPosition()); | recordButton.setTopLeftPosition (navigationArea.getPosition()); | ||||
area.removeFromTop (30); | area.removeFromTop (30); | ||||
auto appSwitchArea = area.removeFromTop (buttonSize); | |||||
auto appSwitchArea = area.removeFromTop ((int) buttonSize); | |||||
switchToHostButtonLabel.setBounds (appSwitchArea.removeFromLeft (100)); | switchToHostButtonLabel.setBounds (appSwitchArea.removeFromLeft (100)); | ||||
appSwitchArea.removeFromLeft (5); | appSwitchArea.removeFromLeft (5); | ||||
switchToHostButton.setBounds (appSwitchArea.removeFromLeft (buttonSize)); | |||||
switchToHostButton.setBounds (appSwitchArea.removeFromLeft ((int) buttonSize)); | |||||
} | } | ||||
private: | private: | ||||
@@ -513,7 +513,7 @@ private: | |||||
if (visible) | if (visible) | ||||
{ | { | ||||
auto icon = hostType.getHostIcon (buttonSize); | |||||
auto icon = hostType.getHostIcon ((int) buttonSize); | |||||
switchToHostButton.setImages(false, true, true, | switchToHostButton.setImages(false, true, true, | ||||
icon, 1.0, Colours::transparentBlack, | icon, 1.0, Colours::transparentBlack, | ||||
icon, 1.0, Colours::transparentBlack, | icon, 1.0, Colours::transparentBlack, | ||||
@@ -525,7 +525,7 @@ private: | |||||
IAAEffectProcessor& iaaEffectProcessor; | IAAEffectProcessor& iaaEffectProcessor; | ||||
AudioProcessorValueTreeState& parameters; | AudioProcessorValueTreeState& parameters; | ||||
const int buttonSize = 30; | |||||
const float buttonSize = 30.0f; | |||||
const Colour defaultButtonColour = Colours::darkgrey; | const Colour defaultButtonColour = Colours::darkgrey; | ||||
ShapeButton rewindButton {"Rewind", defaultButtonColour, defaultButtonColour, defaultButtonColour}; | ShapeButton rewindButton {"Rewind", defaultButtonColour, defaultButtonColour, defaultButtonColour}; | ||||
ShapeButton playButton {"Play", defaultButtonColour, defaultButtonColour, defaultButtonColour}; | ShapeButton playButton {"Play", defaultButtonColour, defaultButtonColour, defaultButtonColour}; | ||||
@@ -1005,7 +1005,7 @@ public: | |||||
double getSampleLengthSeconds() const | double getSampleLengthSeconds() const | ||||
{ | { | ||||
if (auto r = getSampleReader()) | if (auto r = getSampleReader()) | ||||
return r->lengthInSamples / r->sampleRate; | |||||
return (double) r->lengthInSamples / r->sampleRate; | |||||
return 1.0; | return 1.0; | ||||
} | } | ||||
@@ -1538,7 +1538,7 @@ private: | |||||
void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
{ | { | ||||
auto minDivisionWidth = 50.0f; | auto minDivisionWidth = 50.0f; | ||||
auto maxDivisions = getWidth() / minDivisionWidth; | |||||
auto maxDivisions = (float) getWidth() / minDivisionWidth; | |||||
auto lookFeel = dynamic_cast<LookAndFeel_V4*> (&getLookAndFeel()); | auto lookFeel = dynamic_cast<LookAndFeel_V4*> (&getLookAndFeel()); | ||||
auto bg = lookFeel->getCurrentColourScheme() | auto bg = lookFeel->getCurrentColourScheme() | ||||
@@ -1593,7 +1593,7 @@ private: | |||||
{ | { | ||||
// Work out the scale of the new range | // Work out the scale of the new range | ||||
auto unitDistance = 100.0f; | 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 | // Now position it so that the mouse continues to point at the same | ||||
// place on the ruler. | // place on the ruler. | ||||
@@ -88,11 +88,15 @@ struct Test | |||||
std::unique_ptr<b2World> m_world { new b2World (b2Vec2 (0.0f, -10.0f)) }; | 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/AddPair.h" | ||||
#include "../Assets/Box2DTests/ApplyForce.h" | #include "../Assets/Box2DTests/ApplyForce.h" | ||||
#include "../Assets/Box2DTests/Dominos.h" | #include "../Assets/Box2DTests/Dominos.h" | ||||
#include "../Assets/Box2DTests/Chain.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 | /** This list box just displays a StringArray and broadcasts a change message when the | ||||
selected row changes. | selected row changes. | ||||
@@ -118,7 +122,7 @@ public: | |||||
lf.findColour (ListBox::backgroundColourId))); | lf.findColour (ListBox::backgroundColourId))); | ||||
g.setColour (lf.findColour (ListBox::textColourId)); | 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), | g.drawText (tests[row], Rectangle<int> (0, 0, w, h).reduced (2), | ||||
Justification::centredLeft, true); | Justification::centredLeft, true); | ||||
} | } | ||||
@@ -275,7 +275,7 @@ public: | |||||
Rectangle<int> r (0, 0, w, h); | Rectangle<int> r (0, 0, w, h); | ||||
auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | 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.fillRect (r); | ||||
g.setColour (lf.findColour (ListBox::textColourId)); | g.setColour (lf.findColour (ListBox::textColourId)); | ||||
@@ -461,7 +461,7 @@ public: | |||||
auto r = Rectangle<int> (0, 0, w, h).reduced (4); | auto r = Rectangle<int> (0, 0, w, h).reduced (4); | ||||
auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | 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.fillRect (r); | ||||
} | } | ||||
@@ -121,8 +121,8 @@ private: | |||||
{ | { | ||||
const ScopedLock lock (drawing); | 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, | float x = 0.0f, y = 0.0f, | ||||
@@ -75,7 +75,7 @@ public: | |||||
// use a "colour" attribute in the xml tag for this node to set the text colour.. | // 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.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.. | // draw the xml element's tag name.. | ||||
g.drawText (xml.getTagName(), | g.drawText (xml.getTagName(), | ||||
@@ -145,7 +145,7 @@ public: | |||||
g.fillAll (Colours::blue.withAlpha (0.3f)); | g.fillAll (Colours::blue.withAlpha (0.3f)); | ||||
g.setColour (Colours::black); | g.setColour (Colours::black); | ||||
g.setFont (height * 0.7f); | |||||
g.setFont ((float) height * 0.7f); | |||||
// draw the element's tag name.. | // draw the element's tag name.. | ||||
g.drawText (getText(), | g.drawText (getText(), | ||||
@@ -245,13 +245,13 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
static double getPreciseTimeMs() noexcept | 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 | double getPhysicalTimeLimitMs() const noexcept | ||||
{ | { | ||||
return 1000.0 * a.size() / currentSampleRate; | |||||
return 1000.0 * (double) a.size() / currentSampleRate; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -139,7 +139,7 @@ struct GraphEditorPanel::PinComponent : public Component, | |||||
auto colour = (pin.isMIDI() ? Colours::red : Colours::green); | 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); | g.fillPath (p); | ||||
} | } | ||||
@@ -963,7 +963,7 @@ struct GraphDocumentComponent::TooltipBar : public Component, | |||||
void paint (Graphics& g) override | 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.setColour (Colours::black); | ||||
g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1); | g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1); | ||||
} | } | ||||
@@ -256,8 +256,8 @@ private: | |||||
{ | { | ||||
auto total = currentCanvas.getLimits(); | 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 | Rectangle<float> virtualSpaceToLocal (Rectangle<float> p) const | ||||
@@ -270,8 +270,8 @@ private: | |||||
{ | { | ||||
auto total = currentCanvas.getLimits(); | 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()) }; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -80,8 +80,8 @@ private: | |||||
OSCMessage message (userInputOSCAddress); | OSCMessage message (userInputOSCAddress); | ||||
message.addString (clientName); | 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); | send (message); | ||||
} | } | ||||
@@ -104,8 +104,8 @@ public: | |||||
passwordBox.setBounds (bounds.removeFromTop (textEditorHeight)); | passwordBox.setBounds (bounds.removeFromTop (textEditorHeight)); | ||||
bounds.removeFromTop (spacing * 2); | 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)); | logInButton.setBounds (bounds.removeFromTop (textEditorHeight)); | ||||
@@ -97,7 +97,8 @@ private: | |||||
auto parentBounds = mainWindow.getBounds(); | auto parentBounds = mainWindow.getBounds(); | ||||
componentImage = mainWindow.createComponentSnapshot (mainWindow.getLocalBounds()) | 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()); | kernel.applyToImage (componentImage, componentImage, getLocalBounds()); | ||||
@@ -53,7 +53,7 @@ public: | |||||
} | } | ||||
auto area = RectanglePlacement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize) | 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; | Path p; | ||||
p.addRectangle (area); | p.addRectangle (area); | ||||
@@ -150,7 +150,7 @@ private: | |||||
const auto charArea = codeEditor->getCharacterBounds (startPosition); | const auto charArea = codeEditor->getCharacterBounds (startPosition); | ||||
const int height = charArea.getHeight() + 8; | 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()), | const int width = jmin (height * 2 + f.getStringWidth (launchButton.getName()), | ||||
jmax (120, codeEditor->proportionOfWidth (0.2f))); | jmax (120, codeEditor->proportionOfWidth (0.2f))); | ||||
@@ -191,7 +191,7 @@ private: | |||||
.draw (g, r.removeFromLeft (getHeight()).toFloat(), false); | .draw (g, r.removeFromLeft (getHeight()).toFloat(), false); | ||||
g.setColour (Colours::white); | g.setColour (Colours::white); | ||||
g.setFont (getHeight() * 0.7f); | |||||
g.setFont ((float) getHeight() * 0.7f); | |||||
g.drawFittedText (getName(), r, Justification::centredLeft, 1); | g.drawFittedText (getName(), r, Justification::centredLeft, 1); | ||||
} | } | ||||
@@ -324,9 +324,9 @@ private: | |||||
g.fillRect (getLocalBounds().withTrimmedBottom (lineOffset)); | g.fillRect (getLocalBounds().withTrimmedBottom (lineOffset)); | ||||
Path path; | Path path; | ||||
const float bottomY = getHeight() - (lineOffset / 2.0f); | |||||
const float bottomY = (float) getHeight() - ((float) lineOffset / 2.0f); | |||||
path.addTriangle ((float) arrowXMin, bottomY, | path.addTriangle ((float) arrowXMin, bottomY, | ||||
(arrowXMax + arrowXMin) / 2.0f, (float) lineOffset, | |||||
(float) (arrowXMax + arrowXMin) / 2.0f, (float) lineOffset, | |||||
(float) arrowXMax, bottomY); | (float) arrowXMax, bottomY); | ||||
g.setColour (diagColour.withAlpha (0.8f)); | g.setColour (diagColour.withAlpha (0.8f)); | ||||
@@ -403,7 +403,7 @@ public: | |||||
void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
{ | { | ||||
Path outline; | 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.setColour (Colours::black.withAlpha (0.6f)); | ||||
g.fillPath (outline); | g.fillPath (outline); | ||||
@@ -146,7 +146,7 @@ private: | |||||
g.fillAll (Colours::lightblue); | g.fillAll (Colours::lightblue); | ||||
g.setColour (Colours::black); | 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); | g.drawText (name, 4, 0, width - 4, height, Justification::centredLeft, true); | ||||
} | } | ||||
@@ -407,7 +407,7 @@ private: | |||||
Graphics g (image); | Graphics g (image); | ||||
g.fillCheckerBoard (image.getBounds().toFloat(), | 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); | Colours::white, Colours::lightgrey); | ||||
g.setFont (12.0f); | g.setFont (12.0f); | ||||
@@ -83,7 +83,7 @@ protected: | |||||
void changed() const | void changed() const | ||||
{ | { | ||||
jassert (routine.getDocument() != 0); | |||||
jassert (routine.getDocument() != nullptr); | |||||
routine.getDocument()->changed(); | routine.getDocument()->changed(); | ||||
} | } | ||||
@@ -57,10 +57,10 @@ public: | |||||
void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
{ | { | ||||
g.setColour (Colours::white); | 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.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); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -66,7 +66,7 @@ public: | |||||
Colour (0xffffffff).overlaidWith (colour)); | Colour (0xffffffff).overlaidWith (colour)); | ||||
g.setColour (Colours::white.overlaidWith (colour).contrasting()); | 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), | g.drawFittedText (colour.toDisplayString (true), | ||||
2, 1, getWidth() - 4, getHeight() - 1, | 2, 1, getWidth() - 4, getHeight() - 1, | ||||
Justification::centred, 1); | Justification::centred, 1); | ||||
@@ -78,7 +78,7 @@ public: | |||||
g.setColour (findColour (defaultTextColourId)); | g.setColour (findColour (defaultTextColourId)); | ||||
} | } | ||||
g.setFont (height * 0.6f); | |||||
g.setFont ((float) height * 0.6f); | |||||
g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row], | g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row], | ||||
30, 0, width - 32, height, | 30, 0, width - 32, height, | ||||
Justification::centredLeft, true); | Justification::centredLeft, true); | ||||
@@ -1037,7 +1037,7 @@ bool JucerDocumentEditor::perform (const InvocationInfo& info) | |||||
else if (info.commandID == JucerCommandIDs::compOverlay100) | else if (info.commandID == JucerCommandIDs::compOverlay100) | ||||
amount = 100; | amount = 100; | ||||
document->setComponentOverlayOpacity (amount * 0.01f); | |||||
document->setComponentOverlayOpacity ((float) amount * 0.01f); | |||||
} | } | ||||
break; | break; | ||||
@@ -74,8 +74,8 @@ public: | |||||
*/ | */ | ||||
PositionedRectangle() noexcept | PositionedRectangle() noexcept | ||||
: x (0.0), y (0.0), w (0.0), h (0.0), | : 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) | wMode (absoluteSize), hMode (absoluteSize) | ||||
{ | { | ||||
} | } | ||||
@@ -283,23 +283,23 @@ public: | |||||
const SizeMode widthMode, const SizeMode heightMode, | const SizeMode widthMode, const SizeMode heightMode, | ||||
const Rectangle<int>& target) noexcept | const Rectangle<int>& target) noexcept | ||||
{ | { | ||||
if (xMode != (xAnchor | xMode_) || wMode != widthMode) | |||||
if (xMode != ((int) xAnchor | (int) xMode_) || wMode != widthMode) | |||||
{ | { | ||||
double tx, tw; | double tx, tw; | ||||
applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth()); | applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth()); | ||||
xMode = (uint8) (xAnchor | xMode_); | |||||
xMode = (uint8) ((int) xAnchor | (int) xMode_); | |||||
wMode = (uint8) widthMode; | wMode = (uint8) widthMode; | ||||
updatePosAndSize (x, w, tx, tw, xMode, wMode, target.getX(), target.getWidth()); | 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; | double ty, th; | ||||
applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight()); | applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight()); | ||||
yMode = (uint8) (yAnchor | yMode_); | |||||
yMode = (uint8) ((int) yAnchor | (int) yMode_); | |||||
hMode = (uint8) heightMode; | hMode = (uint8) heightMode; | ||||
updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight()); | updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight()); | ||||
@@ -65,7 +65,7 @@ public: | |||||
{ | { | ||||
g.setColour (findColour (defaultTextColourId)); | g.setColour (findColour (defaultTextColourId)); | ||||
g.setFont (height * 0.7f); | |||||
g.setFont ((float) height * 0.7f); | |||||
g.drawText (activities [rowNumber], | g.drawText (activities [rowNumber], | ||||
4, 0, width - 5, height, Justification::centredLeft, true); | 4, 0, width - 5, height, Justification::centredLeft, true); | ||||
} | } | ||||
@@ -206,14 +206,14 @@ public: | |||||
jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels())); | jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels())); | ||||
concertinaPanel.setPanelSize (concertinaPanel.getPanel (panelIndex), | concertinaPanel.setPanelSize (concertinaPanel.getPanel (panelIndex), | ||||
roundToInt (prop * (concertinaPanel.getHeight() - 90)), false); | |||||
roundToInt (prop * (float) (concertinaPanel.getHeight() - 90)), false); | |||||
} | } | ||||
float getPanelHeightProportion (int panelIndex) | float getPanelHeightProportion (int panelIndex) | ||||
{ | { | ||||
jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels())); | 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: | private: | ||||
@@ -60,7 +60,7 @@ public: | |||||
for (auto s : columnHeaders) | for (auto s : columnHeaders) | ||||
{ | { | ||||
addAndMakeVisible (headers.add (new Label (s, s))); | addAndMakeVisible (headers.add (new Label (s, s))); | ||||
widths.add (1.0f / columnHeaders.size()); | |||||
widths.add (1.0f / (float) columnHeaders.size()); | |||||
} | } | ||||
setSize (200, 40); | setSize (200, 40); | ||||
@@ -90,7 +90,7 @@ public: | |||||
auto index = 0; | auto index = 0; | ||||
for (auto h : headers) | for (auto h : headers) | ||||
{ | { | ||||
auto headerWidth = roundToInt (width * widths.getUnchecked (index)); | |||||
auto headerWidth = roundToInt ((float) width * widths.getUnchecked (index)); | |||||
h->setBounds (bounds.removeFromLeft (headerWidth)); | h->setBounds (bounds.removeFromLeft (headerWidth)); | ||||
++index; | ++index; | ||||
} | } | ||||
@@ -114,7 +114,7 @@ public: | |||||
for (int i = 0; i < index; ++i) | for (int i = 0; i < index; ++i) | ||||
prop += widths.getUnchecked (i); | prop += widths.getUnchecked (i); | ||||
return roundToInt (prop * getWidth()); | |||||
return roundToInt (prop * (float) getWidth()); | |||||
} | } | ||||
float getProportionAtIndex (int index) | float getProportionAtIndex (int index) | ||||
@@ -372,7 +372,7 @@ private: | |||||
if (availableTextWidth == 0) | if (availableTextWidth == 0) | ||||
return 0; | return 0; | ||||
return static_cast<int> (nameWidth / availableTextWidth); | |||||
return static_cast<int> (nameWidth / (float) availableTextWidth); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -155,7 +155,7 @@ private: | |||||
{ | { | ||||
if (header != nullptr) | 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); | auto iconBounds = textBounds.removeFromLeft (25); | ||||
@@ -175,7 +175,7 @@ private: | |||||
if (header != nullptr) | if (header != nullptr) | ||||
{ | { | ||||
auto bounds = getLocalBounds(); | auto bounds = getLocalBounds(); | ||||
auto width = getWidth(); | |||||
auto width = (float) getWidth(); | |||||
bounds.removeFromLeft (roundToInt (header->getProportionAtIndex (0) * width)); | bounds.removeFromLeft (roundToInt (header->getProportionAtIndex (0) * width)); | ||||
@@ -70,7 +70,7 @@ HeaderComponent::~HeaderComponent() | |||||
void HeaderComponent::resized() | void HeaderComponent::resized() | ||||
{ | { | ||||
auto bounds = getLocalBounds(); | auto bounds = getLocalBounds(); | ||||
configLabel.setFont ({ bounds.getHeight() / 3.0f }); | |||||
configLabel.setFont ({ (float) bounds.getHeight() / 3.0f }); | |||||
{ | { | ||||
auto headerBounds = bounds.removeFromLeft (tabsWidth); | auto headerBounds = bounds.removeFromLeft (tabsWidth); | ||||
@@ -96,11 +96,11 @@ void HeaderComponent::resized() | |||||
saveAndOpenInIDEButton.setBounds (exporterBounds.removeFromRight (exporterBounds.getHeight()).reduced (2)); | saveAndOpenInIDEButton.setBounds (exporterBounds.removeFromRight (exporterBounds.getHeight()).reduced (2)); | ||||
exporterBounds.removeFromRight (5); | 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); | 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)); | : bounds.getHeight()).reduced (2)); | ||||
} | } | ||||
@@ -125,18 +125,18 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
auto moduleID = project.getEnabledModules().getModuleID (rowNumber); | 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(); | auto version = project.getEnabledModules().getModuleInfo (moduleID).getVersion(); | ||||
if (version.isEmpty()) | if (version.isEmpty()) | ||||
version = "?"; | 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"), | 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; | String pathText; | ||||
@@ -155,7 +155,7 @@ public: | |||||
pathText = paths.joinIntoString (", "); | 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 | void listBoxItemDoubleClicked (int row, const MouseEvent&) override | ||||
@@ -218,7 +218,7 @@ private: | |||||
{ | { | ||||
auto buttonBounds = bounds.removeFromBottom (buttonHeight); | 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); | auto requiredWidth = (numButtons * buttonWidth) + ((numButtons - 1) * buttonSpacing); | ||||
buttonBounds.reduce ((buttonBounds.getWidth() - requiredWidth) / 2, 0); | buttonBounds.reduce ((buttonBounds.getWidth() - requiredWidth) / 2, 0); | ||||
@@ -47,7 +47,7 @@ public: | |||||
const std::vector<Asset> assets; | const std::vector<Asset> assets; | ||||
private: | private: | ||||
VersionInfo() = default; | |||||
VersionInfo() = delete; | |||||
static std::unique_ptr<VersionInfo> fetch (const String&); | static std::unique_ptr<VersionInfo> fetch (const String&); | ||||
}; | }; |
@@ -71,7 +71,7 @@ private: | |||||
Colour (0xffffffff).overlaidWith (colour)); | Colour (0xffffffff).overlaidWith (colour)); | ||||
g.setColour (Colours::white.overlaidWith (colour).contrasting()); | 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), | g.drawFittedText (colour.toDisplayString (true), getLocalBounds().reduced (2, 1), | ||||
Justification::centred, 1); | Justification::centred, 1); | ||||
} | } | ||||
@@ -80,7 +80,7 @@ void JucerTreeViewBase::refreshSubItems() | |||||
Font JucerTreeViewBase::getFont() const | 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) | void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour /*backgroundColour*/, bool isMouseOver) | ||||
@@ -214,7 +214,7 @@ public: | |||||
auto bounds = getLocalBounds().toFloat(); | auto bounds = getLocalBounds().toFloat(); | ||||
auto iconBounds = bounds.removeFromLeft ((float) iconWidth).reduced (7, 5); | 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.paintIcon (g, iconBounds); | ||||
item.paintContent (g, bounds.toNearestInt()); | item.paintContent (g, bounds.toNearestInt()); | ||||
@@ -206,7 +206,7 @@ void ProjucerLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, b | |||||
{ | { | ||||
bounds.removeFromLeft (5); | 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.setFont (fontSize); | ||||
g.setColour (isPropertyComponentChild ? findColour (widgetTextColourId) | g.setColour (isPropertyComponentChild ? findColour (widgetTextColourId) | ||||
@@ -475,7 +475,7 @@ Path ProjucerLookAndFeel::getArrowPath (Rectangle<float> arrowZone, const int di | |||||
if (filled) | if (filled) | ||||
path.closeSubPath(); | path.closeSubPath(); | ||||
path.applyTransform (AffineTransform::rotation (direction * MathConstants<float>::halfPi, | |||||
path.applyTransform (AffineTransform::rotation ((float) direction * MathConstants<float>::halfPi, | |||||
arrowZone.getCentreX(), arrowZone.getCentreY())); | arrowZone.getCentreX(), arrowZone.getCentreY())); | ||||
return path; | return path; | ||||
@@ -319,7 +319,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest | |||||
{ | { | ||||
for (int i = 0; i < numSamples; ++i) | 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; | intData += srcBytesPerSample; | ||||
} | } | ||||
} | } | ||||
@@ -330,7 +330,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest | |||||
for (int i = numSamples; --i >= 0;) | for (int i = numSamples; --i >= 0;) | ||||
{ | { | ||||
intData -= srcBytesPerSample; | 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) | 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; | intData += srcBytesPerSample; | ||||
} | } | ||||
} | } | ||||
@@ -355,7 +355,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest | |||||
for (int i = numSamples; --i >= 0;) | for (int i = numSamples; --i >= 0;) | ||||
{ | { | ||||
intData -= srcBytesPerSample; | intData -= srcBytesPerSample; | ||||
dest[i] = scale * (int) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData)); | |||||
dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast<const uint32*> (intData)); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -528,8 +528,8 @@ public: | |||||
if (v < mn) mn = v; | 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 */ | /** Scans a block of data, returning the lowest and highest levels as floats */ | ||||
@@ -491,7 +491,7 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note) | |||||
{ | { | ||||
if (legacyMode.isEnabled) | if (legacyMode.isEnabled) | ||||
{ | { | ||||
note.totalPitchbendInSemitones = note.pitchbend.asSignedFloat() * legacyMode.pitchbendRange; | |||||
note.totalPitchbendInSemitones = note.pitchbend.asSignedFloat() * (float) legacyMode.pitchbendRange; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -516,11 +516,11 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note) | |||||
auto notePitchbendInSemitones = 0.0f; | auto notePitchbendInSemitones = 0.0f; | ||||
if (zone.isUsingChannelAsMemberChannel (note.midiChannel)) | 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] | auto masterPitchbendInSemitones = pitchbendDimension.lastValueReceivedOnChannel[zone.getMasterChannel() - 1] | ||||
.asSignedFloat() | .asSignedFloat() | ||||
* zone.masterPitchbendRange; | |||||
* (float) zone.masterPitchbendRange; | |||||
note.totalPitchbendInSemitones = notePitchbendInSemitones + masterPitchbendInSemitones; | note.totalPitchbendInSemitones = notePitchbendInSemitones + masterPitchbendInSemitones; | ||||
} | } | ||||
@@ -345,7 +345,7 @@ namespace | |||||
const auto& e = synth.events; | const auto& e = synth.events; | ||||
expectWithinAbsoluteError (float (e.blocks.size()), | expectWithinAbsoluteError (float (e.blocks.size()), | ||||
std::ceil (float (blockSize) / subblockSize), | |||||
std::ceil ((float) blockSize / (float) subblockSize), | |||||
1.0f); | 1.0f); | ||||
expect (e.messages.size() == blockSize); | expect (e.messages.size() == blockSize); | ||||
expect (std::is_sorted (e.blocks.begin(), e.blocks.end())); | expect (std::is_sorted (e.blocks.begin(), e.blocks.end())); | ||||
@@ -167,7 +167,7 @@ private: | |||||
(int) input.size(), (int) input.size()); | (int) input.size(), (int) input.size()); | ||||
std::vector<float> secondGaussian (doubleLengthOutput.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()); | FloatVectorOperations::add (expectedDoubleLengthOutput.data(), secondGaussian.data(), (int) expectedDoubleLengthOutput.size()); | ||||
expectAllElementsWithin (doubleLengthOutput, expectedDoubleLengthOutput, 0.02f); | expectAllElementsWithin (doubleLengthOutput, expectedDoubleLengthOutput, 0.02f); | ||||
@@ -54,7 +54,8 @@ private: | |||||
static forcedinline float valueAtOffset (const float* const inputs, const float offset, int indexBuffer) noexcept | 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; | float result = 0.0f; | ||||
auto samplePosition = indexBuffer; | auto samplePosition = indexBuffer; | ||||
@@ -69,14 +70,15 @@ private: | |||||
if (i == -numCrossings || (sincPosition >= 0 && lastSincPosition < 0)) | if (i == -numCrossings || (sincPosition >= 0 && lastSincPosition < 0)) | ||||
{ | { | ||||
auto indexFloat = (sincPosition >= 0.f ? sincPosition : -sincPosition) * 100.0f; | 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); | sign = (sincPosition < 0 ? -1 : 1); | ||||
} | } | ||||
if (sincPosition == 0.0f) | if (sincPosition == 0.0f) | ||||
result += inputs[samplePosition]; | result += inputs[samplePosition]; | ||||
else if (sincPosition < numCrossings && sincPosition > -numCrossings) | |||||
else if (sincPosition < floatCrossings && sincPosition > -floatCrossings) | |||||
result += inputs[samplePosition] * windowedSinc (firstFrac, index); | result += inputs[samplePosition] * windowedSinc (firstFrac, index); | ||||
if (++samplePosition == numCrossings * 2) | if (++samplePosition == numCrossings * 2) | ||||
@@ -369,7 +369,7 @@ private: | |||||
template <typename T = SmoothingType> | template <typename T = SmoothingType> | ||||
MultiplicativeVoid<T> setStepSize() | 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); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -1968,8 +1968,8 @@ private: | |||||
{ | { | ||||
const uint8 n0 = si.allocation[i][0]; | const uint8 n0 = si.allocation[i][0]; | ||||
const uint8 n1 = si.allocation[i][1]; | 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) | for (i = jsbound; i < 32; ++i) | ||||
@@ -1979,8 +1979,8 @@ private: | |||||
if (n > 0) | if (n > 0) | ||||
{ | { | ||||
const uint32 w = ((uint32) -(1 << n) + getBitsUint16 (n + 1) + 1); | 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 | else | ||||
fraction[0][i] = fraction[1][i] = 0; | fraction[0][i] = fraction[1][i] = 0; | ||||
@@ -1994,7 +1994,7 @@ private: | |||||
const uint8 j = si.scaleFactor[i][0]; | const uint8 j = si.scaleFactor[i][0]; | ||||
if (n > 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 | else | ||||
fraction[0][i] = 0; | fraction[0][i] = 0; | ||||
} | } | ||||
@@ -3113,7 +3113,7 @@ private: | |||||
const int bytesPerFrame = stream.frame.frameSize + 4; | const int bytesPerFrame = stream.frame.frameSize + 4; | ||||
if (bytesPerFrame == 417 || bytesPerFrame == 418) | 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 | else | ||||
numFrames = (streamSize - streamStartPos) / bytesPerFrame; | numFrames = (streamSize - streamStartPos) / bytesPerFrame; | ||||
} | } | ||||
@@ -135,7 +135,7 @@ public: | |||||
lengthInSamples = (uint32) ov_pcm_total (&ovFile, -1); | lengthInSamples = (uint32) ov_pcm_total (&ovFile, -1); | ||||
numChannels = (unsigned int) info->channels; | numChannels = (unsigned int) info->channels; | ||||
bitsPerSample = 16; | bitsPerSample = 16; | ||||
sampleRate = info->rate; | |||||
sampleRate = (double) info->rate; | |||||
reservoir.setSize ((int) numChannels, (int) jmin (lengthInSamples, (int64) 4096)); | reservoir.setSize ((int) numChannels, (int) jmin (lengthInSamples, (int64) 4096)); | ||||
} | } | ||||
@@ -276,7 +276,7 @@ public: | |||||
vorbis_info_init (&vi); | vorbis_info_init (&vi); | ||||
if (vorbis_encode_init_vbr (&vi, (int) numChans, (int) rate, | 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); | 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))) | 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(); | auto qualities = getQualityOptions(); | ||||
int bestIndex = 0; | int bestIndex = 0; | ||||
@@ -1474,7 +1474,7 @@ private: | |||||
output->writeShort ((short) numChannels); | output->writeShort ((short) numChannels); | ||||
output->writeInt ((int) sampleRate); | 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) bytesPerFrame); // nBlockAlign | ||||
output->writeShort ((short) bitsPerSample); // wBitsPerSample | output->writeShort ((short) bitsPerSample); // wBitsPerSample | ||||
@@ -235,8 +235,8 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile, int64 numSamples | |||||
{ | { | ||||
auto intRange = Range<int>::findMinAndMax (intBuffer[i], numToDo); | 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); | results[i] = isFirstBlock ? r : results[i].getUnionWith (r); | ||||
@@ -1262,10 +1262,10 @@ private: | |||||
auto transformScale = std::sqrt (std::abs (editor->getTransform().getDeterminant())); | 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 width = (double) (rectToCheck->right - rectToCheck->left); | ||||
auto height = (double) (rectToCheck->bottom - rectToCheck->top); | auto height = (double) (rectToCheck->bottom - rectToCheck->top); | ||||
@@ -1381,10 +1381,10 @@ private: | |||||
if (approximatelyEqual (desktopScale, 1.0f)) | if (approximatelyEqual (desktopScale, 1.0f)) | ||||
return pluginRect; | 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) | static ViewRect convertFromHostBounds (ViewRect hostRect) | ||||
@@ -1394,10 +1394,10 @@ private: | |||||
if (approximatelyEqual (desktopScale, 1.0f)) | if (approximatelyEqual (desktopScale, 1.0f)) | ||||
return hostRect; | 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) }; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -1359,13 +1359,13 @@ struct VST3PluginWindow : public AudioProcessorEditor, | |||||
if (wasResized && view->canResize() == kResultTrue) | 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); | 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); | setSize (w, h); | ||||
@@ -1459,10 +1459,10 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
static void resizeWithRect (Component& comp, const ViewRect& rect, float scaleFactor) | 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() | void attachPluginWindow() | ||||
@@ -1545,7 +1545,7 @@ StringArray AudioProcessorParameter::getAllValueStrings() const | |||||
auto maxIndex = getNumSteps() - 1; | auto maxIndex = getNumSteps() - 1; | ||||
for (int i = 0; i < getNumSteps(); ++i) | for (int i = 0; i < getNumSteps(); ++i) | ||||
valueStrings.add (getText ((float) i / maxIndex, 1024)); | |||||
valueStrings.add (getText ((float) i / (float) maxIndex, 1024)); | |||||
} | } | ||||
return valueStrings; | return valueStrings; | ||||
@@ -284,7 +284,7 @@ private: | |||||
{ | { | ||||
// The parameter is producing some unexpected text, so we'll do | // The parameter is producing some unexpected text, so we'll do | ||||
// some linear interpolation. | // some linear interpolation. | ||||
index = roundToInt (getParameter().getValue() * (parameterValues.size() - 1)); | |||||
index = roundToInt (getParameter().getValue() * (float) (parameterValues.size() - 1)); | |||||
} | } | ||||
box.setSelectedItemIndex (index); | box.setSelectedItemIndex (index); | ||||
@@ -77,7 +77,7 @@ String PluginDirectoryScanner::getNextPluginFileThatWillBeScanned() const | |||||
void PluginDirectoryScanner::updateProgress() | 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, | bool PluginDirectoryScanner::scanNextFile (bool dontRescanIfAlreadyInList, | ||||
@@ -88,7 +88,7 @@ public: | |||||
g.setColour (isBlacklisted ? Colours::red | g.setColour (isBlacklisted ? Colours::red | ||||
: columnId == nameCol ? defaultTextColour | : columnId == nameCol ? defaultTextColour | ||||
: defaultTextColour.interpolatedWith (Colours::transparentBlack, 0.3f)); | : 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); | g.drawFittedText (text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f); | ||||
} | } | ||||
} | } | ||||
@@ -33,7 +33,7 @@ AudioParameterChoice::AudioParameterChoice (const String& idToUse, const String& | |||||
: RangedAudioParameter (idToUse, nameToUse, labelToUse), choices (c), | : RangedAudioParameter (idToUse, nameToUse, labelToUse), choices (c), | ||||
range ([this] | 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, end, v * end); }, | ||||
[] (float, float end, float v) { return jlimit (0.0f, 1.0f, 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)); } }; | [] (float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } }; | ||||
@@ -44,7 +44,7 @@ AudioParameterFloat::AudioParameterFloat (const String& idToUse, const String& n | |||||
if (range.interval != 0.0f) | 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; | return 0; | ||||
auto v = std::abs (roundToInt (range.interval * pow (10, numDecimalPlaces))); | auto v = std::abs (roundToInt (range.interval * pow (10, numDecimalPlaces))); | ||||
@@ -109,12 +109,12 @@ public: | |||||
bool enabled = deviceManager.isMidiInputDeviceEnabled (item.identifier); | bool enabled = deviceManager.isMidiInputDeviceEnabled (item.identifier); | ||||
auto x = getTickX(); | 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); | 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.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); | g.drawText (item.name, x + 5, 0, width - x - 5, height, Justification::centredLeft, true); | ||||
} | } | ||||
@@ -145,7 +145,7 @@ public: | |||||
if (items.isEmpty()) | if (items.isEmpty()) | ||||
{ | { | ||||
g.setColour (Colours::grey); | g.setColour (Colours::grey); | ||||
g.setFont (0.5f * getRowHeight()); | |||||
g.setFont (0.5f * (float) getRowHeight()); | |||||
g.drawText (noItemsMessage, | g.drawText (noItemsMessage, | ||||
0, 0, getWidth(), getHeight() / 2, | 0, 0, getWidth(), getHeight() / 2, | ||||
Justification::centred, true); | Justification::centred, true); | ||||
@@ -800,12 +800,12 @@ public: | |||||
} | } | ||||
auto x = getTickX(); | 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); | 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.setColour (findColour (ListBox::textColourId, true).withMultipliedAlpha (enabled ? 1.0f : 0.6f)); | ||||
g.drawText (item, x + 5, 0, width - x - 5, height, Justification::centredLeft, true); | g.drawText (item, x + 5, 0, width - x - 5, height, Justification::centredLeft, true); | ||||
} | } | ||||
@@ -836,7 +836,7 @@ public: | |||||
if (items.isEmpty()) | if (items.isEmpty()) | ||||
{ | { | ||||
g.setColour (Colours::grey); | g.setColour (Colours::grey); | ||||
g.setFont (0.5f * getRowHeight()); | |||||
g.setFont (0.5f * (float) getRowHeight()); | |||||
g.drawText (noItemsMessage, | g.drawText (noItemsMessage, | ||||
0, 0, getWidth(), getHeight() / 2, | 0, 0, getWidth(), getHeight() / 2, | ||||
Justification::centred, true); | Justification::centred, true); | ||||
@@ -753,7 +753,7 @@ int AudioThumbnail::getNumChannels() const noexcept | |||||
double AudioThumbnail::getTotalLength() 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 | bool AudioThumbnail::isFullyLoaded() const noexcept | ||||
@@ -763,7 +763,7 @@ bool AudioThumbnail::isFullyLoaded() const noexcept | |||||
double AudioThumbnail::getProportionComplete() 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 | int64 AudioThumbnail::getNumSamplesFinished() const noexcept | ||||
@@ -779,7 +779,7 @@ float AudioThumbnail::getApproximatePeak() const | |||||
for (auto* c : channels) | for (auto* c : channels) | ||||
peak = jmax (peak, c->getPeak()); | 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, | void AudioThumbnail::getApproximateMinMax (double startTime, double endTime, int channelIndex, | ||||
@@ -178,7 +178,7 @@ void AudioVisualiserComponent::paint (Graphics& g) | |||||
g.fillAll (backgroundColour); | g.fillAll (backgroundColour); | ||||
auto r = getLocalBounds().toFloat(); | auto r = getLocalBounds().toFloat(); | ||||
auto channelHeight = r.getHeight() / channels.size(); | |||||
auto channelHeight = r.getHeight() / (float) channels.size(); | |||||
g.setColour (waveformColour); | g.setColour (waveformColour); | ||||
@@ -220,7 +220,7 @@ Range<float> MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, float ta | |||||
auto octave = midiNoteNumber / 12; | auto octave = midiNoteNumber / 12; | ||||
auto note = 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; | auto width = MidiMessage::isMidiNoteBlack (note) ? blackNoteWidthRatio * targetKeyWidth : targetKeyWidth; | ||||
return { start, start + width }; | return { start, start + width }; | ||||
@@ -248,8 +248,8 @@ Rectangle<float> MidiKeyboardComponent::getRectangleForKey (int note) const | |||||
switch (orientation) | switch (orientation) | ||||
{ | { | ||||
case horizontalKeyboard: return { x, 0, w, blackNoteLength }; | 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; | default: jassertfalse; break; | ||||
} | } | ||||
} | } | ||||
@@ -259,7 +259,7 @@ Rectangle<float> MidiKeyboardComponent::getRectangleForKey (int note) const | |||||
{ | { | ||||
case horizontalKeyboard: return { x, 0, w, (float) getHeight() }; | case horizontalKeyboard: return { x, 0, w, (float) getHeight() }; | ||||
case verticalKeyboardFacingLeft: return { 0, x, (float) getWidth(), w }; | 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; | default: jassertfalse; break; | ||||
} | } | ||||
} | } | ||||
@@ -295,9 +295,9 @@ int MidiKeyboardComponent::xyToNote (Point<float> pos, float& mousePositionVeloc | |||||
p = { p.y, p.x }; | p = { p.y, p.x }; | ||||
if (orientation == verticalKeyboardFacingLeft) | if (orientation == verticalKeyboardFacingLeft) | ||||
p = { p.x, getWidth() - p.y }; | |||||
p = { p.x, (float) getWidth() - p.y }; | |||||
else | else | ||||
p = { getHeight() - p.x, p.y }; | |||||
p = { (float) getHeight() - p.x, p.y }; | |||||
} | } | ||||
return remappedXYToNote (p + Point<float> (xOffset, 0), mousePositionVelocity); | return remappedXYToNote (p + Point<float> (xOffset, 0), mousePositionVelocity); | ||||
@@ -382,8 +382,8 @@ void MidiKeyboardComponent::paint (Graphics& g) | |||||
if (orientation == verticalKeyboardFacingLeft) | 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) | else if (orientation == verticalKeyboardFacingRight) | ||||
x2 = 5.0f; | x2 = 5.0f; | ||||
@@ -400,7 +400,7 @@ void MidiKeyboardComponent::paint (Graphics& g) | |||||
switch (orientation) | switch (orientation) | ||||
{ | { | ||||
case horizontalKeyboard: g.fillRect (0.0f, 0.0f, x, 5.0f); break; | 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; | case verticalKeyboardFacingRight: g.fillRect (0.0f, 0.0f, 5.0f, x); break; | ||||
default: break; | default: break; | ||||
} | } | ||||
@@ -412,9 +412,9 @@ void MidiKeyboardComponent::paint (Graphics& g) | |||||
switch (orientation) | 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 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; | default: break; | ||||
} | } | ||||
} | } | ||||
@@ -561,7 +561,7 @@ void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h, | |||||
g.setColour (findColour (upDownButtonArrowColourId) | g.setColour (findColour (upDownButtonArrowColourId) | ||||
.withAlpha (buttonDown ? 1.0f : (mouseOver ? 0.6f : 0.4f))); | .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 | void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept | ||||
@@ -578,7 +578,7 @@ void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept | |||||
float MidiKeyboardComponent::getBlackNoteLength() const noexcept | float MidiKeyboardComponent::getBlackNoteLength() const noexcept | ||||
{ | { | ||||
auto whiteNoteLength = orientation == horizontalKeyboard ? getHeight() : getWidth(); | auto whiteNoteLength = orientation == horizontalKeyboard ? getHeight() : getWidth(); | ||||
return whiteNoteLength * blackNoteLengthRatio; | |||||
return (float) whiteNoteLength * blackNoteLengthRatio; | |||||
} | } | ||||
void MidiKeyboardComponent::setBlackNoteWidthProportion (float ratio) noexcept | void MidiKeyboardComponent::setBlackNoteWidthProportion (float ratio) noexcept | ||||
@@ -608,7 +608,7 @@ void MidiKeyboardComponent::resized() | |||||
{ | { | ||||
auto kx1 = getKeyPos (rangeStart).getStart(); | auto kx1 = getKeyPos (rangeStart).getStart(); | ||||
if (kx2 - kx1 <= w) | |||||
if (kx2 - kx1 <= (float) w) | |||||
{ | { | ||||
firstKey = (float) rangeStart; | firstKey = (float) rangeStart; | ||||
sendChangeMessage(); | sendChangeMessage(); | ||||
@@ -645,7 +645,7 @@ void MidiKeyboardComponent::resized() | |||||
float mousePositionVelocity; | float mousePositionVelocity; | ||||
auto spaceAvailable = w; | 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) | if (lastStartKey >= 0 && ((int) firstKey) > lastStartKey) | ||||
{ | { | ||||
@@ -660,7 +660,7 @@ void MidiKeyboardComponent::resized() | |||||
firstKey = (float) rangeStart; | firstKey = (float) rangeStart; | ||||
} | } | ||||
scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > w); | |||||
scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > (float) w); | |||||
repaint(); | repaint(); | ||||
} | } | ||||
} | } | ||||
@@ -79,8 +79,8 @@ struct IntegerWithBitSize | |||||
: (uint32) (value >> (numBits - 8))); | : (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 | static IntegerWithBitSize fromUnipolarFloat (float value) noexcept | ||||
{ | { | ||||
@@ -167,9 +167,9 @@ struct ConnectedDeviceGroup : private AsyncUpdater, | |||||
TouchSurface::Touch touch; | TouchSurface::Touch touch; | ||||
touch.index = (int) touchIndex.get(); | 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.xVelocity = velocity.vx.toBipolarFloat(); | ||||
touch.yVelocity = velocity.vy.toBipolarFloat(); | touch.yVelocity = velocity.vy.toBipolarFloat(); | ||||
touch.zVelocity = velocity.vz.toBipolarFloat(); | touch.zVelocity = velocity.vz.toBipolarFloat(); | ||||
@@ -350,10 +350,10 @@ struct Detector : public ReferenceCountedObject, | |||||
{ | { | ||||
TouchSurface::Touch scaledEvent (touchEvent); | 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); | surface->broadcastTouchChange (scaledEvent); | ||||
} | } | ||||
@@ -27,14 +27,14 @@ DrumPadGridProgram::DrumPadGridProgram (Block& b) : Program (b) {} | |||||
int DrumPadGridProgram::getPadIndex (float posX, float posY) const | 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 uint32 offset = block.getDataByte (visiblePads_byte) ? numColumns1_byte : numColumns0_byte; | ||||
const int numColumns = block.getDataByte (offset + numColumns0_byte); | const int numColumns = block.getDataByte (offset + numColumns0_byte); | ||||
const int numRows = block.getDataByte (offset + numRows0_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) | 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; | Block::ProgramEventMessage e; | ||||
e.values[0] = 0x20000000 | 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)); | + jlimit (0, 255, roundToInt (z * 255.0f)); | ||||
e.values[1] = (int32) colour.getARGB(); | e.values[1] = (int32) colour.getARGB(); | ||||
@@ -159,10 +159,10 @@ float DirectoryIterator::getEstimatedProgress() const | |||||
if (totalNumFiles <= 0) | if (totalNumFiles <= 0) | ||||
return 0.0f; | return 0.0f; | ||||
auto detailedIndex = (subIterator != nullptr) ? index + subIterator->getEstimatedProgress() | |||||
auto detailedIndex = (subIterator != nullptr) ? (float) index + subIterator->getEstimatedProgress() | |||||
: (float) index; | : (float) index; | ||||
return jlimit (0.0f, 1.0f, detailedIndex / totalNumFiles); | |||||
return jlimit (0.0f, 1.0f, detailedIndex / (float) totalNumFiles); | |||||
} | } | ||||
} // namespace juce | } // namespace juce |
@@ -485,7 +485,7 @@ String File::descriptionOfSizeInBytes (const int64 bytes) | |||||
else if (bytes < 1024 * 1024 * 1024) { suffix = " MB"; divisor = 1024.0 * 1024.0; } | else if (bytes < 1024 * 1024 * 1024) { suffix = " MB"; divisor = 1024.0 * 1024.0; } | ||||
else { suffix = " GB"; divisor = 1024.0 * 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; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -594,7 +594,7 @@ struct JavascriptEngine::RootObject : public DynamicObject | |||||
{ | { | ||||
DivideOp (const CodeLocation& l, ExpPtr& a, ExpPtr& b) noexcept : BinaryOperator (l, a, b, TokenTypes::divide) {} | 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 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 | struct ModuloOp : public BinaryOperator | ||||
@@ -105,7 +105,7 @@ bool Random::nextBool() noexcept | |||||
float Random::nextFloat() 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); | / (static_cast<float> (std::numeric_limits<uint32>::max()) + 1.0f); | ||||
return result == 1.0f ? 1.0f - std::numeric_limits<float>::epsilon() : result; | return result == 1.0f ? 1.0f - std::numeric_limits<float>::epsilon() : result; | ||||
} | } | ||||
@@ -209,7 +209,7 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept | |||||
double Time::getMillisecondCounterHiRes() noexcept | double Time::getMillisecondCounterHiRes() noexcept | ||||
{ | { | ||||
return getHighResolutionTicks() * 0.001; | |||||
return (double) getHighResolutionTicks() * 0.001; | |||||
} | } | ||||
bool Time::setSystemTimeToThisTime() const | bool Time::setSystemTimeToThisTime() const | ||||
@@ -124,7 +124,7 @@ PerformanceCounter::Statistics PerformanceCounter::getStatisticsAndReset() | |||||
stats.clear(); | stats.clear(); | ||||
if (s.numRuns > 0) | if (s.numRuns > 0) | ||||
s.averageSeconds = s.totalSeconds / s.numRuns; | |||||
s.averageSeconds = s.totalSeconds / (float) s.numRuns; | |||||
return s; | return s; | ||||
} | } | ||||
@@ -28,8 +28,8 @@ RelativeTime::RelativeTime (const RelativeTime& other) noexcept : numSeconds ( | |||||
RelativeTime::~RelativeTime() noexcept {} | 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::seconds (double s) noexcept { return RelativeTime (s); } | ||||
RelativeTime RelativeTime::minutes (double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); } | RelativeTime RelativeTime::minutes (double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); } | ||||
RelativeTime RelativeTime::hours (double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); } | RelativeTime RelativeTime::hours (double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); } | ||||
@@ -277,7 +277,7 @@ void Time::waitForMillisecondCounter (uint32 targetTime) noexcept | |||||
//============================================================================== | //============================================================================== | ||||
double Time::highResolutionTicksToSeconds (const int64 ticks) noexcept | double Time::highResolutionTicksToSeconds (const int64 ticks) noexcept | ||||
{ | { | ||||
return ticks / (double) getHighResolutionTicksPerSecond(); | |||||
return (double) ticks / (double) getHighResolutionTicksPerSecond(); | |||||
} | } | ||||
int64 Time::secondsToHighResolutionTicks (const double seconds) noexcept | int64 Time::secondsToHighResolutionTicks (const double seconds) noexcept | ||||
@@ -45,7 +45,7 @@ typename FIR::Coefficients<FloatType>::Ptr | |||||
for (size_t i = 0; i <= order; ++i) | for (size_t i = 0; i <= order; ++i) | ||||
{ | { | ||||
if (i == order * 0.5) | |||||
if (i == order / 2) | |||||
{ | { | ||||
c[i] = static_cast<FloatType> (normalisedFrequency * 2); | c[i] = static_cast<FloatType> (normalisedFrequency * 2); | ||||
} | } | ||||
@@ -113,8 +113,8 @@ typename FIR::Coefficients<FloatType>::Ptr | |||||
} | } | ||||
else | 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) | c[i] = static_cast<FloatType> (std::sin (2 * indice * normalisedFrequency) | ||||
/ indice * std::pow (std::sin (indice2) / indice2, spline)); | / indice * std::pow (std::sin (indice2) / indice2, spline)); | ||||
} | } | ||||
@@ -160,12 +160,12 @@ typename FIR::Coefficients<FloatType>::Ptr | |||||
auto factors = ws / MathConstants<double>::pi; | auto factors = ws / MathConstants<double>::pi; | ||||
for (size_t i = 0; i <= M; ++i) | 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); | q (0, 0) = factorp + stopBandWeight * (1.0 - factors); | ||||
for (size_t i = 1; i <= 2 * M; ++i) | 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 Q1 = Matrix<double>::toeplitz (q, M + 1); | ||||
auto Q2 = Matrix<double>::hankel (q, M + 1, 0); | auto Q2 = Matrix<double>::hankel (q, M + 1, 0); | ||||
@@ -198,12 +198,12 @@ typename FIR::Coefficients<FloatType>::Ptr | |||||
auto factors = ws / MathConstants<double>::pi; | auto factors = ws / MathConstants<double>::pi; | ||||
for (size_t i = 0; i < M; ++i) | 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) | 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); | auto Q1p = Matrix<double>::toeplitz (qp, M); | ||||
@@ -113,7 +113,7 @@ struct FFTFallback : public FFT::Instance | |||||
{ | { | ||||
configInverse->perform (input, output); | configInverse->perform (input, output); | ||||
const float scaleFactor = 1.0f / size; | |||||
const float scaleFactor = 1.0f / (float) size; | |||||
for (int i = 0; i < size; ++i) | for (int i = 0; i < size; ++i) | ||||
output[i] *= scaleFactor; | output[i] *= scaleFactor; | ||||
@@ -136,10 +136,11 @@ void WindowingFunction<FloatType>::fillWindowingTables (FloatType* samples, size | |||||
case kaiser: | case kaiser: | ||||
{ | { | ||||
const double factor = 1.0 / SpecialFunctions::besselI0 (beta); | const double factor = 1.0 / SpecialFunctions::besselI0 (beta); | ||||
const auto doubleSize = (double) size; | |||||
for (size_t i = 0; i < size; ++i) | 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); | * factor); | ||||
} | } | ||||
break; | break; | ||||
@@ -122,7 +122,7 @@ public: | |||||
*/ | */ | ||||
FloatType get (FloatType index) const noexcept | FloatType get (FloatType index) const noexcept | ||||
{ | { | ||||
if (index >= getNumPoints()) | |||||
if (index >= (FloatType) getNumPoints()) | |||||
index = static_cast<FloatType> (getGuardIndex()); | index = static_cast<FloatType> (getGuardIndex()); | ||||
else if (index < 0) | else if (index < 0) | ||||
index = {}; | index = {}; | ||||
@@ -563,8 +563,8 @@ Oversampling<SampleType>::Oversampling (size_t newNumChannels, size_t newFactor, | |||||
auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f); | auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f); | ||||
addOversamplingStage (FilterType::filterHalfBandPolyphaseIIR, | 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) | 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); | auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f); | ||||
addOversamplingStage (FilterType::filterHalfBandFIREquiripple, | addOversamplingStage (FilterType::filterHalfBandFIREquiripple, | ||||
twUp, gaindBStartUp + gaindBFactorUp * n, | |||||
twDown, gaindBStartDown + gaindBFactorDown * n); | |||||
twUp, gaindBStartUp + gaindBFactorUp * (float) n, | |||||
twDown, gaindBStartDown + gaindBFactorDown * (float) n); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -46,11 +46,11 @@ namespace ColourHelpers | |||||
if (hi > 0) | 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; | if (r == hi) hue = blue - green; | ||||
else if (g == hi) hue = 2.0f + red - blue; | else if (g == hi) hue = 2.0f + red - blue; | ||||
@@ -79,12 +79,12 @@ namespace ColourHelpers | |||||
if (hi > 0) | if (hi > 0) | ||||
{ | { | ||||
lightness = ((hi + lo) / 2.0f) / 255.0f; | |||||
lightness = ((float) (hi + lo) / 2.0f) / 255.0f; | |||||
if (lightness > 0.0f) | if (lightness > 0.0f) | ||||
hue = getHue (col); | 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) | if (hi > 0) | ||||
{ | { | ||||
saturation = (hi - lo) / (float) hi; | |||||
saturation = (float) (hi - lo) / (float) hi; | |||||
if (saturation > 0.0f) | if (saturation > 0.0f) | ||||
hue = getHue (col); | hue = getHue (col); | ||||
brightness = hi / 255.0f; | |||||
brightness = (float) hi / 255.0f; | |||||
} | } | ||||
} | } | ||||