mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-06 15:18:09 -05:00
Fix most of the track cloning for MIDI ports (#7066)
Fixes most of the problem that the MIDI port information is not cloned when a track is cloned. The bug was caused because cloning is implemented via serialization and deserialization of the Track. The previous code only serialized the MIDI port if `Engine::getSong()->isSavingProject()` is true. However, when we are cloning the statement will be `false` because we are not saving the song. Therefore the MIDI port's state was not saved and the clone was initialized with the default values. The fix is to serialize the MIDI port in the following cases: * We are not in song saving mode, i.e. we are in the state that this issue is about, e.g. cloning. * We save a song and the MIDI connections are not discarded. Using boolean algebra these conditions can be simplified as seen in the changed statement.
This commit is contained in:
committed by
GitHub
parent
3343496c00
commit
1e6a902dd3
@@ -859,9 +859,11 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement
|
||||
m_noteStacking.saveState( doc, thisElement );
|
||||
m_arpeggio.saveState( doc, thisElement );
|
||||
|
||||
// Don't save midi port info if the user chose to.
|
||||
if (Engine::getSong()->isSavingProject()
|
||||
&& !Engine::getSong()->getSaveOptions().discardMIDIConnections.value())
|
||||
// Save the midi port info if we are not in song saving mode, e.g. in
|
||||
// track cloning mode or if we are in song saving mode and the user
|
||||
// has chosen to discard the MIDI connections.
|
||||
if (!Engine::getSong()->isSavingProject() ||
|
||||
!Engine::getSong()->getSaveOptions().discardMIDIConnections.value())
|
||||
{
|
||||
// Don't save auto assigned midi device connection
|
||||
bool hasAuto = m_hasAutoMidiDev;
|
||||
|
||||
Reference in New Issue
Block a user