Clamp volume envelopes between 0.0f and 1.0f

This commit is contained in:
furo 2023-12-18 18:35:13 +01:00
parent 4ddf1dfdd5
commit fd2582c267
2 changed files with 3 additions and 3 deletions

View file

@ -6918,7 +6918,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
s_vAccurateDragValuesY[k] -= DeltaY;
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = std::round(s_vAccurateDragValuesY[k]);
if(pEnvelope->GetChannels() == 4)
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
{
pEnvelope->m_vPoints[i].m_aValues[c] = clamp(pEnvelope->m_vPoints[i].m_aValues[c], 0, 1024);
s_vAccurateDragValuesY[k] = clamp<float>(s_vAccurateDragValuesY[k], 0, 1024);
@ -7383,7 +7383,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
else
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = std::round(s_vInitialPositionsY[k] * s_ScaleFactorY);
if(pEnvelope->GetChannels() == 4)
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = clamp(pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel], 0, 1024);
}
}

View file

@ -1534,7 +1534,7 @@ void CEditorActionEditEnvelopePointValue::Apply(bool Undo)
}
else
{
if(pEnvelope->GetChannels() == 4)
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
CurrentValue = clamp(CurrentValue, 0.0f, 1.0f);
pEnvelope->m_vPoints[m_PtIndex].m_aValues[m_Channel] = f2fx(CurrentValue);