Support long smoothcc times up to 64k ms
This commit is contained in:
parent
73608d2091
commit
171411ac18
8 changed files with 12 additions and 12 deletions
|
|
@ -56,8 +56,8 @@ namespace config {
|
||||||
constexpr int numVoices { 64 };
|
constexpr int numVoices { 64 };
|
||||||
constexpr unsigned maxVoices { 256 };
|
constexpr unsigned maxVoices { 256 };
|
||||||
constexpr unsigned smoothingSteps { 512 };
|
constexpr unsigned smoothingSteps { 512 };
|
||||||
constexpr uint8_t xfadeSmoothing { 5 };
|
constexpr uint16_t xfadeSmoothing { 5 };
|
||||||
constexpr uint8_t gainSmoothing { 0 };
|
constexpr uint16_t gainSmoothing { 0 };
|
||||||
constexpr unsigned powerTableSizeExponent { 11 };
|
constexpr unsigned powerTableSizeExponent { 11 };
|
||||||
constexpr int maxFilePromises { maxVoices };
|
constexpr int maxFilePromises { maxVoices };
|
||||||
constexpr int allSoundOffCC { 120 };
|
constexpr int allSoundOffCC { 120 };
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ FloatSpec hiNormalized { 1.0f, {0.0f, 1.0f}, 0 };
|
||||||
FloatSpec loBipolar { -1.0f, {-1.0f, 1.0f}, 0 };
|
FloatSpec loBipolar { -1.0f, {-1.0f, 1.0f}, 0 };
|
||||||
FloatSpec hiBipolar { 1.0f, {-1.0f, 1.0f}, 0 };
|
FloatSpec hiBipolar { 1.0f, {-1.0f, 1.0f}, 0 };
|
||||||
UInt16Spec ccNumber { 0, {0, config::numCCs}, 0 };
|
UInt16Spec ccNumber { 0, {0, config::numCCs}, 0 };
|
||||||
UInt8Spec smoothCC { 0, {0, 100}, 0 };
|
UInt16Spec smoothCC { 0, {0, 100}, kPermissiveUpperBound };
|
||||||
UInt8Spec curveCC { 0, {0, 255}, 0 };
|
UInt8Spec curveCC { 0, {0, 255}, 0 };
|
||||||
UInt8Spec sustainCC { 64, {0, 127}, 0 };
|
UInt8Spec sustainCC { 64, {0, 127}, 0 };
|
||||||
FloatSpec sustainThreshold { 1.0f, {0.0f, 127.0f}, kNormalizeMidi };
|
FloatSpec sustainThreshold { 1.0f, {0.0f, 127.0f}, kNormalizeMidi };
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ namespace Default
|
||||||
extern const OpcodeSpec<float> hiChannelAftertouch;
|
extern const OpcodeSpec<float> hiChannelAftertouch;
|
||||||
extern const OpcodeSpec<uint16_t> ccNumber;
|
extern const OpcodeSpec<uint16_t> ccNumber;
|
||||||
extern const OpcodeSpec<uint8_t> curveCC;
|
extern const OpcodeSpec<uint8_t> curveCC;
|
||||||
extern const OpcodeSpec<uint8_t> smoothCC;
|
extern const OpcodeSpec<uint16_t> smoothCC;
|
||||||
extern const OpcodeSpec<uint8_t> sustainCC;
|
extern const OpcodeSpec<uint8_t> sustainCC;
|
||||||
extern const OpcodeSpec<bool> checkSustain;
|
extern const OpcodeSpec<bool> checkSustain;
|
||||||
extern const OpcodeSpec<bool> checkSostenuto;
|
extern const OpcodeSpec<bool> checkSostenuto;
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ struct Region {
|
||||||
float bendUp { Default::bendUp };
|
float bendUp { Default::bendUp };
|
||||||
float bendDown { Default::bendDown };
|
float bendDown { Default::bendDown };
|
||||||
float bendStep { Default::bendStep };
|
float bendStep { Default::bendStep };
|
||||||
uint8_t bendSmooth { Default::smoothCC };
|
uint16_t bendSmooth { Default::smoothCC };
|
||||||
|
|
||||||
// Envelopes
|
// Envelopes
|
||||||
EGDescription amplitudeEG;
|
EGDescription amplitudeEG;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ OnePoleSmoother::OnePoleSmoother()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnePoleSmoother::setSmoothing(uint8_t smoothValue, float sampleRate)
|
void OnePoleSmoother::setSmoothing(unsigned smoothValue, float sampleRate)
|
||||||
{
|
{
|
||||||
smoothing = (smoothValue > 0);
|
smoothing = (smoothValue > 0);
|
||||||
if (smoothing) {
|
if (smoothing) {
|
||||||
|
|
@ -62,7 +62,7 @@ LinearSmoother::LinearSmoother()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinearSmoother::setSmoothing(uint8_t smoothValue, float sampleRate)
|
void LinearSmoother::setSmoothing(unsigned smoothValue, float sampleRate)
|
||||||
{
|
{
|
||||||
const float smoothTime = 1e-3f * smoothValue;
|
const float smoothTime = 1e-3f * smoothValue;
|
||||||
smoothFrames_ = static_cast<int32_t>(smoothTime * sampleRate);
|
smoothFrames_ = static_cast<int32_t>(smoothTime * sampleRate);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public:
|
||||||
* @param smoothValue
|
* @param smoothValue
|
||||||
* @param sampleRate
|
* @param sampleRate
|
||||||
*/
|
*/
|
||||||
void setSmoothing(uint8_t smoothValue, float sampleRate);
|
void setSmoothing(unsigned smoothValue, float sampleRate);
|
||||||
/**
|
/**
|
||||||
* @brief Reset the filter state to a given value
|
* @brief Reset the filter state to a given value
|
||||||
*
|
*
|
||||||
|
|
@ -63,7 +63,7 @@ public:
|
||||||
* @param smoothValue
|
* @param smoothValue
|
||||||
* @param sampleRate
|
* @param sampleRate
|
||||||
*/
|
*/
|
||||||
void setSmoothing(uint8_t smoothValue, float sampleRate);
|
void setSmoothing(unsigned smoothValue, float sampleRate);
|
||||||
/**
|
/**
|
||||||
* @brief Reset the filter state to a given value
|
* @brief Reset the filter state to a given value
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ ModKey::Parameters& ModKey::Parameters::operator=(Parameters&& other) noexcept
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModKey ModKey::createCC(uint16_t cc, uint8_t curve, uint8_t smooth, float step)
|
ModKey ModKey::createCC(uint16_t cc, uint8_t curve, uint16_t smooth, float step)
|
||||||
{
|
{
|
||||||
ModKey::Parameters p;
|
ModKey::Parameters p;
|
||||||
p.cc = cc;
|
p.cc = cc;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
explicit ModKey(ModId id, NumericId<Region> region = {}, Parameters params = {})
|
explicit ModKey(ModId id, NumericId<Region> region = {}, Parameters params = {})
|
||||||
: id_(id), region_(region), params_(params), flags_(ModIds::flags(id_)) {}
|
: id_(id), region_(region), params_(params), flags_(ModIds::flags(id_)) {}
|
||||||
|
|
||||||
static ModKey createCC(uint16_t cc, uint8_t curve, uint8_t smooth, float step);
|
static ModKey createCC(uint16_t cc, uint8_t curve, uint16_t smooth, 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);
|
||||||
|
|
||||||
explicit operator bool() const noexcept { return id_ != ModId(); }
|
explicit operator bool() const noexcept { return id_ != ModId(); }
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
struct RawParameters {
|
struct RawParameters {
|
||||||
union {
|
union {
|
||||||
//! Parameters if this key identifies a CC source
|
//! Parameters if this key identifies a CC source
|
||||||
struct { uint16_t cc; uint8_t curve, smooth; float step; };
|
struct { uint16_t cc; uint8_t curve; uint16_t smooth; float step; };
|
||||||
//! Parameters otherwise, based on the related opcode
|
//! Parameters otherwise, based on the related opcode
|
||||||
// eg. `N` in `lfoN`, `N, X` in `lfoN_eqX`
|
// eg. `N` in `lfoN`, `N, X` in `lfoN_eqX`
|
||||||
struct { uint8_t N, X, Y, Z; };
|
struct { uint8_t N, X, Y, Z; };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue