Also make pitch_random real-valued

This commit is contained in:
Jean Pierre Cimalando 2020-09-27 15:35:46 +02:00
parent 283a7a39c7
commit afc0b3fc56
3 changed files with 4 additions and 4 deletions

View file

@ -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 };

View file

@ -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

View file

@ -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