Skip to content

Commit

Permalink
Merged revision(s) 21596, 21612 from trunk/OpenMPT:
Browse files Browse the repository at this point in the history
[Fix] Song Cleanup: Allow plugins only referenced by to-be-removed channels to be removed as well.
........
[Fix] MID: Loading samples when using MIDI + accompanying soundfont file was broken since r21370 (https://bugs.openmpt.org/view.php?id=1817).
........


git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.31@21633 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Sep 19, 2024
1 parent af981db commit de192fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions mptrack/CleanupSong.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ void CModCleanupDlg::OnOK()
if(m_CheckBoxes[kRearrangeSamples]) modified |= RearrangeSamples();
}

// Plugins
if(m_CheckBoxes[kRemoveAllPlugins]) modified |= RemoveAllPlugins();
if(m_CheckBoxes[kCleanupPlugins]) modified |= RemoveUnusedPlugins();

// Create samplepack
if(m_CheckBoxes[kResetVariables]) modified |= ResetVariables();

// Remove unused channels
if(m_CheckBoxes[kCleanupChannels]) modified |= RemoveUnusedChannels();

// Plugins (done last because they can be referenced by both instruments and channels)
if(m_CheckBoxes[kRemoveAllPlugins]) modified |= RemoveAllPlugins();
if(m_CheckBoxes[kCleanupPlugins]) modified |= RemoveUnusedPlugins();

if(modified) modDoc.SetModified();
modDoc.UpdateAllViews(nullptr, UpdateHint().ModType());
logcapturer.ShowLog(true);
Expand Down
4 changes: 3 additions & 1 deletion soundlib/Load_mid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,12 +1320,14 @@ bool CSoundFile::ReadMID(FileReader &file, ModLoadingFlags loadFlags)
}

std::unique_ptr<CDLSBank> cachedBank, embeddedBank;
FileReader *bankFile = nullptr;

if(CDLSBank::IsDLSBank(file))
{
// Soundfont embedded in MIDI file
embeddedBank = std::make_unique<CDLSBank>();
embeddedBank->Open(file);
bankFile = &file;
} else
{
// Soundfont with same name as MIDI file
Expand Down Expand Up @@ -1353,7 +1355,7 @@ bool CSoundFile::ReadMID(FileReader &file, ModLoadingFlags loadFlags)
else if(pIns->nMidiProgram)
midiCode = (pIns->nMidiProgram - 1) & 0x7F;

if(embeddedBank && embeddedBank->FindAndExtract(*this, ins, midiCode >= 0x80, &file))
if(embeddedBank && embeddedBank->FindAndExtract(*this, ins, midiCode >= 0x80, bankFile))
{
continue;
}
Expand Down

0 comments on commit de192fe

Please sign in to comment.