Make filN_random real-valued, and bipolar
This commit is contained in:
parent
6223fe5336
commit
283a7a39c7
4 changed files with 5 additions and 7 deletions
|
|
@ -160,7 +160,7 @@ namespace Default
|
||||||
constexpr float filterGain { 0 };
|
constexpr float filterGain { 0 };
|
||||||
constexpr int filterKeytrack { 0 };
|
constexpr int filterKeytrack { 0 };
|
||||||
constexpr uint8_t filterKeycenter { 60 };
|
constexpr uint8_t filterKeycenter { 60 };
|
||||||
constexpr int filterRandom { 0 };
|
constexpr float filterRandom { 0 };
|
||||||
constexpr int filterVeltrack { 0 };
|
constexpr int filterVeltrack { 0 };
|
||||||
constexpr float filterCutoffCC { 0 };
|
constexpr float filterCutoffCC { 0 };
|
||||||
constexpr float filterResonanceCC { 0 };
|
constexpr float filterResonanceCC { 0 };
|
||||||
|
|
@ -170,7 +170,7 @@ namespace Default
|
||||||
constexpr Range<float> filterGainRange { -96.0f, 96.0f };
|
constexpr Range<float> filterGainRange { -96.0f, 96.0f };
|
||||||
constexpr Range<float> filterGainModRange { -96.0f, 96.0f };
|
constexpr Range<float> filterGainModRange { -96.0f, 96.0f };
|
||||||
constexpr Range<int> filterKeytrackRange { 0, 1200 };
|
constexpr Range<int> filterKeytrackRange { 0, 1200 };
|
||||||
constexpr Range<int> filterRandomRange { 0, 9600 };
|
constexpr Range<float> filterRandomRange { 0, 9600 };
|
||||||
constexpr Range<int> filterVeltrackRange { -9600, 9600 };
|
constexpr Range<int> filterVeltrackRange { -9600, 9600 };
|
||||||
constexpr Range<float> filterResonanceRange { 0.0f, 96.0f };
|
constexpr Range<float> filterResonanceRange { 0.0f, 96.0f };
|
||||||
constexpr Range<float> filterResonanceModRange { 0.0f, 96.0f };
|
constexpr Range<float> filterResonanceModRange { 0.0f, 96.0f };
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ struct FilterDescription
|
||||||
int keytrack { Default::filterKeytrack };
|
int keytrack { Default::filterKeytrack };
|
||||||
uint8_t keycenter { Default::filterKeycenter };
|
uint8_t keycenter { Default::filterKeycenter };
|
||||||
int veltrack { Default::filterVeltrack };
|
int veltrack { Default::filterVeltrack };
|
||||||
int random { Default::filterRandom };
|
float random { Default::filterRandom };
|
||||||
FilterType type { FilterType::kFilterLpf2p };
|
FilterType type { FilterType::kFilterLpf2p };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ void sfz::FilterHolder::setup(const Region& region, unsigned filterId, int noteN
|
||||||
// Setup the base values
|
// Setup the base values
|
||||||
baseCutoff = description->cutoff;
|
baseCutoff = description->cutoff;
|
||||||
if (description->random != 0) {
|
if (description->random != 0) {
|
||||||
dist.param(filterRandomDist::param_type(0, description->random));
|
fast_real_distribution<float> dist { -description->random, description->random };
|
||||||
baseCutoff *= centsFactor(dist(Random::randomGenerator));
|
baseCutoff *= centsFactor(dist(Random::randomGenerator));
|
||||||
}
|
}
|
||||||
const auto keytrack = description->keytrack * (noteNumber - description->keycenter);
|
const auto keytrack = description->keytrack * (noteNumber - description->keycenter);
|
||||||
baseCutoff *= centsFactor(keytrack);
|
baseCutoff *= centsFactor(keytrack);
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ private:
|
||||||
ModMatrix::TargetId cutoffTarget;
|
ModMatrix::TargetId cutoffTarget;
|
||||||
ModMatrix::TargetId resonanceTarget;
|
ModMatrix::TargetId resonanceTarget;
|
||||||
bool prepared { false };
|
bool prepared { false };
|
||||||
using filterRandomDist = std::uniform_int_distribution<int>;
|
|
||||||
filterRandomDist dist { 0, sfz::Default::filterRandom };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue