mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- minor sound code cleanup
# Conflicts: # src/sound/backend/oalsound.cpp
This commit is contained in:
parent
cd9e2d3795
commit
50e1efa965
9 changed files with 26 additions and 21 deletions
|
@ -2679,6 +2679,7 @@ static int D_DoomMain_Internal (void)
|
||||||
else if (batchout != NULL && *batchout != 0)
|
else if (batchout != NULL && *batchout != 0)
|
||||||
{
|
{
|
||||||
batchrun = true;
|
batchrun = true;
|
||||||
|
nosound = true;
|
||||||
execLogfile(batchout, true);
|
execLogfile(batchout, true);
|
||||||
Printf("Command line: ");
|
Printf("Command line: ");
|
||||||
for (int i = 0; i < Args->NumArgs(); i++)
|
for (int i = 0; i < Args->NumArgs(); i++)
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
|
|
||||||
EXTERN_CVAR (Float, snd_sfxvolume)
|
EXTERN_CVAR (Float, snd_sfxvolume)
|
||||||
EXTERN_CVAR (Float, snd_musicvolume)
|
EXTERN_CVAR(Float, snd_musicvolume)
|
||||||
CVAR (Int, snd_samplerate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Int, snd_samplerate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Int, snd_buffersize, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Int, snd_buffersize, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Int, snd_hrtf, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Int, snd_hrtf, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
@ -84,7 +84,7 @@ void I_CloseSound ();
|
||||||
// Maximum volume of all audio
|
// Maximum volume of all audio
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
CUSTOM_CVAR(Float, snd_mastervolume, 1.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CUSTOM_CVAR(Float, snd_mastervolume, 1.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
if (self < 0.f)
|
if (self < 0.f)
|
||||||
self = 0.f;
|
self = 0.f;
|
||||||
|
@ -250,10 +250,9 @@ void I_InitSound ()
|
||||||
nosfx = !!Args->CheckParm ("-nosfx");
|
nosfx = !!Args->CheckParm ("-nosfx");
|
||||||
|
|
||||||
GSnd = NULL;
|
GSnd = NULL;
|
||||||
if (nosound || batchrun)
|
if (nosound)
|
||||||
{
|
{
|
||||||
GSnd = new NullSoundRenderer;
|
GSnd = new NullSoundRenderer;
|
||||||
I_InitMusic ();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +276,6 @@ void I_InitSound ()
|
||||||
GSnd = new NullSoundRenderer;
|
GSnd = new NullSoundRenderer;
|
||||||
Printf (TEXTCOLOR_RED"Sound init failed. Using nosound.\n");
|
Printf (TEXTCOLOR_RED"Sound init failed. Using nosound.\n");
|
||||||
}
|
}
|
||||||
I_InitMusic ();
|
|
||||||
snd_sfxvolume.Callback ();
|
snd_sfxvolume.Callback ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,9 +370,9 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length)
|
||||||
case 1: // Sound data
|
case 1: // Sound data
|
||||||
if (/*noextra &*/ (codec == -1 || codec == sfxdata[i + 1])) // NAM contains a VOC where a valid data block follows an extra block.
|
if (/*noextra &*/ (codec == -1 || codec == sfxdata[i + 1])) // NAM contains a VOC where a valid data block follows an extra block.
|
||||||
{
|
{
|
||||||
frequency = 1000000/(256 - sfxdata[i]);
|
frequency = 1000000 / (256 - sfxdata[i]);
|
||||||
channels = 1;
|
channels = 1;
|
||||||
codec = sfxdata[i+1];
|
codec = sfxdata[i + 1];
|
||||||
if (codec == 0)
|
if (codec == 0)
|
||||||
bits = 8;
|
bits = 8;
|
||||||
else if (codec == 4)
|
else if (codec == 4)
|
||||||
|
|
|
@ -169,5 +169,6 @@ void I_CloseSound();
|
||||||
extern ReverbContainer *DefaultEnvironments[26];
|
extern ReverbContainer *DefaultEnvironments[26];
|
||||||
|
|
||||||
bool IsOpenALPresent();
|
bool IsOpenALPresent();
|
||||||
|
void S_SoundReset();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,6 +18,8 @@ enum EChanFlag
|
||||||
CHANF_AREA = 128, // Sound plays from all around. Only valid with sector sounds.
|
CHANF_AREA = 128, // Sound plays from all around. Only valid with sector sounds.
|
||||||
CHANF_LOOP = 256,
|
CHANF_LOOP = 256,
|
||||||
|
|
||||||
|
CHANF_PICKUP = CHANF_MAYBE_LOCAL,
|
||||||
|
|
||||||
CHANF_NONE = 0,
|
CHANF_NONE = 0,
|
||||||
CHANF_IS3D = 1, // internal: Sound is 3D.
|
CHANF_IS3D = 1, // internal: Sound is 3D.
|
||||||
CHANF_EVICTED = 2, // internal: Sound was evicted.
|
CHANF_EVICTED = 2, // internal: Sound was evicted.
|
||||||
|
@ -28,6 +30,7 @@ enum EChanFlag
|
||||||
CHANF_NOSTOP = 4096, // only for A_PlaySound. Does not start if channel is playing something.
|
CHANF_NOSTOP = 4096, // only for A_PlaySound. Does not start if channel is playing something.
|
||||||
CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them.
|
CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them.
|
||||||
CHANF_LOCAL = 16384, // only plays locally for the calling actor
|
CHANF_LOCAL = 16384, // only plays locally for the calling actor
|
||||||
|
CHANF_TRANSIENT = 32768, // Do not record in savegames - used for sounds that get restarted outside the sound system (e.g. ambients in SW and Blood)
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef TFlags<EChanFlag> EChanFlags;
|
typedef TFlags<EChanFlag> EChanFlags;
|
||||||
|
|
|
@ -52,6 +52,11 @@ FModule OpenALModule{"OpenAL"};
|
||||||
|
|
||||||
#include "oalload.h"
|
#include "oalload.h"
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Int, snd_channels, 128, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // number of channels available
|
||||||
|
{
|
||||||
|
if (self < 64) self = 64;
|
||||||
|
}
|
||||||
|
CVAR(Bool, snd_waterreverb, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
CVAR (String, snd_aldevice, "Default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (String, snd_aldevice, "Default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Bool, snd_efx, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Bool, snd_efx, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (String, snd_alresampler, "Default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (String, snd_alresampler, "Default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "i_sound.h"
|
#include "i_sound.h"
|
||||||
#include "s_sound.h"
|
#include "s_soundinternal.h"
|
||||||
|
|
||||||
#ifndef NO_OPENAL
|
#ifndef NO_OPENAL
|
||||||
|
|
||||||
|
|
|
@ -70,11 +70,6 @@
|
||||||
|
|
||||||
|
|
||||||
FBoolCVar noisedebug("noise", false, 0); // [RH] Print sound debugging info?
|
FBoolCVar noisedebug("noise", false, 0); // [RH] Print sound debugging info?
|
||||||
CUSTOM_CVAR(Int, snd_channels, 128, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // number of channels available
|
|
||||||
{
|
|
||||||
if (self < 64) self = 64;
|
|
||||||
}
|
|
||||||
CVAR(Bool, snd_waterreverb, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|
||||||
|
|
||||||
|
|
||||||
static FString LastLocalSndInfo;
|
static FString LastLocalSndInfo;
|
||||||
|
@ -218,6 +213,7 @@ void S_Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
I_InitSound();
|
I_InitSound();
|
||||||
|
I_InitMusic();
|
||||||
|
|
||||||
// Heretic and Hexen have sound curve lookup tables. Doom does not.
|
// Heretic and Hexen have sound curve lookup tables. Doom does not.
|
||||||
int curvelump = fileSystem.CheckNumForName("SNDCURVE");
|
int curvelump = fileSystem.CheckNumForName("SNDCURVE");
|
||||||
|
@ -1526,13 +1522,6 @@ CCMD (snd_reset)
|
||||||
S_SoundReset();
|
S_SoundReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SoundReset()
|
|
||||||
{
|
|
||||||
S_StopMusic(true);
|
|
||||||
soundEngine->Reset();
|
|
||||||
S_RestartMusic();
|
|
||||||
}
|
|
||||||
|
|
||||||
CCMD (snd_listdrivers)
|
CCMD (snd_listdrivers)
|
||||||
{
|
{
|
||||||
GSnd->PrintDriversList ();
|
GSnd->PrintDriversList ();
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "s_soundinternal.h"
|
#include "s_soundinternal.h"
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "m_misc.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "s_soundinternal.h"
|
#include "s_soundinternal.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "superfasthash.h"
|
#include "superfasthash.h"
|
||||||
|
#include "s_music.h"
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -1694,3 +1695,11 @@ void SoundEngine::AddRandomSound(int Owner, TArray<uint32_t> list)
|
||||||
S_sfx[Owner].bRandomHeader = true;
|
S_sfx[Owner].bRandomHeader = true;
|
||||||
S_sfx[Owner].NearLimit = -1;
|
S_sfx[Owner].NearLimit = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S_SoundReset()
|
||||||
|
{
|
||||||
|
S_StopMusic(true);
|
||||||
|
soundEngine->Reset();
|
||||||
|
S_RestartMusic();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue