Skip to content

Commit

Permalink
Unison Voice Phase Randomization
Browse files Browse the repository at this point in the history
If UniCount > 1 && uniIndex > 0 randomize the starting phase
of an operator
  • Loading branch information
baconpaul committed Dec 29, 2024
1 parent d2f3610 commit 8e05c45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dsp/op_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct alignas(16) OpSource : public EnvelopeSupport<Patch::SourceNode>,
float output alignas(16)[blockSize];

const Patch::SourceNode &sourceNode;
const MonoValues &monoValues;
MonoValues &monoValues;
const VoiceValues &voiceValues;

bool keytrack{true};
Expand Down Expand Up @@ -75,6 +75,10 @@ struct alignas(16) OpSource : public EnvelopeSupport<Patch::SourceNode>,
bindModulation();

phase = 4 << 27;
if (voiceValues.uniCount > 1 && voiceValues.uniIndex > 0)
{
phase += monoValues.rng.unifU32() & ((1<<27)-1);
}
fbVal[0] = 0.f;
fbVal[1] = 0.f;
auto wf = (SinTable::WaveForm)std::round(waveForm);
Expand Down

0 comments on commit 8e05c45

Please sign in to comment.