diff --git a/examples/Audio/MidiDemo.h b/examples/Audio/MidiDemo.h index 96f6b7ffaa..6b6e33f2c4 100644 --- a/examples/Audio/MidiDemo.h +++ b/examples/Audio/MidiDemo.h @@ -285,7 +285,7 @@ private: } //============================================================================== - void paintListBoxItem (int rowNumber, Graphics &g, + void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected) override { auto textColour = getLookAndFeel().findColour (ListBox::textColourId); @@ -356,7 +356,7 @@ private: }; //============================================================================== - void handleIncomingMidiMessage (MidiInput* /*source*/, const MidiMessage &message) override + void handleIncomingMidiMessage (MidiInput* /*source*/, const MidiMessage& message) override { // This is called on the MIDI thread diff --git a/examples/Plugins/SamplerPluginDemo.h b/examples/Plugins/SamplerPluginDemo.h index 9b21b278bb..06c37973b3 100644 --- a/examples/Plugins/SamplerPluginDemo.h +++ b/examples/Plugins/SamplerPluginDemo.h @@ -694,7 +694,7 @@ public: } private: - void valueTreePropertyChanged (ValueTree &, const Identifier &property) override + void valueTreePropertyChanged (ValueTree&, const Identifier& property) override { if (property == IDs::totalRange) { @@ -854,7 +854,7 @@ public: } private: - void valueTreePropertyChanged (ValueTree&, const Identifier &property) override + void valueTreePropertyChanged (ValueTree&, const Identifier& property) override { if (property == IDs::synthVoices) { diff --git a/examples/Utilities/PushNotificationsDemo.h b/examples/Utilities/PushNotificationsDemo.h index 5abd6a2307..20cc256946 100644 --- a/examples/Utilities/PushNotificationsDemo.h +++ b/examples/Utilities/PushNotificationsDemo.h @@ -957,7 +957,7 @@ private: setWantsKeyboardFocus (true); } - void addRowComponent (RowComponent *rc) + void addRowComponent (RowComponent* rc) { rowComponents.add (rc); addAndMakeVisible (rc); @@ -967,14 +967,14 @@ private: { auto totalRowUnits = 0; - for (auto &rc : rowComponents) + for (auto* rc : rowComponents) totalRowUnits += rc->rowUnits; auto rowHeight = getHeight() / totalRowUnits; auto bounds = getLocalBounds(); - for (auto &rc : rowComponents) + for (auto* rc : rowComponents) rc->setBounds (bounds.removeFromTop (rc->rowUnits * rowHeight)); auto* last = rowComponents[rowComponents.size() - 1]; @@ -1007,9 +1007,7 @@ private: void resized() override { auto columnWidth = getWidth(); - auto rowHeight = getHeight() / 6; - auto bounds = getLocalBounds(); getDeliveredNotificationsButton .setBounds (bounds.removeFromTop (rowHeight)); @@ -1020,7 +1018,7 @@ private: removeAllDeliveredNotifsButton .setBounds (bounds.removeFromTop (rowHeight)); - #if JUCE_IOS || JUCE_MAC + #if JUCE_IOS || JUCE_MAC getPendingNotificationsButton .setBounds (bounds.removeFromTop (rowHeight)); rowBounds = bounds.removeFromTop (rowHeight); @@ -1028,7 +1026,7 @@ private: pendingNotifIdentifier .setBounds (rowBounds); removeAllPendingNotifsButton .setBounds (bounds.removeFromTop (rowHeight)); - #endif + #endif } TextButton getDeliveredNotificationsButton { "Get Delivered Notifications" }; @@ -1046,11 +1044,11 @@ private: RemoteView() { addAndMakeVisible (getDeviceTokenButton); - #if JUCE_ANDROID + #if JUCE_ANDROID addAndMakeVisible (sendRemoteMessageButton); addAndMakeVisible (subscribeToSportsButton); addAndMakeVisible (unsubscribeFromSportsButton); - #endif + #endif } void resized() @@ -1085,10 +1083,8 @@ private: if (! showedRemoteInstructions && newCurrentTabName == "Remote") { PushNotificationsDemo::showRemoteInstructions(); - showedRemoteInstructions = true; } - } private: @@ -1097,22 +1093,19 @@ private: static void showRemoteInstructions() { - #if JUCE_IOS || JUCE_MAC + #if JUCE_IOS || JUCE_MAC NativeMessageBox::showMessageBoxAsync (AlertWindow::InfoIcon, "Remote Notifications instructions", "In order to be able to test remote notifications " "ensure that the app is signed and that you register " "the bundle ID for remote notifications in " "Apple Developer Center."); - #endif + #endif } Label headerLabel { "headerLabel", "Push Notifications Demo" }; ParamControls paramControls; - ParamsView paramsOneView; - ParamsView paramsTwoView; - ParamsView paramsThreeView; - ParamsView paramsFourView; + ParamsView paramsOneView, paramsTwoView, paramsThreeView, paramsFourView; AuxActionsView auxActionsView; TabbedComponent localNotificationsTabs { TabbedButtonBar::TabsAtTop }; RemoteView remoteView; diff --git a/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineDLL.h b/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineDLL.h index b2e7574c88..b88e71ddd3 100644 --- a/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineDLL.h +++ b/extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineDLL.h @@ -144,20 +144,20 @@ private: } #if JUCE_MAC - static bool tryFindDLLFileInAppBundle(File &outFile) + static bool tryFindDLLFileInAppBundle (File& outFile) { File currentAppFile (File::getSpecialLocation (File::currentApplicationFile)); return tryFindDLLFileInFolder (currentAppFile.getChildFile ("Contents"), outFile); } #endif - static bool tryFindDLLFileInAppFolder(File &outFile) + static bool tryFindDLLFileInAppFolder (File& outFile) { auto currentAppFile = File::getSpecialLocation (File::currentApplicationFile); return tryFindDLLFileInFolder (currentAppFile.getParentDirectory(), outFile); } - static bool tryFindDLLFileInAppConfigFolder(File &outFile) + static bool tryFindDLLFileInAppConfigFolder (File& outFile) { auto userAppDataFolder = getVersionedUserAppSupportFolder(); return tryFindDLLFileInFolder (userAppDataFolder, outFile); diff --git a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp index 8e7061ad39..cb8194e183 100644 --- a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp +++ b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp @@ -92,7 +92,7 @@ void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const RectanglefindColour (defaultIconColourId), isMouseOver); } -void JucerTreeViewBase::paintIcon (Graphics &g, Rectangle area) +void JucerTreeViewBase::paintIcon (Graphics& g, Rectangle area) { g.setColour (getContentColour (true)); getIcon().draw (g, area, isIconCrossedOut()); diff --git a/modules/juce_audio_devices/native/juce_linux_ALSA.cpp b/modules/juce_audio_devices/native/juce_linux_ALSA.cpp index 34c31651a7..3b9a11a10d 100644 --- a/modules/juce_audio_devices/native/juce_linux_ALSA.cpp +++ b/modules/juce_audio_devices/native/juce_linux_ALSA.cpp @@ -978,9 +978,8 @@ private: class ALSAAudioIODeviceType : public AudioIODeviceType { public: - ALSAAudioIODeviceType (bool onlySoundcards, const String &deviceTypeName) + ALSAAudioIODeviceType (bool onlySoundcards, const String& deviceTypeName) : AudioIODeviceType (deviceTypeName), - hasScanned (false), listOnlySoundcards (onlySoundcards) { #if ! JUCE_ALSA_LOGGING @@ -1041,7 +1040,7 @@ public: { jassert (hasScanned); // need to call scanForDevices() before doing this - if (ALSAAudioIODevice* d = dynamic_cast (device)) + if (auto* d = dynamic_cast (device)) return asInput ? inputIds.indexOf (d->inputId) : outputIds.indexOf (d->outputId); @@ -1070,9 +1069,9 @@ public: private: //============================================================================== StringArray inputNames, outputNames, inputIds, outputIds; - bool hasScanned, listOnlySoundcards; + bool hasScanned = false, listOnlySoundcards; - bool testDevice (const String &id, const String &outputName, const String &inputName) + bool testDevice (const String& id, const String& outputName, const String& inputName) { unsigned int minChansOut = 0, maxChansOut = 0; unsigned int minChansIn = 0, maxChansIn = 0; diff --git a/modules/juce_core/native/java/JuceAppActivity.java b/modules/juce_core/native/java/JuceAppActivity.java index 63ede84ffa..eb2a50a305 100644 --- a/modules/juce_core/native/java/JuceAppActivity.java +++ b/modules/juce_core/native/java/JuceAppActivity.java @@ -222,11 +222,11 @@ public class JuceAppActivity extends $$JuceAppActivityBaseClass$$ super.onResume(); resumeApp(); - // Ensure that navigation/status bar visibility is correctly restored. - for (int i = 0; i < viewHolder.getChildCount(); ++i) - { - if (viewHolder.getChildAt (i) instanceof ComponentPeerView) - ((ComponentPeerView) viewHolder.getChildAt (i)).appResumed(); + // Ensure that navigation/status bar visibility is correctly restored. + for (int i = 0; i < viewHolder.getChildCount(); ++i) + { + if (viewHolder.getChildAt (i) instanceof ComponentPeerView) + ((ComponentPeerView) viewHolder.getChildAt (i)).appResumed(); } } @@ -808,37 +808,37 @@ public class JuceAppActivity extends $$JuceAppActivityBaseClass$$ } private class TreeObserver implements ViewTreeObserver.OnGlobalLayoutListener - { - TreeObserver() - { - keyboardShown = false; - } + { + TreeObserver() + { + keyboardShown = false; + } @Override public void onGlobalLayout() { Rect r = new Rect(); - - ViewGroup parentView = (ViewGroup) getParent(); - - if (parentView == null) - return; + + ViewGroup parentView = (ViewGroup) getParent(); + + if (parentView == null) + return; parentView.getWindowVisibleDisplayFrame (r); int diff = parentView.getHeight() - (r.bottom - r.top); // Arbitrary threshold, surely keyboard would take more than 20 pix. - if (diff < 20 && keyboardShown) - { - keyboardShown = false; - handleKeyboardHidden (view.host); - } - - if (! keyboardShown && diff > 20) + if (diff < 20 && keyboardShown) + { + keyboardShown = false; + handleKeyboardHidden (view.host); + } + + if (! keyboardShown && diff > 20) keyboardShown = true; - }; - + }; + private boolean keyboardShown; }; diff --git a/modules/juce_dsp/frequency/juce_FFT.cpp b/modules/juce_dsp/frequency/juce_FFT.cpp index f734c121ca..ea17679960 100644 --- a/modules/juce_dsp/frequency/juce_FFT.cpp +++ b/modules/juce_dsp/frequency/juce_FFT.cpp @@ -166,10 +166,7 @@ struct FFTFallback : public FFT::Instance void performRealOnlyForwardTransform (Complex* scratch, float* d) const noexcept { for (int i = 0; i < size; ++i) - { - scratch[i].real (d[i]); - scratch[i].imag (0); - } + scratch[i] = { d[i], 0 }; perform (scratch, reinterpret_cast*> (d), false); } @@ -204,8 +201,8 @@ struct FFTFallback : public FFT::Instance { auto phase = i * inverseFactor; - twiddleTable[i].real ((float) std::cos (phase)); - twiddleTable[i].imag ((float) std::sin (phase)); + twiddleTable[i] = { (float) std::cos (phase), + (float) std::sin (phase) }; } } else @@ -214,16 +211,16 @@ struct FFTFallback : public FFT::Instance { auto phase = i * inverseFactor; - twiddleTable[i].real ((float) std::cos (phase)); - twiddleTable[i].imag ((float) std::sin (phase)); + twiddleTable[i] = { (float) std::cos (phase), + (float) std::sin (phase) }; } for (int i = fftSize / 4; i < fftSize / 2; ++i) { - auto index = i - fftSize / 4; + auto other = twiddleTable[i - fftSize / 4]; - twiddleTable[i].real (inverse ? -twiddleTable[index].imag() : twiddleTable[index].imag()); - twiddleTable[i].imag (inverse ? twiddleTable[index].real() : -twiddleTable[index].real()); + twiddleTable[i] = { inverse ? -other.imag() : other.imag(), + inverse ? other.real() : -other.real() }; } twiddleTable[fftSize / 2].real (-1.0f); @@ -395,17 +392,19 @@ struct FFTFallback : public FFT::Instance if (inverse) { - data[length].real (s5.real() - s4.imag()); - data[length].imag (s5.imag() + s4.real()); - data[lengthX3].real (s5.real() + s4.imag()); - data[lengthX3].imag (s5.imag() - s4.real()); + data[length] = { s5.real() - s4.imag(), + s5.imag() + s4.real() }; + + data[lengthX3] = { s5.real() + s4.imag(), + s5.imag() - s4.real() }; } else { - data[length].real (s5.real() + s4.imag()); - data[length].imag (s5.imag() - s4.real()); - data[lengthX3].real (s5.real() - s4.imag()); - data[lengthX3].imag (s5.imag() + s4.real()); + data[length] = { s5.real() + s4.imag(), + s5.imag() - s4.real() }; + + data[lengthX3] = { s5.real() - s4.imag(), + s5.imag() + s4.real() }; } ++data; @@ -438,7 +437,7 @@ struct AppleFFT : public FFT::Instance AppleFFT (int orderToUse) : order (static_cast (orderToUse)), fftSetup (vDSP_create_fftsetup (order, 2)), - forwardNormalisation (.5f), + forwardNormalisation (0.5f), inverseNormalisation (1.0f / static_cast (1 << order)) {} diff --git a/modules/juce_dsp/frequency/juce_FFT.h b/modules/juce_dsp/frequency/juce_FFT.h index 10da05144c..525e8e578f 100644 --- a/modules/juce_dsp/frequency/juce_FFT.h +++ b/modules/juce_dsp/frequency/juce_FFT.h @@ -58,7 +58,7 @@ public: /** Performs an out-of-place FFT, either forward or inverse. The arrays must contain at least getSize() elements. */ - void perform (const Complex *input, Complex * output, bool inverse) const noexcept; + void perform (const Complex* input, Complex* output, bool inverse) const noexcept; /** Performs an in-place forward transform on a block of real data. diff --git a/modules/juce_dsp/juce_dsp.h b/modules/juce_dsp/juce_dsp.h index 7cc6f406f9..5d9c027c08 100644 --- a/modules/juce_dsp/juce_dsp.h +++ b/modules/juce_dsp/juce_dsp.h @@ -198,15 +198,13 @@ namespace juce { namespace dsp { - template - using Complex = ::std::complex; + using Complex = std::complex; //============================================================================== namespace util { /** Use this function to prevent denormals on intel CPUs. - This function will work with both primitives and simple containers. */ #if JUCE_DSP_ENABLE_SNAP_TO_ZERO diff --git a/modules/juce_dsp/maths/juce_Matrix.cpp b/modules/juce_dsp/maths/juce_Matrix.cpp index 4e48013112..03b7a31ff2 100644 --- a/modules/juce_dsp/maths/juce_Matrix.cpp +++ b/modules/juce_dsp/maths/juce_Matrix.cpp @@ -120,9 +120,9 @@ Matrix Matrix::operator* (const Matrix& o size_t offsetMat = 0, offsetlhs = 0; - auto *dst = result.getRawDataPointer(); - auto *a = getRawDataPointer(); - auto *b = other.getRawDataPointer(); + auto* dst = result.getRawDataPointer(); + auto* a = getRawDataPointer(); + auto* b = other.getRawDataPointer(); for (size_t i = 0; i < n; ++i) { diff --git a/modules/juce_dsp/processors/juce_Oversampling.cpp b/modules/juce_dsp/processors/juce_Oversampling.cpp index 657da301ae..b0f3817e80 100644 --- a/modules/juce_dsp/processors/juce_Oversampling.cpp +++ b/modules/juce_dsp/processors/juce_Oversampling.cpp @@ -465,18 +465,18 @@ private: /** This function calculates the equivalent high order IIR filter of a given polyphase cascaded allpass filters structure. */ - const dsp::IIR::Coefficients getCoefficients (typename dsp::FilterDesign::IIRPolyphaseAllpassStructure &structure) const + const dsp::IIR::Coefficients getCoefficients (typename dsp::FilterDesign::IIRPolyphaseAllpassStructure& structure) const { - dsp::Polynomial numerator1 ({ static_cast (1.0) }); + dsp::Polynomial numerator1 ({ static_cast (1.0) }); dsp::Polynomial denominator1 ({ static_cast (1.0) }); - dsp::Polynomial numerator2 ({ static_cast (1.0) }); + dsp::Polynomial numerator2 ({ static_cast (1.0) }); dsp::Polynomial denominator2 ({ static_cast (1.0) }); dsp::Polynomial temp; for (auto n = 0; n < structure.directPath.size(); n++) { - auto *coeffs = structure.directPath.getReference (n).getRawCoefficients(); + auto* coeffs = structure.directPath.getReference (n).getRawCoefficients(); if (structure.directPath[n].getFilterOrder() == 1) { @@ -498,7 +498,7 @@ private: for (auto n = 0; n < structure.delayedPath.size(); n++) { - auto *coeffs = structure.delayedPath.getReference (n).getRawCoefficients(); + auto* coeffs = structure.delayedPath.getReference (n).getRawCoefficients(); if (structure.delayedPath[n].getFilterOrder() == 1) { @@ -520,7 +520,7 @@ private: dsp::Polynomial numeratorf1 = numerator1.getProductWith (denominator2); dsp::Polynomial numeratorf2 = numerator2.getProductWith (denominator1); - dsp::Polynomial numerator = numeratorf1.getSumWith (numeratorf2); + dsp::Polynomial numerator = numeratorf1.getSumWith (numeratorf2); dsp::Polynomial denominator = denominator1.getProductWith (denominator2); dsp::IIR::Coefficients coeffs; @@ -639,8 +639,7 @@ size_t Oversampling::getOversamplingFactor() noexcept template void Oversampling::initProcessing (size_t maximumNumberOfSamplesBeforeOversampling) { - jassert (engines.size() > 0); - + jassert (! engines.isEmpty()); auto currentNumSamples = maximumNumberOfSamplesBeforeOversampling; for (size_t n = 0; n < numStages; n++) @@ -650,15 +649,15 @@ void Oversampling::initProcessing (size_t maximumNumberOfSamplesBefo engine.initProcessing (currentNumSamples); currentNumSamples *= engine.getFactor(); } - isReady = true; + isReady = true; reset(); } template void Oversampling::reset() noexcept { - jassert (engines.size() > 0); + jassert (! engines.isEmpty()); if (isReady) for (auto n = 0; n < engines.size(); n++) @@ -668,7 +667,7 @@ void Oversampling::reset() noexcept template typename dsp::AudioBlock Oversampling::processSamplesUp (const dsp::AudioBlock &inputBlock) noexcept { - jassert (engines.size() > 0); + jassert (! engines.isEmpty()); if (! isReady) return dsp::AudioBlock(); @@ -688,7 +687,7 @@ typename dsp::AudioBlock Oversampling::processSamplesUp template void Oversampling::processSamplesDown (dsp::AudioBlock &outputBlock) noexcept { - jassert (engines.size() > 0); + jassert (! engines.isEmpty()); if (! isReady) return; diff --git a/modules/juce_gui_basics/native/juce_mac_Windowing.mm b/modules/juce_gui_basics/native/juce_mac_Windowing.mm index 509042ab99..b33d736eff 100644 --- a/modules/juce_gui_basics/native/juce_mac_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_mac_Windowing.mm @@ -286,7 +286,7 @@ bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& fi auto eventPos = [event locationInWindow]; auto dragRect = [view convertRect: NSMakeRect (eventPos.x - 16.0f, eventPos.y - 16.0f, 32.0f, 32.0f) fromView: nil]; - auto *dragImage = [[NSWorkspace sharedWorkspace] iconForFile: nsFilename]; + auto* dragImage = [[NSWorkspace sharedWorkspace] iconForFile: nsFilename]; [dragItem setDraggingFrame: dragRect contents: dragImage];