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

Projects
6 participants
@BaraMGB
Contributor

BaraMGB commented Jun 1, 2017

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

@BaraMGB BaraMGB added this to the 1.2.0 milestone Jun 1, 2017

@PhysSong

This comment has been minimized.

Show comment
Hide comment
@PhysSong

PhysSong Jun 2, 2017

Member

Tested. It works well.

Member

PhysSong commented Jun 2, 2017

Tested. It works well.

@Umcaruje

This comment has been minimized.

Show comment
Hide comment
@Umcaruje

Umcaruje Jun 3, 2017

Member

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

Tested it out, works like a charm

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

This comment has been minimized.

Show comment
Hide comment
@BaraMGB

BaraMGB Jun 3, 2017

Contributor

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

Contributor

BaraMGB commented Jun 3, 2017

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

@zonkmachine

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

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;
	}
@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 (#3597)
* fixes rounding issue in automatablemodel

* fix CRS knob sticking in instrument plugins
@tresf

This comment has been minimized.

Show comment
Hide comment
@tresf

tresf Jun 9, 2017

Member

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

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 added a commit to PhysSong/lmms that referenced this pull request Jul 8, 2017

fixes rounding issue in automatablemodel (#3597)
* 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 (#3597)
* 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