mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Enumerate: Replace some non-ranged loops
This commit is contained in:
parent
cb44d72b78
commit
94ee60041f
9 changed files with 45 additions and 54 deletions
|
|
@ -55,10 +55,8 @@ struct Factory
|
|||
|
||||
std::array<uint32_t, 2> words;
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
for (auto& word : words)
|
||||
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index++);
|
||||
for (const auto [index, word] : enumerate (words))
|
||||
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index);
|
||||
|
||||
return PacketX2 { words };
|
||||
}
|
||||
|
|
@ -79,10 +77,8 @@ struct Factory
|
|||
|
||||
std::array<uint32_t, 4> words;
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
for (auto& word : words)
|
||||
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index++);
|
||||
for (const auto [index, word] : enumerate (words))
|
||||
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index);
|
||||
|
||||
return PacketX4 { words };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1759,18 +1759,16 @@ namespace AAXClasses
|
|||
if (! bypassPartOfRegularParams)
|
||||
juceParameters.addNonOwning (bypassParameter);
|
||||
|
||||
int parameterIndex = 0;
|
||||
|
||||
for (auto* juceParam : juceParameters)
|
||||
for (const auto [parameterIndex, juceParam] : enumerate (juceParameters))
|
||||
{
|
||||
auto isBypassParameter = (juceParam == bypassParameter);
|
||||
|
||||
auto category = juceParam->getCategory();
|
||||
auto paramID = isBypassParameter ? String (cDefaultMasterBypassID)
|
||||
: juceParameters.getParamID (audioProcessor, parameterIndex);
|
||||
: juceParameters.getParamID (audioProcessor, (int) parameterIndex);
|
||||
|
||||
aaxParamIDs.add (paramID);
|
||||
auto* aaxParamID = aaxParamIDs.getReference (parameterIndex++).toRawUTF8();
|
||||
auto* aaxParamID = aaxParamIDs.getReference ((int) parameterIndex).toRawUTF8();
|
||||
|
||||
paramMap.set (AAXClasses::getAAXParamHash (aaxParamID), juceParam);
|
||||
|
||||
|
|
|
|||
|
|
@ -251,10 +251,9 @@ private:
|
|||
const std::map<LV2_URID, size_t> uridToIndexMap = [&]
|
||||
{
|
||||
std::map<LV2_URID, size_t> result;
|
||||
size_t index = 0;
|
||||
|
||||
for (const auto& urid : indexToUridMap)
|
||||
result.emplace (urid, index++);
|
||||
for (const auto [index, urid] : enumerate (indexToUridMap))
|
||||
result.emplace (urid, index);
|
||||
|
||||
return result;
|
||||
}();
|
||||
|
|
@ -1079,9 +1078,9 @@ private:
|
|||
"\tlv2:portProperty lv2:enumeration " << (param.isBoolean() ? ", lv2:toggled " : "") << ";\n"
|
||||
"\tlv2:scalePoint ";
|
||||
|
||||
auto counter = 0;
|
||||
const auto strings = param.getAllValueStrings();
|
||||
|
||||
for (const auto& string : param.getAllValueStrings())
|
||||
for (const auto& [counter, string] : enumerate (strings))
|
||||
{
|
||||
const auto value = jmap ((float) counter, 0.0f, (float) numSteps - 1.0f, min, max);
|
||||
|
||||
|
|
@ -1089,8 +1088,6 @@ private:
|
|||
"\t\trdfs:label \"" << string << "\" ;\n"
|
||||
"\t\trdf:value " << value << " ;\n"
|
||||
"\t]";
|
||||
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2231,10 +2231,8 @@ public:
|
|||
|
||||
void initialise (const std::vector<Vst::ParamID>& idsIn)
|
||||
{
|
||||
Steinberg::int32 index = 0;
|
||||
|
||||
for (const auto& id : idsIn)
|
||||
map.emplace (id, Entry { std::make_unique<ParamValueQueue> (id, Steinberg::int32 { index++ }) });
|
||||
for (const auto [index, id] : enumerate (idsIn))
|
||||
map.emplace (id, Entry { std::make_unique<ParamValueQueue> (id, (Steinberg::int32) index) });
|
||||
|
||||
queues.reserve (map.size());
|
||||
queues.clear();
|
||||
|
|
|
|||
|
|
@ -592,10 +592,8 @@ private:
|
|||
|
||||
void init()
|
||||
{
|
||||
auto index = 1;
|
||||
|
||||
for (auto& channel : buffers)
|
||||
std::fill (channel.begin(), channel.end(), (float) index++);
|
||||
for (const auto [index, channel] : enumerate (buffers, 1))
|
||||
std::fill (channel.begin(), channel.end(), (float) index);
|
||||
}
|
||||
|
||||
bool allMatch (int channel, float value) const
|
||||
|
|
|
|||
|
|
@ -281,9 +281,9 @@ struct Grid::Helpers
|
|||
const auto lines = getArrayOfLinesFromTracks (tracks);
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < lines.size(); i++)
|
||||
for (const auto [index, line] : enumerate (lines))
|
||||
{
|
||||
for (const auto& name : lines.getReference (i).lineNames)
|
||||
for (const auto& name : line.lineNames)
|
||||
{
|
||||
if (prop.getName() == name)
|
||||
{
|
||||
|
|
@ -293,7 +293,7 @@ struct Grid::Helpers
|
|||
}
|
||||
|
||||
if (count == prop.getNumber())
|
||||
return i + 1;
|
||||
return (int) index + 1;
|
||||
}
|
||||
|
||||
jassertfalse;
|
||||
|
|
@ -328,9 +328,11 @@ struct Grid::Helpers
|
|||
const auto lines = getArrayOfLinesFromTracks (tracks);
|
||||
int count = 0;
|
||||
|
||||
for (int i = startLineNumber; i < lines.size(); i++)
|
||||
const auto enumerated = enumerate (lines);
|
||||
|
||||
for (const auto [index, line] : makeRange (enumerated.begin() + startLineNumber, enumerated.end()))
|
||||
{
|
||||
for (const auto& name : lines.getReference (i).lineNames)
|
||||
for (const auto& name : line.lineNames)
|
||||
{
|
||||
if (propertyWithSpan.getName() == name)
|
||||
{
|
||||
|
|
@ -340,7 +342,7 @@ struct Grid::Helpers
|
|||
}
|
||||
|
||||
if (count == propertyWithSpan.getNumber())
|
||||
return i + 1;
|
||||
return (int) index + 1;
|
||||
}
|
||||
|
||||
jassertfalse;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue