Skip to content

Conversation

@BaraMGB
Copy link
Contributor

@BaraMGB BaraMGB commented Mar 19, 2017

fixes #2869

the problem:

Here's what happens:

  1. LMMS loads the FX Mixer from the file. Because the Peak Controller is a mix between an FX and a controller it gets loaded as an FX when the mixer "FX 1" is restored. In PeakControllerEffect::PeakControllerEffect the Peak Controller is added to the list of controllers by calling Engine::getSong()->addController( m_autoController ). Because no controllers have been loaded yet the Peak Controller is now the first controller in the list.
  2. LMMS loads the controllers and adds them via Song::addController. For each controller this method checks whether the controller is already contained in the list and only adds it if it's not:
    • The LFO controller is loaded first from the file. It is added because it is not contained in the list of controllers.
    • The Peak Controller is now also loaded from the file. It is not added because it is already contained in the list of controllers as it was added during the load of the FX chains.

What I did:

On adding a controller it checks if the controller is in the list. If so it removes the controller from the list and appends it again. So it is in the right order.

if( controller )
	{
		if( m_controllers.contains( controller ) )
		{
			int index = m_controllers.indexOf( controller );
			if( index != -1 )
			{
				m_controllers.remove( index );
				emit controllerRemoved( controller );
			}
		}
		m_controllers.append( controller );
		emit controllerAdded( controller );

		this->setModified();
	}

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Mar 19, 2017

@zonkmachine
Copy link
Contributor

Tested, works! I've tested complex patterns, both saved from 1.1.3, master and this PR and they now open up correctly.

@jasp00
Copy link
Member

jasp00 commented Mar 20, 2017

The patch is incorrect. It changes the meaning of addController(). The (understandable) bug is PeakControllerEffect's fault. The constructor should check Engine::getSong()->isLoadingProject().

@BaraMGB
Copy link
Contributor Author

BaraMGB commented Mar 20, 2017

@jasp00 thank you.

@jasp00 jasp00 merged commit 17a6f37 into LMMS:master Mar 20, 2017
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
* fixes the wrong order of controller by loading a project

* changes the approach for the fix
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.

3 participants