Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes rounding issue in automatablemodel #3597

Merged
merged 2 commits into from Jun 9, 2017

Conversation

@BaraMGB
Copy link
Contributor

@BaraMGB BaraMGB commented Jun 1, 2017

fixes #3075 (comment), #3661, #3659

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

@PhysSong PhysSong commented Jun 2, 2017

Tested. It works well.

@Umcaruje
Copy link
Member

@Umcaruje 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 BaraMGB commented Jun 3, 2017

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

Copy link
Member

@zonkmachine zonkmachine left a comment

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
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@zonkmachine zonkmachine moved this from In Progress to Done in Release 1.2.0 RC4 Jun 9, 2017
@@ -749,7 +748,7 @@ void Knob::setPosition( const QPoint & _p )
{
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;

This comment has been minimized.

@zapashcanon

zapashcanon Jun 9, 2017
Contributor

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 added 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 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 added 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 added 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.