From 7f28015ac53fcbec0925294ce6fc42a3320e6f39 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Fri, 6 May 2022 19:15:10 +0000 Subject: [PATCH] LIMIT_SIMULTANEOUS_SOUND option: changed delay to 50ms. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9380 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Standard Gaming Platform/soundman.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Standard Gaming Platform/soundman.cpp b/Standard Gaming Platform/soundman.cpp index 435e4f6e..37216332 100644 --- a/Standard Gaming Platform/soundman.cpp +++ b/Standard Gaming Platform/soundman.cpp @@ -28,6 +28,7 @@ //#include "english.h" //#include "input.h" #include + #include #endif // Uncomment this to disable the startup of sound hardware @@ -291,7 +292,13 @@ void ShutdownSoundManager(void) // //******************************************************************************* -std::map> gSoundMap; +std::map> gSoundMap; + +uint64_t TimeMS() +{ + using namespace std::chrono; + return duration_cast(system_clock::now().time_since_epoch()).count(); +} UINT32 SoundPlay(STR pFilename, SOUNDPARMS *pParms) { @@ -305,7 +312,7 @@ UINT32 SoundPlay(STR pFilename, SOUNDPARMS *pParms) if (gGameExternalOptions.fLimitSimultaneousSound) //!_KeyDown(SHIFT)) { - std::time_t curtime = std::time(0); + uint64_t curtime = TimeMS(); std::string filename(pFilename); if (gSoundMap[filename] > curtime) @@ -314,7 +321,7 @@ UINT32 SoundPlay(STR pFilename, SOUNDPARMS *pParms) } // set delay for this sound type - gSoundMap[filename] = curtime + 1; + gSoundMap[filename] = curtime + 50; } if ((uiSample = SoundLoadSample(pFilename)) != NO_SAMPLE)