Merge pull request #452 from jpcima/fil-random
Make all the random opcodes bipolar
This commit is contained in:
commit
cf90794dab
6 changed files with 9 additions and 11 deletions
|
|
@ -160,7 +160,7 @@ namespace Default
|
|||
constexpr float filterGain { 0 };
|
||||
constexpr int filterKeytrack { 0 };
|
||||
constexpr uint8_t filterKeycenter { 60 };
|
||||
constexpr int filterRandom { 0 };
|
||||
constexpr float filterRandom { 0 };
|
||||
constexpr int filterVeltrack { 0 };
|
||||
constexpr float filterCutoffCC { 0 };
|
||||
constexpr float filterResonanceCC { 0 };
|
||||
|
|
@ -170,7 +170,7 @@ namespace Default
|
|||
constexpr Range<float> filterGainRange { -96.0f, 96.0f };
|
||||
constexpr Range<float> filterGainModRange { -96.0f, 96.0f };
|
||||
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<float> filterResonanceRange { 0.0f, 96.0f };
|
||||
constexpr Range<float> filterResonanceModRange { 0.0f, 96.0f };
|
||||
|
|
@ -199,8 +199,8 @@ namespace Default
|
|||
constexpr uint8_t pitchKeycenter { 60 };
|
||||
constexpr int pitchKeytrack { 100 };
|
||||
constexpr Range<int> pitchKeytrackRange { -1200, 1200 };
|
||||
constexpr int pitchRandom { 0 };
|
||||
constexpr Range<int> pitchRandomRange { 0, 9600 };
|
||||
constexpr float pitchRandom { 0 };
|
||||
constexpr Range<float> pitchRandomRange { 0, 9600 };
|
||||
constexpr int pitchVeltrack { 0 };
|
||||
constexpr Range<int> pitchVeltrackRange { -9600, 9600 };
|
||||
constexpr int transpose { 0 };
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct FilterDescription
|
|||
int keytrack { Default::filterKeytrack };
|
||||
uint8_t keycenter { Default::filterKeycenter };
|
||||
int veltrack { Default::filterVeltrack };
|
||||
int random { Default::filterRandom };
|
||||
float random { Default::filterRandom };
|
||||
FilterType type { FilterType::kFilterLpf2p };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ void sfz::FilterHolder::setup(const Region& region, unsigned filterId, int noteN
|
|||
// Setup the base values
|
||||
baseCutoff = description->cutoff;
|
||||
if (description->random != 0) {
|
||||
dist.param(filterRandomDist::param_type(0, description->random));
|
||||
baseCutoff *= centsFactor(dist(Random::randomGenerator));
|
||||
fast_real_distribution<float> dist { -description->random, description->random };
|
||||
baseCutoff *= centsFactor(dist(Random::randomGenerator));
|
||||
}
|
||||
const auto keytrack = description->keytrack * (noteNumber - description->keycenter);
|
||||
baseCutoff *= centsFactor(keytrack);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,6 @@ private:
|
|||
ModMatrix::TargetId cutoffTarget;
|
||||
ModMatrix::TargetId resonanceTarget;
|
||||
bool prepared { false };
|
||||
using filterRandomDist = std::uniform_int_distribution<int>;
|
||||
filterRandomDist dist { 0, sfz::Default::filterRandom };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1714,7 +1714,7 @@ float sfz::Region::getBasePitchVariation(float noteNumber, float velocity) const
|
|||
{
|
||||
ASSERT(velocity >= 0.0f && velocity <= 1.0f);
|
||||
|
||||
std::uniform_int_distribution<int> pitchDistribution { -pitchRandom, pitchRandom };
|
||||
fast_real_distribution<float> pitchDistribution { -pitchRandom, pitchRandom };
|
||||
auto pitchVariationInCents = pitchKeytrack * (noteNumber - pitchKeycenter); // note difference with pitch center
|
||||
pitchVariationInCents += tune; // sample tuning
|
||||
pitchVariationInCents += config::centPerSemitone * transpose; // sample transpose
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ struct Region {
|
|||
uint8_t pitchKeycenter { Default::pitchKeycenter }; // pitch_keycenter
|
||||
bool pitchKeycenterFromSample { false };
|
||||
int pitchKeytrack { Default::pitchKeytrack }; // pitch_keytrack
|
||||
int pitchRandom { Default::pitchRandom }; // pitch_random
|
||||
float pitchRandom { Default::pitchRandom }; // pitch_random
|
||||
int pitchVeltrack { Default::pitchVeltrack }; // pitch_veltrack
|
||||
int transpose { Default::transpose }; // transpose
|
||||
int tune { Default::tune }; // tune
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue