From: <man...@us...> - 2015-05-26 10:50:49
|
Revision: 5191 http://sourceforge.net/p/modplug/code/5191 Author: manxorist Date: 2015-05-26 10:50:41 +0000 (Tue, 26 May 2015) Log Message: ----------- [Ref] Add new build macro MPT_BUILD_WINESUPPORT (there is no build system yet that makes any use of this). [Ref] Make common/ and sounddev/ compile in MODPLUG_TRACKER && MPT_BUILD_WINESUPPORT mode on non-Windows platforms. This boils mostly down to adding a couple of #if MPT_OS_WINDOWS around Windows-only code. Non-Windows versions can be added later on when actually required. There should be no changes to MODPLUG_TRACKER or libopenmpt builds. Modified Paths: -------------- trunk/OpenMPT/common/AudioCriticalSection.cpp trunk/OpenMPT/common/AudioCriticalSection.h trunk/OpenMPT/common/ComponentManager.cpp trunk/OpenMPT/common/ComponentManager.h trunk/OpenMPT/common/Logging.cpp trunk/OpenMPT/common/Logging.h trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/common/mptFileIO.cpp trunk/OpenMPT/common/mptFileIO.h trunk/OpenMPT/common/mptPathString.cpp trunk/OpenMPT/common/mptPathString.h trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/sounddev/SoundDeviceBase.h trunk/OpenMPT/sounddev/SoundDeviceManager.cpp trunk/OpenMPT/sounddev/SoundDeviceManager.h trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDeviceUtilities.cpp trunk/OpenMPT/sounddev/SoundDeviceUtilities.h trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp trunk/OpenMPT/sounddev/SoundDeviceWaveout.h trunk/OpenMPT/soundlib/SampleFormatConverters.h Modified: trunk/OpenMPT/common/AudioCriticalSection.cpp =================================================================== --- trunk/OpenMPT/common/AudioCriticalSection.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/AudioCriticalSection.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -13,7 +13,7 @@ OPENMPT_NAMESPACE_BEGIN -#ifdef MODPLUG_TRACKER +#if defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT) CRITICAL_SECTION g_csAudio; int g_csAudioLockCount = 0; #else Modified: trunk/OpenMPT/common/AudioCriticalSection.h =================================================================== --- trunk/OpenMPT/common/AudioCriticalSection.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/AudioCriticalSection.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -11,7 +11,7 @@ OPENMPT_NAMESPACE_BEGIN -#ifdef MODPLUG_TRACKER +#if defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT) extern CRITICAL_SECTION g_csAudio; extern int g_csAudioLockCount; @@ -93,7 +93,6 @@ void Enter() {} void Leave() {} ~CriticalSection() {} - static void AssertUnlocked() {} }; #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/ComponentManager.cpp =================================================================== --- trunk/OpenMPT/common/ComponentManager.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/ComponentManager.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -348,7 +348,7 @@ { TComponentMap::const_iterator it = m_Components.find(componentFactory.GetName()); MPT_SHARED_PTR<IComponent> component = (it != m_Components.end()) ? it->second : componentFactory.Construct(); - ASSERT(component); + MPT_ASSERT(component); InitializeComponent(component); return component; } Modified: trunk/OpenMPT/common/ComponentManager.h =================================================================== --- trunk/OpenMPT/common/ComponentManager.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/ComponentManager.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -21,7 +21,7 @@ #if defined(MPT_WITH_DYNBIND) -#ifdef MODPLUG_TRACKER +#if defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT) #define MPT_COMPONENT_MANAGER 1 #else #define MPT_COMPONENT_MANAGER 0 Modified: trunk/OpenMPT/common/Logging.cpp =================================================================== --- trunk/OpenMPT/common/Logging.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/Logging.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -56,10 +56,12 @@ // remove eol if already present message = mpt::String::RTrim(message, MPT_USTRING("\r\n")); #if defined(MODPLUG_TRACKER) +#if MPT_OS_WINDOWS static uint64 s_lastlogtime = 0; uint64 cur = mpt::Date::ANSI::Now(); uint64 diff = cur/10000 - s_lastlogtime; s_lastlogtime = cur/10000; +#endif #ifdef LOG_TO_FILE { static FILE * s_logfile = nullptr; @@ -70,8 +72,13 @@ if(s_logfile) { fprintf(s_logfile, mpt::ToCharset(mpt::CharsetUTF8, mpt::String::Print(MPT_USTRING("%1+%2 %3(%4): %5 [%6]\n" +#if MPT_OS_WINDOWS , mpt::Date::ANSI::ToString(cur) , mpt::ufmt::dec<6>(diff) +#else + , 0 + , 0 +#endif , mpt::ToUnicode(mpt::CharsetASCII, context.file) , context.line , message @@ -152,6 +159,8 @@ namespace Trace { +#if MPT_OS_WINDOWS + // Debugging functionality will use simple globals. bool volatile g_Enabled = false; @@ -344,6 +353,8 @@ } } +#endif // MPT_OS_WINDOWS + } // namespace Trace #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/Logging.h =================================================================== --- trunk/OpenMPT/common/Logging.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/Logging.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -108,7 +108,7 @@ -#if defined(MODPLUG_TRACKER) +#if defined(MODPLUG_TRACKER) && MPT_OS_WINDOWS namespace Trace { Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/misc_util.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -28,11 +28,10 @@ #if MPT_OS_WINDOWS #include <windows.h> -#endif - #if defined(MODPLUG_TRACKER) #include <mmsystem.h> #endif +#endif OPENMPT_NAMESPACE_BEGIN @@ -112,6 +111,8 @@ #if defined(MODPLUG_TRACKER) +#if MPT_OS_WINDOWS + namespace ANSI { @@ -156,6 +157,8 @@ } // namespace ANSI +#endif // MPT_OS_WINDOWS + #endif // MODPLUG_TRACKER namespace Unix @@ -259,6 +262,8 @@ namespace Util { +#if MPT_OS_WINDOWS + void MultimediaClock::Init() { m_CurrentPeriod = 0; @@ -339,6 +344,8 @@ return (uint64)timeGetTime() * (uint64)1000000; } +#endif // MPT_OS_WINDOWS + } // namespace Util #endif // MODPLUG_TRACKER @@ -464,6 +471,9 @@ { +#if MPT_OS_WINDOWS + + std::wstring CLSIDToString(CLSID clsid) //------------------------------------- { @@ -663,6 +673,9 @@ } +#endif // MPT_OS_WINDOWS + + } // namespace Util #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/misc_util.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -432,6 +432,8 @@ #if defined(MODPLUG_TRACKER) +#if MPT_OS_WINDOWS + namespace ANSI { // uint64 counts 100ns since 1601-01-01T00:00Z @@ -442,6 +444,8 @@ } // namespacee ANSI +#endif // MPT_OS_WINDOWS + #endif // MODPLUG_TRACKER namespace Unix @@ -764,6 +768,8 @@ namespace Util { +#if MPT_OS_WINDOWS + // RAII wrapper around timeBeginPeriod/timeEndPeriod/timeGetTime (on Windows). // This clock is monotonic, even across changing its resolution. // This is needed to synchronize time in Steinberg APIs (ASIO and VST). @@ -797,9 +803,11 @@ uint64 NowNanoseconds() const; }; +#endif // MPT_OS_WINDOWS + } // namespace Util -#endif +#endif // MODPLUG_TRACKER #ifdef ENABLE_ASM #define PROCSUPPORT_MMX 0x00001 // Processor supports MMX instructions @@ -823,6 +831,8 @@ namespace Util { +#if MPT_OS_WINDOWS + // COM CLSID<->string conversion // A CLSID string is not necessarily a standard UUID string, // it might also be a symbolic name for the interface. @@ -864,6 +874,8 @@ // Returns a new unique absolute path. mpt::PathString CreateTempFileName(const mpt::PathString &fileNamePrefix = mpt::PathString(), const mpt::PathString &fileNameExtension = MPT_PATHSTRING("tmp")); +#endif // MPT_OS_WINDOWS + } // namespace Util #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/mptFileIO.cpp =================================================================== --- trunk/OpenMPT/common/mptFileIO.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/mptFileIO.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -96,6 +96,8 @@ #ifdef MODPLUG_TRACKER +#if MPT_OS_WINDOWS + CMappedFile::~CMappedFile() //------------------------- { @@ -220,6 +222,7 @@ return lpStream; } +#endif // MPT_OS_WINDOWS #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/mptFileIO.h =================================================================== --- trunk/OpenMPT/common/mptFileIO.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/mptFileIO.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -514,6 +514,7 @@ #ifdef MODPLUG_TRACKER +#if MPT_OS_WINDOWS //=============== class CMappedFile //=============== @@ -536,6 +537,7 @@ size_t GetLength(); const void *Lock(); }; +#endif // MPT_OS_WINDOWS #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/mptPathString.cpp =================================================================== --- trunk/OpenMPT/common/mptPathString.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/mptPathString.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -35,7 +35,7 @@ #endif // MPT_OS_WINDOWS -#if defined(MODPLUG_TRACKER) +#if defined(MODPLUG_TRACKER) && MPT_OS_WINDOWS namespace mpt { @@ -197,12 +197,12 @@ #endif } -#endif -#endif +#endif // MFC +#endif // MPT_OS_WINDOWS } // namespace mpt -#endif +#endif // MODPLUG_TRACKER && MPT_OS_WINDOWS #if defined(MODPLUG_TRACKER) @@ -299,7 +299,7 @@ str.SetAt(i, SanitizeFilenameChar(str.GetAt(i))); } } -#endif +#endif // MFC #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/mptPathString.h =================================================================== --- trunk/OpenMPT/common/mptPathString.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/mptPathString.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -88,7 +88,7 @@ public: -#if defined(MODPLUG_TRACKER) +#if defined(MODPLUG_TRACKER) && MPT_OS_WINDOWS void SplitPath(PathString *drive, PathString *dir, PathString *fname, PathString *ext) const; PathString GetDrive() const; // Drive letter + colon, e.g. "C:" @@ -134,7 +134,7 @@ mpt::PathString AbsolutePathToRelative(const mpt::PathString &relativeTo) const; mpt::PathString RelativePathToAbsolute(const mpt::PathString &relativeTo) const; -#endif // MODPLUG_TRACKER +#endif // MODPLUG_TRACKER && MPT_OS_WINDOWS public: Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/common/stdafx.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -16,8 +16,10 @@ #include "BuildSettings.h" -#if defined(MODPLUG_TRACKER) +#if defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT) +#if MPT_OS_WINDOWS + #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #include <afxcmn.h> // MFC support for Windows Common Controls @@ -30,9 +32,11 @@ #include <shlwapi.h> #include <mmsystem.h> -#endif // MODPLUG_TRACKER +#endif // MPT_OS_WINDOWS +#endif // MODPLUG_TRACKER && !MPT_BUILD_WINESUPPORT + #if MPT_COMPILER_MSVC #include <intrin.h> #endif Modified: trunk/OpenMPT/sounddev/SoundDeviceBase.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceBase.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceBase.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -141,7 +141,7 @@ virtual bool OnIdle() { return false; } SoundDevice::Settings GetSettings() const { return m_Settings; } - SampleFormat GetActualSampleFormat() const { return IsOpen() ? m_Settings.sampleFormat : SampleFormatInvalid; } + SampleFormat GetActualSampleFormat() const { return IsOpen() ? m_Settings.sampleFormat : SampleFormat(SampleFormatInvalid); } SoundDevice::BufferAttributes GetEffectiveBufferAttributes() const { return (IsOpen() && IsPlaying()) ? InternalGetEffectiveBufferAttributes() : SoundDevice::BufferAttributes(); } SoundDevice::TimeInfo GetTimeInfo() const { return m_TimeInfo; } Modified: trunk/OpenMPT/sounddev/SoundDeviceManager.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceManager.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceManager.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -84,10 +84,12 @@ } #endif // NO_PORTAUDIO +#if MPT_OS_WINDOWS if(IsComponentAvailable(m_WaveOut)) { EnumerateDevices<CWaveDevice>(); } +#endif // MPT_OS_WINDOWS #ifndef NO_DSOUND // kind of deprecated by now Modified: trunk/OpenMPT/sounddev/SoundDeviceManager.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceManager.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceManager.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -48,7 +48,9 @@ const SoundDevice::AppInfo m_AppInfo; +#if MPT_OS_WINDOWS ComponentHandle<ComponentWaveOut> m_WaveOut; +#endif // MPT_OS_WINDOWS #ifndef NO_DSOUND ComponentHandle<ComponentDirectSound> m_DirectSound; #endif // NO_DSOUND Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -341,6 +341,7 @@ bool CPortaudioDevice::OpenDriverSettings() //----------------------------------------- { +#if MPT_OS_WINDOWS if(m_HostApiType != paWASAPI) { return false; @@ -356,6 +357,9 @@ } controlEXE += MPT_PATHSTRING("control.exe"); return ((int)ShellExecuteW(NULL, L"open", controlEXE.AsNative().c_str(), (hasVista ? L"/name Microsoft.Sound" : L"mmsys.cpl"), NULL, SW_SHOW) > 32); +#else // !MPT_OS_WINDOWS + return false; +#endif // MPT_OS_WINDOWS } @@ -494,8 +498,6 @@ } - - std::vector<std::pair<PaDeviceIndex, mpt::ustring> > CPortaudioDevice::EnumerateInputOnlyDevices(PaHostApiTypeId hostApiType) //--------------------------------------------------------------------------------------------------------------------------- { @@ -556,6 +558,7 @@ } +#if MPT_COMPILER_MSVC static void PortaudioLog(const char *text) //---------------------------------------- { @@ -564,6 +567,7 @@ PALOG(mpt::String::Print("PortAudio: %1", text)); } } +#endif // MPT_COMPILER_MSVC MPT_REGISTERED_COMPONENT(ComponentPortAudio) @@ -577,7 +581,9 @@ bool ComponentPortAudio::DoInitialize() { +#if MPT_COMPILER_MSVC PaUtil_SetDebugPrintFunction(PortaudioLog); +#endif // MPT_COMPILER_MSVC return (Pa_Initialize() == paNoError); } Modified: trunk/OpenMPT/sounddev/SoundDeviceUtilities.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceUtilities.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceUtilities.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -18,7 +18,9 @@ #include <algorithm> +#if MPT_OS_WINDOWS #include <mmsystem.h> +#endif // MPT_OS_WINDOWS OPENMPT_NAMESPACE_BEGIN @@ -26,7 +28,9 @@ namespace SoundDevice { - + +#if MPT_OS_WINDOWS + bool FillWaveFormatExtensible(WAVEFORMATEXTENSIBLE &WaveFormat, const SoundDevice::Settings &m_Settings) //------------------------------------------------------------------------------------------------------ { @@ -59,7 +63,11 @@ return true; } +#endif // MPT_OS_WINDOWS + +#if MPT_OS_WINDOWS + CAudioThread::CAudioThread(CSoundDeviceWithThread &SoundDevice) : m_SoundDevice(SoundDevice) //------------------------------------------------------------------------------------------ { @@ -460,7 +468,9 @@ m_AudioThread.Deactivate(); } +#endif // MPT_OS_WINDOWS + } // namespace SoundDevice Modified: trunk/OpenMPT/sounddev/SoundDeviceUtilities.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceUtilities.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceUtilities.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -15,7 +15,9 @@ #include "../common/misc_util.h" +#if MPT_OS_WINDOWS #include <mmreg.h> +#endif // MPT_OS_WINDOWS OPENMPT_NAMESPACE_BEGIN @@ -24,9 +26,13 @@ namespace SoundDevice { +#if MPT_OS_WINDOWS bool FillWaveFormatExtensible(WAVEFORMATEXTENSIBLE &WaveFormat, const SoundDevice::Settings &m_Settings); +#endif // MPT_OS_WINDOWS +#if MPT_OS_WINDOWS + class CSoundDeviceWithThread; @@ -95,7 +101,9 @@ virtual void StopFromSoundThread() = 0; }; +#endif // MPT_OS_WINDOWS + } // namespace SoundDevice Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2015-05-26 10:50:41 UTC (rev 5191) @@ -25,6 +25,8 @@ namespace SoundDevice { +#if MPT_OS_WINDOWS + MPT_REGISTERED_COMPONENT(ComponentWaveOut) @@ -391,7 +393,9 @@ return devices; } +#endif // MPT_OS_WINDOWS + } // namespace SoundDevice Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -16,7 +16,9 @@ #include "../common/ComponentManager.h" +#if MPT_OS_WINDOWS #include <MMSystem.h> +#endif // MPT_OS_WINDOWS OPENMPT_NAMESPACE_BEGIN @@ -25,6 +27,8 @@ namespace SoundDevice { +#if MPT_OS_WINDOWS + class ComponentWaveOut : public ComponentBuiltin { MPT_DECLARE_COMPONENT_MEMBERS @@ -82,7 +86,9 @@ static std::vector<SoundDevice::Info> EnumerateDevices(); }; +#endif // MPT_OS_WINDOWS + } // namespace SoundDevice Modified: trunk/OpenMPT/soundlib/SampleFormatConverters.h =================================================================== --- trunk/OpenMPT/soundlib/SampleFormatConverters.h 2015-05-26 08:39:41 UTC (rev 5190) +++ trunk/OpenMPT/soundlib/SampleFormatConverters.h 2015-05-26 10:50:41 UTC (rev 5191) @@ -11,10 +11,10 @@ #pragma once -OPENMPT_NAMESPACE_BEGIN +#include "../common/Endianness.h" -struct ModSample; +OPENMPT_NAMESPACE_BEGIN // Byte offsets, from lowest significant to highest significant byte (for various functor template parameters) @@ -882,6 +882,10 @@ +#if defined(LIBOPENMPT_BUILD) || (defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT)) + +struct ModSample; + ////////////////////////////////////////////////////// // Actual sample conversion functions @@ -1138,5 +1142,7 @@ } } +#endif + OPENMPT_NAMESPACE_END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |