Skip to content

Conversation

@BaraMGB
Copy link
Contributor

@BaraMGB BaraMGB commented Jun 1, 2017

@BaraMGB BaraMGB added this to the 1.2.0 milestone Jun 1, 2017
@PhysSong
Copy link
Member

PhysSong commented Jun 2, 2017

Tested. It works well.

@Umcaruje
Copy link
Member

Umcaruje commented Jun 3, 2017

Can you adress @zapashcanon's comment from here too: #3075 (comment)

Tested it out, works like a charm

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Jun 3, 2017

@Umcaruje yes, I noticed it. I'll change that line. 👍

Copy link
Contributor

@zonkmachine zonkmachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the last commit and it clears up the earlier stickyness. The code looks much better.

@BaraMGB BaraMGB merged commit 5a2d8f1 into LMMS:stable-1.2 Jun 9, 2017
if( qAbs( value ) >= step )
{
float roundedValue = static_cast<float>( static_cast<int>( ( oldValue - value ) / step + 0.5 ) ) * step;
float roundedValue = qRound( ( oldValue - value ) / step ) * step;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this code:

		if( qAbs( value ) >= step )
		{
			float roundedValue = qRound( ( oldValue - value ) / step ) * step;
			model()->setValue( roundedValue );
			m_leftOver = 0.0f;
		}
		else
		{
			m_leftOver = value;
		}

is duplicated, maybe something like:

	float consideredValue = value; // linear code

	if( model()->isScaleLogarithmic() ) // logarithmic code
	{
		const float pos = model()->minValue() < 0
			? oldValue / qMax( qAbs( model()->maxValue() ), qAbs( model()->minValue() ) )
			: ( oldValue - model()->minValue() ) / model()->range();
		const float ratio = 0.1f + qAbs( pos ) * 15.f;
		consideredValue = value * ratio;
	}

	if( qAbs( consideredValue ) >= step )
	{
		float roundedValue = qRound( ( oldValue - value ) / step ) * step;
		model()->setValue( roundedValue );
		m_leftOver = 0.0f;
	}
	else
	{
		m_leftOver = value;
	}

tresf pushed a commit to liushuyu/lmms that referenced this pull request Jun 9, 2017
* fixes rounding issue in automatablemodel

* fix CRS knob sticking in instrument plugins
@tresf
Copy link
Member

tresf commented Jun 9, 2017

Cherry-picked to master via 902493b. Please target non-essential code cleanup at the master branch, once this fix is merged in.

PhysSong pushed a commit to PhysSong/lmms that referenced this pull request Jul 8, 2017
* fixes rounding issue in automatablemodel

* fix CRS knob sticking in instrument plugins
PhysSong pushed a commit to PhysSong/lmms that referenced this pull request Jul 8, 2017
* fixes rounding issue in automatablemodel

* fix CRS knob sticking in instrument plugins
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
* fixes rounding issue in automatablemodel

* fix CRS knob sticking in instrument plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants