Skip to content

Commit

Permalink
Add Features to PMD and have SupportsMultiplicativeMod being first (#136
Browse files Browse the repository at this point in the history
)

As part of the pursuit of param local short circuit multi mode mod
  • Loading branch information
baconpaul authored Sep 21, 2024
1 parent 1481a2c commit 821c9f3
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions include/sst/basic-blocks/params/ParamMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,34 @@ struct ParamMetaData
return res;
}

/*
* Parameters have an extensible optional set of features stored in a single
* uint64_t which you can flag on and off. This allows us to add things we want
* as binaries on params without adding a squillion little bools for lesser importance
* information only toggles. These features are not stream-at-rest stable just
* stream-in-session stable by integer.
*/
enum struct Features : uint64_t
{
SUPPORTS_MULTIPLICATIVE_MODULATION = 1 << 0
};
uint64_t features{0};
ParamMetaData withFeature(Features f) const
{
auto res = *this;
res.features |= (uint64_t)f;
return res;
}
bool hasFeature(Features f) const { return features & (uint64_t)f; }
ParamMetaData withSupportsMultiplicativeModulation() const
{
return withFeature(Features::SUPPORTS_MULTIPLICATIVE_MODULATION);
}
bool hasSupportsMultiplicativeModulation() const
{
return hasFeature(Features::SUPPORTS_MULTIPLICATIVE_MODULATION);
}

/*
* To String and From String conversion functions require information about the
* parameter to execute. The primary driver is the value so the API takes the form
Expand Down Expand Up @@ -753,6 +781,8 @@ struct ParamMetaData
// v * v * v * svA = 1
// v = cbrt(1/svA)
res = res.withDefault(std::cbrt(1.f / res.svA)).withQuantizedInterval(3.f);

res = res.withSupportsMultiplicativeModulation();
return res;
}
ParamMetaData asLinearDecibel(float lower = -96, float upper = 12)
Expand Down

0 comments on commit 821c9f3

Please sign in to comment.