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

AU Client: Switch HashMap to unordered_map

This commit is contained in:
reuk 2022-01-24 19:16:50 +00:00
parent 7068e70758
commit 3d38ca764e
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -1812,7 +1812,7 @@ private:
//==============================================================================
LegacyAudioParametersWrapper juceParameters;
HashMap<int32, AudioProcessorParameter*> paramMap;
std::unordered_map<int32, AudioProcessorParameter*> paramMap;
Array<AudioUnitParameterID> auParamIDs;
Array<const AudioProcessorParameterGroup*> parameterGroups;
@ -2057,10 +2057,10 @@ private:
// Consider yourself very unlucky if you hit this assertion. The hash codes of your
// parameter ids are not unique.
jassert (! paramMap.contains (static_cast<int32> (auParamID)));
jassert (paramMap.find (static_cast<int32> (auParamID)) == paramMap.end());
auParamIDs.add (auParamID);
paramMap.set (static_cast<int32> (auParamID), param);
paramMap.emplace (static_cast<int32> (auParamID), param);
Globals()->SetParameter (auParamID, param->getValue());
}
}
@ -2141,9 +2141,13 @@ private:
AudioProcessorParameter* getParameterForAUParameterID (AudioUnitParameterID address) const noexcept
{
auto index = static_cast<int32> (address);
return forceUseLegacyParamIDs ? juceParameters.getParamForIndex (index)
: paramMap[index];
const auto index = static_cast<int32> (address);
if (forceUseLegacyParamIDs)
return juceParameters.getParamForIndex (index);
const auto iter = paramMap.find (index);
return iter != paramMap.end() ? iter->second : nullptr;
}
//==============================================================================