Browse Source

Tidied up a few minor coding style discrepencies

tags/2021-05-28
jules 7 years ago
parent
commit
d691838765
13 changed files with 82 additions and 94 deletions
  1. +2
    -2
      examples/Audio/MidiDemo.h
  2. +2
    -2
      examples/Plugins/SamplerPluginDemo.h
  3. +10
    -17
      examples/Utilities/PushNotificationsDemo.h
  4. +3
    -3
      extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineDLL.h
  5. +1
    -1
      extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp
  6. +4
    -5
      modules/juce_audio_devices/native/juce_linux_ALSA.cpp
  7. +24
    -24
      modules/juce_core/native/java/JuceAppActivity.java
  8. +19
    -20
      modules/juce_dsp/frequency/juce_FFT.cpp
  9. +1
    -1
      modules/juce_dsp/frequency/juce_FFT.h
  10. +1
    -3
      modules/juce_dsp/juce_dsp.h
  11. +3
    -3
      modules/juce_dsp/maths/juce_Matrix.cpp
  12. +11
    -12
      modules/juce_dsp/processors/juce_Oversampling.cpp
  13. +1
    -1
      modules/juce_gui_basics/native/juce_mac_Windowing.mm

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

@@ -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


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

@@ -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)
{


+ 10
- 17
examples/Utilities/PushNotificationsDemo.h View File

@@ -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;


+ 3
- 3
extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineDLL.h View File

@@ -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);


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

@@ -92,7 +92,7 @@ void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle<float
TreeViewItem::paintOpenCloseButton (g, area, getOwnerView()->findColour (defaultIconColourId), isMouseOver);
}
void JucerTreeViewBase::paintIcon (Graphics &g, Rectangle<float> area)
void JucerTreeViewBase::paintIcon (Graphics& g, Rectangle<float> area)
{
g.setColour (getContentColour (true));
getIcon().draw (g, area, isIconCrossedOut());


+ 4
- 5
modules/juce_audio_devices/native/juce_linux_ALSA.cpp View File

@@ -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<ALSAAudioIODevice*> (device))
if (auto* d = dynamic_cast<ALSAAudioIODevice*> (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;


+ 24
- 24
modules/juce_core/native/java/JuceAppActivity.java View File

@@ -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;
};


+ 19
- 20
modules/juce_dsp/frequency/juce_FFT.cpp View File

@@ -166,10 +166,7 @@ struct FFTFallback : public FFT::Instance
void performRealOnlyForwardTransform (Complex<float>* 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<Complex<float>*> (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<vDSP_Length> (orderToUse)),
fftSetup (vDSP_create_fftsetup (order, 2)),
forwardNormalisation (.5f),
forwardNormalisation (0.5f),
inverseNormalisation (1.0f / static_cast<float> (1 << order))
{}


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

@@ -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<float> *input, Complex<float> * output, bool inverse) const noexcept;
void perform (const Complex<float>* input, Complex<float>* output, bool inverse) const noexcept;
/** Performs an in-place forward transform on a block of real data.


+ 1
- 3
modules/juce_dsp/juce_dsp.h View File

@@ -198,15 +198,13 @@ namespace juce
{
namespace dsp
{
template <typename Type>
using Complex = ::std::complex<Type>;
using Complex = std::complex<Type>;
//==============================================================================
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


+ 3
- 3
modules/juce_dsp/maths/juce_Matrix.cpp View File

@@ -120,9 +120,9 @@ Matrix<ElementType> Matrix<ElementType>::operator* (const Matrix<ElementType>& 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)
{


+ 11
- 12
modules/juce_dsp/processors/juce_Oversampling.cpp View File

@@ -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<SampleType> getCoefficients (typename dsp::FilterDesign<SampleType>::IIRPolyphaseAllpassStructure &structure) const
const dsp::IIR::Coefficients<SampleType> getCoefficients (typename dsp::FilterDesign<SampleType>::IIRPolyphaseAllpassStructure& structure) const
{
dsp::Polynomial<SampleType> numerator1 ({ static_cast<SampleType> (1.0) });
dsp::Polynomial<SampleType> numerator1 ({ static_cast<SampleType> (1.0) });
dsp::Polynomial<SampleType> denominator1 ({ static_cast<SampleType> (1.0) });
dsp::Polynomial<SampleType> numerator2 ({ static_cast<SampleType> (1.0) });
dsp::Polynomial<SampleType> numerator2 ({ static_cast<SampleType> (1.0) });
dsp::Polynomial<SampleType> denominator2 ({ static_cast<SampleType> (1.0) });
dsp::Polynomial<SampleType> 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<SampleType> numeratorf1 = numerator1.getProductWith (denominator2);
dsp::Polynomial<SampleType> numeratorf2 = numerator2.getProductWith (denominator1);
dsp::Polynomial<SampleType> numerator = numeratorf1.getSumWith (numeratorf2);
dsp::Polynomial<SampleType> numerator = numeratorf1.getSumWith (numeratorf2);
dsp::Polynomial<SampleType> denominator = denominator1.getProductWith (denominator2);
dsp::IIR::Coefficients<SampleType> coeffs;
@@ -639,8 +639,7 @@ size_t Oversampling<SampleType>::getOversamplingFactor() noexcept
template <typename SampleType>
void Oversampling<SampleType>::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<SampleType>::initProcessing (size_t maximumNumberOfSamplesBefo
engine.initProcessing (currentNumSamples);
currentNumSamples *= engine.getFactor();
}
isReady = true;
isReady = true;
reset();
}
template <typename SampleType>
void Oversampling<SampleType>::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<SampleType>::reset() noexcept
template <typename SampleType>
typename dsp::AudioBlock<SampleType> Oversampling<SampleType>::processSamplesUp (const dsp::AudioBlock<SampleType> &inputBlock) noexcept
{
jassert (engines.size() > 0);
jassert (! engines.isEmpty());
if (! isReady)
return dsp::AudioBlock<SampleType>();
@@ -688,7 +687,7 @@ typename dsp::AudioBlock<SampleType> Oversampling<SampleType>::processSamplesUp
template <typename SampleType>
void Oversampling<SampleType>::processSamplesDown (dsp::AudioBlock<SampleType> &outputBlock) noexcept
{
jassert (engines.size() > 0);
jassert (! engines.isEmpty());
if (! isReady)
return;


+ 1
- 1
modules/juce_gui_basics/native/juce_mac_Windowing.mm View File

@@ -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];


Loading…
Cancel
Save