From: <sag...@us...> - 2011-03-07 14:58:35
|
Revision: 811 http://modplug.svn.sourceforge.net/modplug/?rev=811&view=rev Author: saga-games Date: 2011-03-07 14:58:28 +0000 (Mon, 07 Mar 2011) Log Message: ----------- [Mod] Code should now also compile without having the DirectX SDK installed by defining NO_DSOUND in StdAfx.h (since I have the SDK installed, I cannot tell at the moment if it will actually compile, but it should in theory) Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Stdafx.h trunk/OpenMPT/soundlib/SNDDEVX.H trunk/OpenMPT/soundlib/Snddev.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-03-07 00:51:43 UTC (rev 810) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-03-07 14:58:28 UTC (rev 811) @@ -187,7 +187,11 @@ DWORD CMainFrame::m_nBitsPerSample = 16; DWORD CMainFrame::m_nPreAmp = 128; DWORD CMainFrame::gbLoopSong = TRUE; +#ifndef NO_DSOUND LONG CMainFrame::m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); +#else +LONG CMainFrame::m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); +#endif // NO_DSOUND LONG CMainFrame::m_nMidiDevice = 0; DWORD CMainFrame::m_nBufferLength = 75; LONG CMainFrame::gnLVuMeter = 0; @@ -412,12 +416,16 @@ rgbCustomColors[ncol] = GetPrivateProfileDWord("Display", s, rgbCustomColors[ncol], iniFile); } - DWORD defaultDevice = SNDDEV_DSOUND << 8; // first DirectSound device +#ifndef NO_DSOUND + DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); // first DirectSound device +#else + DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); // first DirectSound device +#endif // NO_DSOUND #ifndef NO_ASIO // If there's an ASIO device available, prefer it over DirectSound if(EnumerateSoundDevices(SNDDEV_ASIO, 0, nullptr, 0)) { - defaultDevice = SNDDEV_ASIO << 8; + defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_ASIO); } #endif // NO_ASIO m_nWaveDevice = GetPrivateProfileLong("Sound Settings", "WaveDevice", defaultDevice, iniFile); @@ -707,6 +715,9 @@ #ifdef NO_ASIO title += " NO_ASIO"; #endif + #ifdef NO_DSOUND + title += " NO_DSOUND"; + #endif SetTitle(title); OnUpdateFrameTitle(false); Modified: trunk/OpenMPT/mptrack/Stdafx.h =================================================================== --- trunk/OpenMPT/mptrack/Stdafx.h 2011-03-07 00:51:43 UTC (rev 810) +++ trunk/OpenMPT/mptrack/Stdafx.h 2011-03-07 14:58:28 UTC (rev 811) @@ -88,7 +88,10 @@ // Define to build without MO3 support. //#define NO_MO3_SUPPORT +// Define to build without DirectSound support. +//#define NO_DSOUND + void Log(LPCSTR format,...); #include "typedefs.h" Modified: trunk/OpenMPT/soundlib/SNDDEVX.H =================================================================== --- trunk/OpenMPT/soundlib/SNDDEVX.H 2011-03-07 00:51:43 UTC (rev 810) +++ trunk/OpenMPT/soundlib/SNDDEVX.H 2011-03-07 14:58:28 UTC (rev 811) @@ -2,7 +2,10 @@ #define _SNDDEVX_H_ #include <mmsystem.h> + +#ifndef NO_DSOUND #include <dsound.h> +#endif #ifndef NO_ASIO #include <iasiodrv.h> @@ -50,11 +53,14 @@ static BOOL EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize); }; + //////////////////////////////////////////////////////////////////////////////////// // // DirectSound device // +#ifndef NO_DSOUND + //====================================== class CDSoundDevice: public ISoundDevice //====================================== @@ -89,7 +95,9 @@ static BOOL EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize); }; +#endif // NO_DIRECTSOUND + //////////////////////////////////////////////////////////////////////////////////// // // ASIO device @@ -165,6 +173,7 @@ #endif // NO_ASIO + //////////////////////////////////////////////////////////////////////////////////// #endif // _SNDDEVX_H_ Modified: trunk/OpenMPT/soundlib/Snddev.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snddev.cpp 2011-03-07 00:51:43 UTC (rev 810) +++ trunk/OpenMPT/soundlib/Snddev.cpp 2011-03-07 14:58:28 UTC (rev 811) @@ -253,6 +253,8 @@ // DirectSound device // +#ifndef NO_DSOUND + #ifndef DSBCAPS_GLOBALFOCUS #define DSBCAPS_GLOBALFOCUS 0x8000 #endif @@ -537,7 +539,9 @@ return TRUE; } +#endif // NO_DIRECTSOUND + /////////////////////////////////////////////////////////////////////////////////////// // // ASIO Device implementation @@ -1378,10 +1382,12 @@ switch(nType) { case SNDDEV_WAVEOUT: return CWaveDevice::EnumerateDevices(nIndex, pszDesc, cbSize); +#ifndef NO_DSOUND case SNDDEV_DSOUND: return CDSoundDevice::EnumerateDevices(nIndex, pszDesc, cbSize); +#endif // NO_DIRECTSOUND #ifndef NO_ASIO case SNDDEV_ASIO: return CASIODevice::EnumerateDevices(nIndex, pszDesc, cbSize); -#endif +#endif // NO_ASIO } return FALSE; } @@ -1394,10 +1400,12 @@ switch(nType) { case SNDDEV_WAVEOUT: *ppsd = new CWaveDevice(); break; +#ifndef NO_DSOUND case SNDDEV_DSOUND: *ppsd = new CDSoundDevice(); break; +#endif // NO_DIRECTSOUND #ifndef NO_ASIO case SNDDEV_ASIO: *ppsd = new CASIODevice(); break; -#endif +#endif // NO_ASIO } return (*ppsd) ? TRUE : FALSE; } @@ -1406,12 +1414,14 @@ BOOL SndDevInitialize() //--------------------- { +#ifndef NO_DSOUND if (ghDSoundDLL) return TRUE; if ((ghDSoundDLL = LoadLibrary("dsound.dll")) == NULL) return FALSE; static_assert(sizeof(TCHAR) == 1, "Check DirectSoundEnumerateA below"); if ((gpDSoundEnumerate = (LPDSOUNDENUMERATE)GetProcAddress(ghDSoundDLL, "DirectSoundEnumerateA")) == NULL) return FALSE; if ((gpDSoundCreate = (LPDSOUNDCREATE)GetProcAddress(ghDSoundDLL, "DirectSoundCreate")) == NULL) return FALSE; RtlZeroMemory(glpDSoundGUID, sizeof(glpDSoundGUID)); +#endif // NO_DIRECTSOUND return TRUE; } @@ -1419,6 +1429,7 @@ BOOL SndDevUninitialize() //----------------------- { +#ifndef NO_DSOUND gpDSoundEnumerate = NULL; gpDSoundCreate = NULL; if (ghDSoundDLL) @@ -1436,6 +1447,7 @@ } gbDSoundEnumerated = FALSE; gnDSoundDevices = 0; +#endif // NO_DIRECTSOUND return TRUE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |