From: <rel...@us...> - 2011-01-23 21:32:29
|
Revision: 790 http://modplug.svn.sourceforge.net/modplug/?rev=790&view=rev Author: relabsoluness Date: 2011-01-23 21:32:23 +0000 (Sun, 23 Jan 2011) Log Message: ----------- [Fix] DSL loader: Fix to code level bug in instrument loading. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-16 21:41:10 UTC (rev 789) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-23 21:32:23 UTC (rev 790) @@ -254,12 +254,15 @@ if (dwKey < 0x80) nDrumRgn = pEmbeddedBank->GetRegionFromKey(nDlsIns, dwKey); if (pEmbeddedBank->ExtractInstrument(&m_SndFile, nIns, nDlsIns, nDrumRgn)) { + pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value. if ((dwKey >= 24) && (dwKey < 100)) { lstrcpyn(pIns->name, szMidiPercussionNames[dwKey-24], sizeof(pIns->name)); } bEmbedded = TRUE; } + else + pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value. } } if ((pszMidiMapName) && (pszMidiMapName[0]) && (!bEmbedded)) @@ -293,6 +296,7 @@ { if (dwKey < 0x80) nDrumRgn = pDLSBank->GetRegionFromKey(nDlsIns, dwKey); pDLSBank->ExtractInstrument(&m_SndFile, nIns, nDlsIns, nDrumRgn); + pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value. if ((dwKey >= 24) && (dwKey < 24+61)) { lstrcpyn(pIns->name, szMidiPercussionNames[dwKey-24], sizeof(pIns->name)); Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-01-16 21:41:10 UTC (rev 789) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-01-23 21:32:23 UTC (rev 790) @@ -1641,7 +1641,7 @@ #endif pIns = new MODINSTRUMENT; if (!pIns) return FALSE; - memset(pIns, 0, sizeof(MODINSTRUMENT)); + MemsetZero(*pIns); pIns->pTuning = pIns->s_DefaultTuning; if (pSndFile->Instruments[nInstr]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |