Memorize the flags to avoid a recurrent switch
This commit is contained in:
parent
9a417826c2
commit
7ec5da9ddb
2 changed files with 5 additions and 7 deletions
|
|
@ -5,7 +5,6 @@
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
||||||
|
|
||||||
#include "ModKey.h"
|
#include "ModKey.h"
|
||||||
#include "ModId.h"
|
|
||||||
#include "../Debug.h"
|
#include "../Debug.h"
|
||||||
#include <absl/strings/str_cat.h>
|
#include <absl/strings/str_cat.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -74,10 +73,6 @@ bool ModKey::isTarget() const noexcept
|
||||||
return ModIds::isTarget(id_);
|
return ModIds::isTarget(id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModKey::flags() const noexcept
|
|
||||||
{
|
|
||||||
return ModIds::flags(id_);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ModKey::toString() const
|
std::string ModKey::toString() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ModKeyHash.h"
|
#include "ModKeyHash.h"
|
||||||
|
#include "ModId.h"
|
||||||
#include "../NumericId.h"
|
#include "../NumericId.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
@ -24,7 +25,7 @@ public:
|
||||||
|
|
||||||
ModKey() = default;
|
ModKey() = default;
|
||||||
explicit ModKey(ModId id, NumericId<Region> region = {}, Parameters params = {})
|
explicit ModKey(ModId id, NumericId<Region> region = {}, Parameters params = {})
|
||||||
: id_(id), region_(region), params_(params) {}
|
: id_(id), region_(region), params_(params), flags_(ModIds::flags(id_)) {}
|
||||||
|
|
||||||
static ModKey createCC(uint16_t cc, uint8_t curve, uint8_t smooth, float value, float step);
|
static ModKey createCC(uint16_t cc, uint8_t curve, uint8_t smooth, float value, float step);
|
||||||
static ModKey createNXYZ(ModId id, NumericId<Region> region, uint8_t N = 0, uint8_t X = 0, uint8_t Y = 0, uint8_t Z = 0);
|
static ModKey createNXYZ(ModId id, NumericId<Region> region, uint8_t N = 0, uint8_t X = 0, uint8_t Y = 0, uint8_t Z = 0);
|
||||||
|
|
@ -34,10 +35,10 @@ public:
|
||||||
const ModId& id() const noexcept { return id_; }
|
const ModId& id() const noexcept { return id_; }
|
||||||
NumericId<Region> region() const noexcept { return region_; }
|
NumericId<Region> region() const noexcept { return region_; }
|
||||||
const Parameters& parameters() const noexcept { return params_; }
|
const Parameters& parameters() const noexcept { return params_; }
|
||||||
|
int flags() const noexcept { return flags_; }
|
||||||
|
|
||||||
bool isSource() const noexcept;
|
bool isSource() const noexcept;
|
||||||
bool isTarget() const noexcept;
|
bool isTarget() const noexcept;
|
||||||
int flags() const noexcept;
|
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
struct Parameters {
|
struct Parameters {
|
||||||
|
|
@ -73,6 +74,8 @@ private:
|
||||||
NumericId<Region> region_;
|
NumericId<Region> region_;
|
||||||
//! List of values which identify the key uniquely, along with the hash and region
|
//! List of values which identify the key uniquely, along with the hash and region
|
||||||
Parameters params_ {};
|
Parameters params_ {};
|
||||||
|
// Memorize the flag
|
||||||
|
int flags_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sfz
|
} // namespace sfz
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue