New options to control Sector Steady Ambients:

ENABLE_SSA (default FALSE)
VOLUME_SSA (default 50)
DEBUG_SSA (default FALSE)

Increased number of sound channels to 64.
SoundPlay(): show more information when failed to play sound.
PlayVoiceTaunt(): limit max number of voices to 99.
vfs::String::as_utf16(): show original string if failed to convert.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8745 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-02-08 19:35:10 +00:00
parent 39c773e0c6
commit 7e0606932f
8 changed files with 392 additions and 37 deletions
+28 -13
View File
@@ -22,6 +22,9 @@
#include "fmod.h"
#include "fmod_errors.h"
#include "sgp_logger.h"
// sevenfm
#include "message.h"
#include "Sound Control.h"
#endif
// Uncomment this to disable the startup of sound hardware
@@ -30,11 +33,8 @@
// global settings
#define SOUND_MAX_CACHED 128 // number of cache slots
#ifdef JA2
#define SOUND_MAX_CHANNELS 16 // number of mixer channels
#else
#define SOUND_MAX_CHANNELS 32 // number of mixer channels
#endif
// sevenfm: increased number of channels
#define SOUND_MAX_CHANNELS 64
// default memory limit
#define SOUND_DEFAULT_MEMORY (8048*1024)
@@ -292,24 +292,38 @@ UINT32 SoundPlay(STR pFilename, SOUNDPARMS *pParms)
{
UINT32 uiSample, uiChannel;
if( fSoundSystemInit )
if (fSoundSystemInit)
{
if( !SoundPlayStreamed(pFilename) )
if (!SoundPlayStreamed(pFilename))
{
if((uiSample=SoundLoadSample(pFilename))!=NO_SAMPLE)
if ((uiSample = SoundLoadSample(pFilename)) != NO_SAMPLE)
{
if((uiChannel=SoundGetFreeChannel())!=SOUND_ERROR)
if ((uiChannel = SoundGetFreeChannel()) != SOUND_ERROR)
{
return(SoundStartSample(uiSample, uiChannel, pParms));
}
else
{
SoundLog((CHAR8 *)String("Could not get free channel, uiChannel = %d", uiChannel));
}
}
else
{
SoundLog((CHAR8 *)String("Could not load sample, uiSample = %d", uiSample));
}
}
else
{
//Trying to play a sound which is bigger then the 'guiSoundCacheThreshold'
FastDebugMsg(String("SoundPlay: ERROR: Trying to play %s sound is too lardge to load into cache, use SoundPlayStreamedFile() instead\n", pFilename ) );
FastDebugMsg(String("SoundPlay: ERROR: Trying to play %s sound is too large to load into cache, use SoundPlayStreamedFile() instead\n", pFilename));
SoundLog((CHAR8 *)String("SoundPlay: ERROR: Trying to play %s sound is too large to load into cache, use SoundPlayStreamedFile() instead\n", pFilename));
}
}
else
{
SoundLog((CHAR8 *)String("SoundSystemInit FALSE"));
}
return(SOUND_ERROR);
}
@@ -848,8 +862,10 @@ UINT32 uiChannel, uiSample;
uiSample=pSoundList[uiChannel].uiSample;
// if this was a random sample, decrease the iteration count
if ( (uiSample != -1) && (pSampleList[uiSample].uiFlags&SAMPLE_RANDOM) )
if (uiSample != -1 && (pSampleList[uiSample].uiFlags & SAMPLE_RANDOM))
{
SoundStopIndex(uiChannel);
}
}
}
@@ -1481,8 +1497,7 @@ UINT32 uiSoundID;
// Loop
if((pParms!=NULL) && (pParms->uiLoop!=SOUND_PARMS_DEFAULT))
{
// If looping infinately, lock the sample so it can't be unloaded
// and mark it as a looping sound
// If looping infinitely, lock the sample so it can't be unloaded and mark it as a looping sound
if(pParms->uiLoop==0)
{
pSampleList[uiSample].uiFlags|=SAMPLE_LOCKED;