1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Normalised lambda whitespace

This commit is contained in:
ed 2020-06-05 09:12:15 +01:00
parent d510b73cdf
commit b5214a341e
33 changed files with 58 additions and 58 deletions

View file

@ -180,7 +180,7 @@ private:
licenseTypes.removeEmptyStrings();
licenseTypes.removeDuplicates (false);
licenseState.type = [licenseTypes] ()
licenseState.type = [licenseTypes]()
{
if (licenseTypes.contains ("juce-pro")) return LicenseState::Type::pro;
else if (licenseTypes.contains ("juce-indie")) return LicenseState::Type::indie;

View file

@ -868,7 +868,7 @@ namespace
//==============================================================================
int performCommandLine (const ArgumentList& args)
{
return ConsoleApplication::invokeCatchingFailures ([&] () -> int
return ConsoleApplication::invokeCatchingFailures ([&]() -> int
{
if (args.containsOption ("--lf"))
preferredLineFeed = "\n";

View file

@ -376,7 +376,7 @@ private:
if (isCMakeBundle)
out << " " << pkgInfoPath << newLine;
auto xcodeIcnsFilePath = [&] () -> String
auto xcodeIcnsFilePath = [&]() -> String
{
if (exporter.isXcode()
&& target->getTargetFileType() == build_tools::ProjectType::Target::TargetFileType::executable)

View file

@ -2499,7 +2499,7 @@ private:
if (! subprojectInfo.second.isEmpty())
{
auto newEnd = std::remove_if (availableBuildProducts.begin(), availableBuildProducts.end(),
[&subprojectInfo](const std::pair<String, String> &item)
[&subprojectInfo] (const std::pair<String, String> &item)
{
return ! subprojectInfo.second.contains (item.first);
});

View file

@ -33,7 +33,7 @@
//==============================================================================
std::vector<ProjectExporter::ExporterTypeInfo> ProjectExporter::getExporterTypeInfos()
{
auto createIcon = [](const void* iconData, size_t iconDataSize)
auto createIcon = [] (const void* iconData, size_t iconDataSize)
{
Image image (Image::ARGB, 200, 200, true);
Graphics g (image);

View file

@ -33,7 +33,7 @@ private:
template<typename InterpolatorType>
void runInterplatorTests (const String& interpolatorName)
{
auto createGaussian = [](std::vector<float>& destination, float scale, float centreInSamples, float width)
auto createGaussian = [] (std::vector<float>& destination, float scale, float centreInSamples, float width)
{
for (size_t i = 0; i < destination.size(); ++i)
{
@ -44,7 +44,7 @@ private:
FloatVectorOperations::multiply (destination.data(), scale, (int) destination.size());
};
auto findGaussianPeak = [](const std::vector<float>& input) -> float
auto findGaussianPeak = [] (const std::vector<float>& input) -> float
{
auto max = std::max_element (std::begin (input), std::end (input));
auto maxPrev = max - 1;
@ -55,7 +55,7 @@ private:
return quadraticMaxLoc + (float) std::distance (std::begin (input), max);
};
auto expectAllElementsWithin = [this](const std::vector<float>& v1, const std::vector<float>& v2, float tolerance)
auto expectAllElementsWithin = [this] (const std::vector<float>& v1, const std::vector<float>& v2, float tolerance)
{
expectEquals ((int) v1.size(), (int) v2.size());

View file

@ -522,7 +522,7 @@ public:
return result;
};
auto compareData = [this](const AudioBuffer<float>& test,
auto compareData = [this] (const AudioBuffer<float>& test,
const AudioBuffer<float>& reference)
{
for (int i = 0; i < test.getNumSamples(); ++i)

View file

@ -517,7 +517,7 @@ AudioIODeviceType* AudioDeviceManager::getCurrentDeviceTypeObject() const
static void updateSetupChannels (AudioDeviceManager::AudioDeviceSetup& setup, int defaultNumIns, int defaultNumOuts)
{
auto updateChannels = [](const String& deviceName, BigInteger& channels, int defaultNumChannels)
auto updateChannels = [] (const String& deviceName, BigInteger& channels, int defaultNumChannels)
{
if (deviceName.isEmpty())
{

View file

@ -1415,7 +1415,7 @@ public:
threadEntryProc (threadUserPtr);
threadEntryProc = nullptr;
MessageManager::callAsync ([this] () { delete this; });
MessageManager::callAsync ([this]() { delete this; });
return oboe::DataCallbackResult::Stop;
}

View file

@ -1260,7 +1260,7 @@ public:
threadEntryProc = nullptr;
(*player)->SetPlayState (player, SL_PLAYSTATE_STOPPED);
MessageManager::callAsync ([this] () { delete this; });
MessageManager::callAsync ([this]() { delete this; });
}
}

View file

@ -990,19 +990,19 @@ private:
watcher->add_Added (
Callback<ITypedEventHandler<DeviceWatcher*, DeviceInformation*>> (
[handlerPtr](IDeviceWatcher*, IDeviceInformation* info) { return handlerPtr->addDevice (info); }
[handlerPtr] (IDeviceWatcher*, IDeviceInformation* info) { return handlerPtr->addDevice (info); }
).Get(),
&deviceAddedToken);
watcher->add_Removed (
Callback<ITypedEventHandler<DeviceWatcher*, DeviceInformationUpdate*>> (
[handlerPtr](IDeviceWatcher*, IDeviceInformationUpdate* infoUpdate) { return handlerPtr->removeDevice (infoUpdate); }
[handlerPtr] (IDeviceWatcher*, IDeviceInformationUpdate* infoUpdate) { return handlerPtr->removeDevice (infoUpdate); }
).Get(),
&deviceRemovedToken);
watcher->add_Updated (
Callback<ITypedEventHandler<DeviceWatcher*, DeviceInformationUpdate*>> (
[handlerPtr](IDeviceWatcher*, IDeviceInformationUpdate* infoUpdate) { return handlerPtr->updateDevice (infoUpdate); }
[handlerPtr] (IDeviceWatcher*, IDeviceInformationUpdate* infoUpdate) { return handlerPtr->updateDevice (infoUpdate); }
).Get(),
&deviceUpdatedToken);
@ -1118,7 +1118,7 @@ private:
if (devices.contains (removedDeviceId))
{
auto& info = devices.getReference (removedDeviceId);
listeners.call ([&info](Listener& l) { l.bleDeviceDisconnected (info.containerID); });
listeners.call ([&info] (Listener& l) { l.bleDeviceDisconnected (info.containerID); });
devices.remove (removedDeviceId);
JUCE_WINRT_MIDI_LOG ("Removed BLE device: " << removedDeviceId);
}
@ -1165,7 +1165,7 @@ private:
if (info.isConnected && ! isConnected)
{
JUCE_WINRT_MIDI_LOG ("BLE device connection status change: " << updatedDeviceId << " " << info.containerID << " " << (isConnected ? "connected" : "disconnected"));
listeners.call ([&info](Listener& l) { l.bleDeviceDisconnected (info.containerID); });
listeners.call ([&info] (Listener& l) { l.bleDeviceDisconnected (info.containerID); });
}
info.isConnected = isConnected;
@ -1580,7 +1580,7 @@ private:
auto hr = midiPort->add_MessageReceived (
Callback<ITypedEventHandler<MidiInPort*, MidiMessageReceivedEventArgs*>> (
[this](IMidiInPort*, IMidiMessageReceivedEventArgs* args) { return midiInMessageReceived (args); }
[this] (IMidiInPort*, IMidiMessageReceivedEventArgs* args) { return midiInMessageReceived (args); }
).Get(),
&midiInMessageToken);

View file

@ -1430,7 +1430,7 @@ private:
closeDevices();
initialise();
auto changedSampleRate = [this, sampleRateChangedByInput] ()
auto changedSampleRate = [this, sampleRateChangedByInput]()
{
if (inputDevice != nullptr && sampleRateChangedByInput)
return inputDevice->defaultSampleRate;

View file

@ -1881,7 +1881,7 @@ private:
pointer_sized_int handleCanPlugInDo (VstOpCodeArguments args)
{
auto text = (const char*) args.ptr;
auto matches = [=](const char* s) { return strcmp (text, s) == 0; };
auto matches = [=] (const char* s) { return strcmp (text, s) == 0; };
if (matches ("receiveVstEvents")
|| matches ("receiveVstMidiEvent")
@ -2148,7 +2148,7 @@ namespace
if (auto* callbackHandler = dynamic_cast<VSTCallbackHandler*> (processor))
{
callbackHandler->handleVstHostCallbackAvailable ([audioMaster, aEffect](int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt)
callbackHandler->handleVstHostCallbackAvailable ([audioMaster, aEffect] (int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt)
{
return audioMaster (aEffect, opcode, index, value, ptr, opt);
});

View file

@ -1439,7 +1439,7 @@ public:
|| info.unit == kAudioUnitParameterUnit_Boolean);
bool isBoolean = info.unit == kAudioUnitParameterUnit_Boolean;
auto label = [info] () -> String
auto label = [info]() -> String
{
if (info.unit == kAudioUnitParameterUnit_Percent) return "%";
if (info.unit == kAudioUnitParameterUnit_Seconds) return "s";

View file

@ -2788,7 +2788,7 @@ private:
bypassParam = param;
std::function<AudioProcessorParameterGroup*(Vst::UnitID)> findOrCreateGroup;
findOrCreateGroup = [&groupMap, &infoMap, &findOrCreateGroup](Vst::UnitID groupID)
findOrCreateGroup = [&groupMap, &infoMap, &findOrCreateGroup] (Vst::UnitID groupID)
{
auto existingGroup = groupMap.find (groupID);

View file

@ -773,7 +773,7 @@ void AudioProcessor::audioIOChanged (bool busNumberChanged, bool channelNumChang
bus->updateChannelCount();
}
auto countTotalChannels = [](const OwnedArray<AudioProcessor::Bus>& buses) noexcept
auto countTotalChannels = [] (const OwnedArray<AudioProcessor::Bus>& buses) noexcept
{
int n = 0;

View file

@ -27,9 +27,9 @@ AudioParameterChoice::AudioParameterChoice (const String& idToUse, const String&
range ([this]
{
NormalisableRange<float> rangeWithInterval { 0.0f, choices.size() - 1.0f,
[](float, float end, float v) { return jlimit (0.0f, end, v * end); },
[](float, float end, float v) { return jlimit (0.0f, 1.0f, v / end); },
[](float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } };
[] (float, float end, float v) { return jlimit (0.0f, end, v * end); },
[] (float, float end, float v) { return jlimit (0.0f, 1.0f, v / end); },
[] (float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } };
rangeWithInterval.interval = 1.0f;
return rangeWithInterval;
}()),

View file

@ -28,9 +28,9 @@ AudioParameterInt::AudioParameterInt (const String& idToUse, const String& nameT
range ([minValue, maxValue]
{
NormalisableRange<float> rangeWithInterval { (float) minValue, (float) maxValue,
[](float start, float end, float v) { return jlimit (start, end, v * (end - start) + start); },
[](float start, float end, float v) { return jlimit (0.0f, 1.0f, (v - start) / (end - start)); },
[](float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } };
[] (float start, float end, float v) { return jlimit (start, end, v * (end - start) + start); },
[] (float start, float end, float v) { return jlimit (0.0f, 1.0f, (v - start) / (end - start)); },
[] (float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } };
rangeWithInterval.interval = 1.0f;
return rangeWithInterval;
}()),

View file

@ -39,7 +39,7 @@ AudioProcessorValueTreeState::Parameter::Parameter (const String& parameterID,
labelText,
parameterCategory,
valueToTextFunction == nullptr ? std::function<String (float v, int)>()
: [valueToTextFunction](float v, int) { return valueToTextFunction (v); },
: [valueToTextFunction] (float v, int) { return valueToTextFunction (v); },
std::move (textToValueFunction)),
unsnappedDefault (valueRange.convertTo0to1 (defaultParameterValue)),
metaParameter (isMetaParameter),
@ -155,7 +155,7 @@ private:
return;
unnormalisedValue = newValue;
listeners.call ([=](Listener& l) { l.parameterChanged (parameter.paramID, unnormalisedValue); });
listeners.call ([=] (Listener& l) { l.parameterChanged (parameter.paramID, unnormalisedValue); });
listenersNeedCalling = false;
needsUpdate = true;
}
@ -512,7 +512,7 @@ struct ParameterAdapterTests : public UnitTest
beginTest ("Denormalised parameter values can be retrieved");
{
const auto test = [&](NormalisableRange<float> range, float value)
const auto test = [&] (NormalisableRange<float> range, float value)
{
AudioParameterFloat param ({}, {}, range, {}, {});
AudioProcessorValueTreeState::ParameterAdapter adapter (param);
@ -529,7 +529,7 @@ struct ParameterAdapterTests : public UnitTest
beginTest ("Floats can be converted to text");
{
const auto test = [&](NormalisableRange<float> range, float value, String expected)
const auto test = [&] (NormalisableRange<float> range, float value, String expected)
{
AudioParameterFloat param ({}, {}, range, {}, {});
AudioProcessorValueTreeState::ParameterAdapter adapter (param);
@ -545,7 +545,7 @@ struct ParameterAdapterTests : public UnitTest
beginTest ("Text can be converted to floats");
{
const auto test = [&](NormalisableRange<float> range, String text, float expected)
const auto test = [&] (NormalisableRange<float> range, String text, float expected)
{
AudioParameterFloat param ({}, {}, range, {}, {});
AudioProcessorValueTreeState::ParameterAdapter adapter (param);

View file

@ -70,7 +70,7 @@ bool BlocksVersion::evaluate (const String& versionString)
jassert (result);
auto toInt = [](const std::sub_match<const char*> match)
auto toInt = [] (const std::sub_match<const char*> match)
{
return std::atoi (match.str().c_str());
};
@ -108,7 +108,7 @@ bool BlocksVersion::isGreaterThan (const BlocksVersion& other) const
bool BlocksVersion::releaseTypeGreaterThan (const BlocksVersion& other) const
{
auto getReleaseTypePriority = [](const BlocksVersion& version)
auto getReleaseTypePriority = [] (const BlocksVersion& version)
{
String releaseTypes[4] = { "alpha", "beta", "rc", {} };

View file

@ -113,7 +113,7 @@ void PhysicalTopologySource::setActive (bool shouldBeActive)
detector.reset();
}
listeners.call ([](TopologySource::Listener& l){ l.topologyChanged(); });
listeners.call ([] (TopologySource::Listener& l){ l.topologyChanged(); });
}
bool PhysicalTopologySource::isActive() const

View file

@ -280,7 +280,7 @@ namespace SocketHelpers
if (! lock.isLocked())
return -1;
auto hasErrorOccurred = [&handle] () -> bool
auto hasErrorOccurred = [&handle]() -> bool
{
auto h = (SocketHandle) handle.load();

View file

@ -343,7 +343,7 @@ public:
c = *text;
auto writeExponentDigits = [](int exponent, char* destination)
auto writeExponentDigits = [] (int exponent, char* destination)
{
auto exponentDivisor = 100;

View file

@ -292,7 +292,7 @@ public:
beginTest ("Process");
{
resetBlocks();
AudioBlock<SampleType>::process (block, otherBlock, [](SampleType x) { return x + (NumericType) 1.0; });
AudioBlock<SampleType>::process (block, otherBlock, [] (SampleType x) { return x + (NumericType) 1.0; });
expect (otherBlock.getSample (0, 4) == SampleType (6.0));
expect (otherBlock.getSample (1, 4) == SampleType (12.0));
}

View file

@ -146,7 +146,7 @@ typename FIR::Coefficients<FloatType>::Ptr
Matrix<double> b (M + 1, 1),
q (2 * M + 1, 1);
auto sinc = [](double x) { return x == 0 ? 1 : std::sin (x * MathConstants<double>::pi)
auto sinc = [] (double x) { return x == 0 ? 1 : std::sin (x * MathConstants<double>::pi)
/ (MathConstants<double>::pi * x); };
auto factorp = wp / MathConstants<double>::pi;
@ -184,7 +184,7 @@ typename FIR::Coefficients<FloatType>::Ptr
Matrix<double> qp (2 * M, 1);
Matrix<double> qs (2 * M, 1);
auto sinc = [](double x) { return x == 0 ? 1 : std::sin (x * MathConstants<double>::pi)
auto sinc = [] (double x) { return x == 0 ? 1 : std::sin (x * MathConstants<double>::pi)
/ (MathConstants<double>::pi * x); };
auto factorp = wp / MathConstants<double>::pi;

View file

@ -187,7 +187,7 @@ private:
// Trying to add a timer that's already here - shouldn't get to this point,
// so if you get this assertion, let me know!
jassert (std::find_if (timers.begin(), timers.end(),
[t](TimerCountdown i) { return i.timer == t; }) == timers.end());
[t] (TimerCountdown i) { return i.timer == t; }) == timers.end());
auto pos = timers.size();

View file

@ -451,7 +451,7 @@ private:
static File getCacheDirectory()
{
static File result = [] ()
static File result = []()
{
auto appContext = getAppContext();

View file

@ -120,7 +120,7 @@ public:
}
else
{
auto* imageDataContainer = [](const Image& img) -> HeapBlockContainer::Ptr*
auto* imageDataContainer = [] (const Image& img) -> HeapBlockContainer::Ptr*
{
if (auto* cgim = dynamic_cast<CoreGraphicsPixelData*> (img.getPixelData()))
return new HeapBlockContainer::Ptr (cgim->imageDataHolder);
@ -637,7 +637,7 @@ void CoreGraphicsContext::drawGlyph (int glyphNumber, const AffineTransform& tra
{
if (state->fontRef != nullptr && state->fillType.isColour())
{
auto cgTransformIsOnlyTranslation = [](CGAffineTransform t)
auto cgTransformIsOnlyTranslation = [] (CGAffineTransform t)
{
return t.a == 1.0f && t.d == 1.0f && t.b == 0.0f && t.c == 0.0f;
};

View file

@ -69,7 +69,7 @@ private:
void finish()
{
MessageManager::callAsync ([this] () { owner.filesToSharePrepared(); });
MessageManager::callAsync ([this]() { owner.filesToSharePrepared(); });
}
ContentSharer& owner;
@ -129,7 +129,7 @@ private:
void finish()
{
MessageManager::callAsync ([this] () { owner.filesToSharePrepared(); });
MessageManager::callAsync ([this]() { owner.filesToSharePrepared(); });
}
ContentSharer& owner;

View file

@ -847,9 +847,9 @@ struct Grid::AutoPlacement
Array<Grid::TrackInfo>& rows,
const ItemPlacementArray& itemPlacementArray)
{
auto isSpan = [](Grid::PlacementHelpers::LineRange r) -> bool { return std::abs (r.end - r.start) > 1; };
auto isSpan = [] (Grid::PlacementHelpers::LineRange r) -> bool { return std::abs (r.end - r.start) > 1; };
auto getHighestItemOnRow = [isSpan](int rowNumber, const ItemPlacementArray& itemPlacementArrayToUse) -> float
auto getHighestItemOnRow = [isSpan] (int rowNumber, const ItemPlacementArray& itemPlacementArrayToUse) -> float
{
float highestRowSize = 0.0f;
@ -860,7 +860,7 @@ struct Grid::AutoPlacement
return highestRowSize;
};
auto getHighestItemOnColumn = [isSpan](int rowNumber, const ItemPlacementArray& itemPlacementArrayToUse) -> float
auto getHighestItemOnColumn = [isSpan] (int rowNumber, const ItemPlacementArray& itemPlacementArrayToUse) -> float
{
float highestColumnSize = 0.0f;
for (const auto& i : itemPlacementArrayToUse)

View file

@ -2726,7 +2726,7 @@ void XWindowSystem::initialiseXDisplay()
// Setup input event handler
LinuxEventLoop::registerFdCallback (X11Symbols::getInstance()->xConnectionNumber (display),
[this](int)
[this] (int)
{
do
{

View file

@ -66,7 +66,7 @@ public:
auto& pendingOpen = camerasToOpen.getReference (camerasToOpen.size() - 1);
pendingOpen.device->pimpl->open ([this](const String& deviceId, const String& error)
pendingOpen.device->pimpl->open ([this] (const String& deviceId, const String& error)
{
int cIndex = getCameraIndex (deviceId);

View file

@ -1821,7 +1821,7 @@ private:
JUCE_VIDEO_LOG ("App resumed, restoring media player...");
loadAsync (currentURL, [this](const URL&, Result r)
loadAsync (currentURL, [this] (const URL&, Result r)
{
if (r.wasOk())
mediaSession.restoreState();