Skip to content

Commit

Permalink
Step adjust parameter values only for down/up buttons
Browse files Browse the repository at this point in the history
Before any parameter value was adjusted to a multiple of the step
setting for this parameter. Now is not the case any more for values,
which are entered using the screen keyboard or MIDI CC.
  • Loading branch information
rsta2 committed Jun 28, 2021
1 parent 6eab8c8 commit 77fc72e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void CParameter::Set (unsigned nValue)
boolean CParameter::Down (void)
{
unsigned nNewValue = m_nValue - m_nStep;
nNewValue = (nNewValue + m_nStep-1) / m_nStep * m_nStep;
if (m_nMinimum <= nNewValue && nNewValue <= m_nMaximum)
{
m_nValue = nNewValue;
Expand All @@ -88,6 +89,7 @@ boolean CParameter::Down (void)
boolean CParameter::Up (void)
{
unsigned nNewValue = m_nValue + m_nStep;
nNewValue = nNewValue / m_nStep * m_nStep;
if (m_nMinimum <= nNewValue && nNewValue <= m_nMaximum)
{
m_nValue = nNewValue;
Expand Down Expand Up @@ -201,7 +203,5 @@ void CParameter::SetEditString (const char *pString)
}
}

ulValue = (ulValue + m_nStep/2) / m_nStep * m_nStep;

Set ((unsigned) ulValue);
}
4 changes: 0 additions & 4 deletions src/patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ void CPatch::SetMIDIParameter (TSynthParameter Parameter, u8 ucValue)
nValue = (nValue + 63) / 127;
nValue += ParameterList[Parameter].nMinimum;

nValue = (nValue + ParameterList[Parameter].nStep/2)
/ ParameterList[Parameter].nStep
* ParameterList[Parameter].nStep;

if (nValue < ParameterList[Parameter].nMinimum)
{
nValue = ParameterList[Parameter].nMinimum;
Expand Down

0 comments on commit 77fc72e

Please sign in to comment.