fix #290323: synthesizer state duplicated when changing score with saved state

This commit is contained in:
James Thistlewood 2019-07-07 10:36:28 +01:00
parent c9981c5d2a
commit c9f84a4f5c

View file

@ -42,6 +42,7 @@ void SynthesizerState::write(XmlWriter& xml, bool force /* = false */) const
void SynthesizerState::read(XmlReader& e)
{
std::list<SynthesizerGroup> tempGroups;
while (e.readNextStartElement()) {
SynthesizerGroup group;
group.setName(e.name().toString());
@ -54,7 +55,12 @@ void SynthesizerState::read(XmlReader& e)
else
e.unknown();
}
push_back(group);
tempGroups.push_back(group);
}
if (!tempGroups.empty()) {
// Replace any previously set state if we have read a new state
swap(tempGroups);
setIsDefault(false);
}
}
@ -128,7 +134,7 @@ int SynthesizerState::ccToUse() const
if (method == 0) // velocity only
return -1;
return cc;
return cc;
}
//---------------------------------------------------------