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

fix #290121: changes to non-expr patches aren't saved #5094

Merged
merged 1 commit into from
Jun 15, 2019

Conversation

jthistle
Copy link
Contributor

@jthistle jthistle commented Jun 2, 2019

@Jojo-Schmitz
Copy link
Contributor

some mtests are not happy

@jthistle jthistle force-pushed the 290121-patch-changes-not-saved branch 2 times, most recently from 29e5716 to 1f43fa0 Compare June 3, 2019 20:22
@Jojo-Schmitz
Copy link
Contributor

Better than before, but still an mtest failure, see https://travis-ci.org/musescore/MuseScore/jobs/540934522#L4243-L4264

@jthistle jthistle force-pushed the 290121-patch-changes-not-saved branch from 1f43fa0 to 7ba87e1 Compare June 4, 2019 15:26
@jthistle
Copy link
Contributor Author

jthistle commented Jun 4, 2019

Should all be fixed now :)

@jthistle jthistle force-pushed the 290121-patch-changes-not-saved branch from 7ba87e1 to f3d0443 Compare June 4, 2019 17:43
if (e.dataA() == CTRL_HBANK && e.dataB() == 0)
continue;
if (e.dataA() == CTRL_LBANK && e.dataB() == 0)
if (e.dataA() == CTRL_LBANK && e.dataB() == 0 && !_userBankController)
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this part of the patch (the changes inside if (e.type() == ME_CONTROLLER)) is not really necessary to fix the issue and causes those extra <controller> tags to appear. At least in my tests the scenario from the issue 290121 works correctly without changing this part of the code. Are there any reasons why this change might be necessary to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a reworking of the initial statement, I guess, with the added check for if it is 0 or not. I think it should be alright without these changes then... but I'd need to test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No hang on, we always want to write the bank controller if it was set by the user, even if the data is 0, so that if it's set to 0 from a number of 1, say, it's not automatically switched back to 1 when its read (since if a bank value is read from the file, then we don't automatically switch to expressive patches). So, this line is correct and should stay as it is.

The old line doesn't account for this since if the bank is 0, then it won't be written, even if the user has changed it to that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then it does not agree with the other part of this patch. If you explicitly write only one of HBANK or LBANK controllers, the value of the other will be 0 by default, and _userBankController flag will be set to true, so the effect will be essentially the same. If you explicitly write both of them and their value is 0, then _userBankController flag will be anyway reset to false. So, if I am correct, there are no situations where writing zero values for those controllers makes any difference to the result being obtained on file reading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... it's worth noting that that other part of the patch is just a slightly hacky fix to get SND working with 114 import. But yes, I think you might be right. I'll change it back.

Copy link
Contributor Author

@jthistle jthistle Jun 13, 2019

Choose a reason for hiding this comment

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

Ok, testing it, it actually is important to have it the way it is. With your proposed changes:

  1. create a score with an expressive instrument
  2. change it to the non expr version in the mixer
  3. save and close
  4. reopen the file
  5. it's changed back to the expr version.

This happens for the reasons above:

we always want to write the bank controller if it was set by the user, even if the data is 0, so that if it's set to 0 from a number of 1, say, it's not automatically switched back to 1 when its read (since if a bank value is read from the file, then we don't automatically switch to expressive patches

Hope that makes sense, I realise I'm not explaining it the best. tl;dr: it should stay as is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I didn't notice that chunk of code actually belongs to read114. Sorry then, it turns out there is no contradiction here indeed, we indeed are better to write those tags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's fine, it's a really confusing area of the codebase unfortunately. Thanks for merging :)

@dmitrio95 dmitrio95 merged commit 1e49b31 into musescore:master Jun 15, 2019
@Jojo-Schmitz Jojo-Schmitz mentioned this pull request Jun 24, 2019
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.

None yet

3 participants