This commit is contained in:
michalcourson
2025-11-04 20:13:19 -05:00
parent f5245eb557
commit cf0498a121
5 changed files with 28 additions and 4 deletions

View File

@ -205,12 +205,12 @@ void Shifter::AddInterpolatedFrame(int voice, int max_index, float resampling_pe
float value = ((1 - interp) * in_buffer[(int)f_index] + (interp)*in_buffer[(int)(f_index + 1) % 8192]) * mult;
if(voice >= MAX_VOICES) {
//value *= volume;
out_buffer[0][out_index] += value;
out_buffer[1][out_index] += value;
out_buffer[0][out_index] += value * melody_mix;
out_buffer[1][out_index] += value * melody_mix;
} else {
value *= voices[voice].CurrentAmplitude() * volume;
out_buffer[0][out_index] += value * voices[voice].GetPanning(0);
out_buffer[1][out_index] += value * voices[voice].GetPanning(1);
out_buffer[0][out_index] += value * voices[voice].GetPanning(0) * harmony_mix;
out_buffer[1][out_index] += value * voices[voice].GetPanning(1) * harmony_mix;
}
@ -307,4 +307,15 @@ void Shifter::RemoveMidiNote(int note) {
voices[i].Release();
}
}
}
void Shifter::SetHarmonyMix(float mix) {
if (mix < .5) {
melody_mix = 1.0f;
harmony_mix = mix * 2.0f;
}
else {
harmony_mix = 1.0f;
melody_mix = (1.0f - mix) * 2.0f;
}
}