Put operator == in the constructor for the modkeyThis function is called alot, this seems to favor inlining
This commit is contained in:
parent
7ec5da9ddb
commit
db9840c5bd
3 changed files with 22 additions and 27 deletions
|
|
@ -7,7 +7,6 @@
|
|||
#include "ModKey.h"
|
||||
#include "../Debug.h"
|
||||
#include <absl/strings/str_cat.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace sfz {
|
||||
|
||||
|
|
@ -31,16 +30,6 @@ ModKey::Parameters& ModKey::Parameters::operator=(const Parameters& other) noexc
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool ModKey::Parameters::operator==(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(this, &other, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
bool ModKey::Parameters::operator!=(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(this, &other, sizeof(*this)) != 0;
|
||||
}
|
||||
|
||||
ModKey ModKey::createCC(uint16_t cc, uint8_t curve, uint8_t smooth, float value, float step)
|
||||
{
|
||||
ModKey::Parameters p;
|
||||
|
|
@ -106,13 +95,3 @@ std::string ModKey::toString() const
|
|||
|
||||
} // namespace sfz
|
||||
|
||||
bool sfz::ModKey::operator==(const ModKey &other) const noexcept
|
||||
{
|
||||
return id_ == other.id_ && region_ == other.region_ &&
|
||||
parameters() == other.parameters();
|
||||
}
|
||||
|
||||
bool sfz::ModKey::operator!=(const ModKey &other) const noexcept
|
||||
{
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "ModId.h"
|
||||
#include "../NumericId.h"
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
namespace sfz {
|
||||
|
||||
|
|
@ -49,8 +50,15 @@ public:
|
|||
Parameters(Parameters&&) = delete;
|
||||
Parameters &operator=(Parameters&&) = delete;
|
||||
|
||||
bool operator==(const Parameters& other) const noexcept;
|
||||
bool operator!=(const Parameters& other) const noexcept;
|
||||
bool operator==(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(this, &other, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(this, &other, sizeof(*this)) != 0;
|
||||
}
|
||||
|
||||
union {
|
||||
//! Parameters if this key identifies a CC source
|
||||
|
|
@ -64,8 +72,17 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
bool operator==(const ModKey &other) const noexcept;
|
||||
bool operator!=(const ModKey &other) const noexcept;
|
||||
bool operator==(const ModKey &other) const noexcept
|
||||
{
|
||||
return id_ == other.id_ && region_ == other.region_ &&
|
||||
parameters() == other.parameters();
|
||||
}
|
||||
|
||||
bool operator!=(const ModKey &other) const noexcept
|
||||
{
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
//! Identifier
|
||||
|
|
|
|||
|
|
@ -364,8 +364,7 @@ float* ModMatrix::getModulation(TargetId targetId)
|
|||
}
|
||||
else {
|
||||
ASSERT(targetFlags & kModIsAdditive);
|
||||
for (uint32_t i = 0; i < numFrames; ++i)
|
||||
buffer[i] += sourceDepth * sourceBuffer[i];
|
||||
sfz::multiplyAdd1<float>(sourceDepth, sourceBuffer, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue