From: <sag...@us...> - 2011-07-02 12:28:58
|
Revision: 913 http://modplug.svn.sourceforge.net/modplug/?rev=913&view=rev Author: saga-games Date: 2011-07-02 12:28:51 +0000 (Sat, 02 Jul 2011) Log Message: ----------- [Fix] Hopefully the final fix for ACM MP3 export... Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-01 20:15:53 UTC (rev 912) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-02 12:28:51 UTC (rev 913) @@ -81,7 +81,7 @@ } m_dwFileLimit = 0; m_dwSongLimit = 0; - memset(&WaveFormat, 0, sizeof(WaveFormat)); + MemsetZero(WaveFormat); WaveFormat.Format.wFormatTag = WAVE_FORMAT_PCM; WaveFormat.Format.nChannels = 2; WaveFormat.Format.nSamplesPerSec = 44100; @@ -359,8 +359,8 @@ m_bDriversEnumerated = FALSE; m_nNumFormats = 0; m_nNumDrivers = 0; - memset(&afd, 0, sizeof(afd)); - memset(pwfx, 0, sizeof(wfx)); + MemsetZero(afd); + MemsetZero(*pwfx); afd.cbStruct = sizeof(ACMFORMATDETAILS); afd.dwFormatTag = WAVE_FORMAT_PCM; afd.pwfx = pwfx; @@ -401,8 +401,8 @@ m_nDriverIndex = m_CbnDriver.GetItemData(m_CbnDriver.GetCurSel()); m_bInitialFound = FALSE; if (m_nDriverIndex >= m_nNumDrivers) m_nDriverIndex = 0; - memset(&afd, 0, sizeof(afd)); - memset(wfx, 0, sizeof(wfx)); + MemsetZero(afd); + MemsetZero(wfx); afd.cbStruct = sizeof(ACMFORMATDETAILS); afd.dwFormatTag = WAVE_FORMAT_PCM; afd.pwfx = pwfx; @@ -452,7 +452,7 @@ { if (Drivers[i] == hdid) return TRUE; } - memset(&add, 0, sizeof(add)); + MemsetZero(add); add.cbStruct = sizeof(add); if (theApp.AcmDriverDetails(hdid, &add, 0L) == MMSYSERR_NOERROR) { @@ -993,9 +993,9 @@ // Open the ACM Driver if (theApp.AcmDriverOpen(&hADriver, m_hadid, 0L) != MMSYSERR_NOERROR) goto OnError; if (theApp.AcmStreamOpen(&hAStream, hADriver, &wfxSrc, m_pwfx, NULL, 0L, 0L, ACM_STREAMOPENF_NONREALTIME) != MMSYSERR_NOERROR) goto OnError; - // Next call is useless for BLADEenc/LAMEenc. Is it required for ACM codecs? + // This call is useless for BLADEenc/LAMEenc, but required for ACM codecs! if (theApp.AcmStreamSize(hAStream, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_SOURCE) != MMSYSERR_NOERROR) goto OnError; - ASSERT(dwDstBufSize <= WAVECONVERTBUFSIZE); + // This call is useless for ACM, but required for BLADEenc/LAMEenc codecs! if (theApp.AcmStreamSize(hAStream, WAVECONVERTBUFSIZE, &dwDstBufSize, ACM_STREAMSIZEF_DESTINATION) != MMSYSERR_NOERROR) goto OnError; //if (dwDstBufSize > 0x10000) dwDstBufSize = 0x10000; pcmBuffer = new BYTE[WAVECONVERTBUFSIZE]; Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-01 20:15:53 UTC (rev 912) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-02 12:28:51 UTC (rev 913) @@ -807,7 +807,7 @@ //m_hAlternateResourceHandle = LoadLibrary("mpt_intl.dll"); - memset(&gMemStatus, 0, sizeof(gMemStatus)); + MemsetZero(gMemStatus); GlobalMemoryStatus(&gMemStatus); #if 0 Log("Physical: %lu\n", gMemStatus.dwTotalPhys); @@ -2075,7 +2075,7 @@ // & release builds when ran directly from vs.net m_pTextDib = lpTextDib; - memset(&m_Dib, 0, sizeof(m_Dib)); + MemsetZero(m_Dib); m_nTextColor = 0; m_nBkColor = 1; m_Dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -2743,6 +2743,8 @@ } if (m_hACMInst) { + if (fdwSize & ACM_STREAMSIZEF_DESTINATION) // Why does acmStreamSize return ACMERR_NOTPOSSIBLE in this case? + return MMSYSERR_NOERROR; PFNACMSTREAMSIZE pfnAcmStreamSize = (PFNACMSTREAMSIZE)GetProcAddress(m_hACMInst, "acmStreamSize"); if (pfnAcmStreamSize) return pfnAcmStreamSize(has, cbInput, pdwOutputBytes, fdwSize); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |