mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- cleaned the includes of the sound backend code of unwanted content.
Also simplified the sound init decision making. With FMod gone there is no reason to be pedantic here. Even the check of snd_backend for the Null device could be omitted here, its only realistic use is '-nosound'.
This commit is contained in:
parent
83349bee1b
commit
6725cfcca5
10 changed files with 77 additions and 91 deletions
|
@ -1134,6 +1134,11 @@ FString BuildString (int argc, FString *argv)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FConsoleCommand::PrintCommand()
|
||||
{
|
||||
Printf("%s\n", m_Name);
|
||||
}
|
||||
|
||||
FString SubstituteAliasParams (FString &command, FCommandLine &args)
|
||||
{
|
||||
// Do substitution by replacing %x with the argument x.
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
#ifndef __C_DISPATCH_H__
|
||||
#define __C_DISPATCH_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include <stdint.h>
|
||||
#include "tarray.h"
|
||||
#include "zstring.h"
|
||||
|
||||
class FConfigFile;
|
||||
|
||||
|
@ -63,7 +65,7 @@ struct FExecList
|
|||
TArray<FString> Commands;
|
||||
TArray<FString> Pullins;
|
||||
|
||||
void AddCommand(const char *cmd, const char *file = NULL);
|
||||
void AddCommand(const char *cmd, const char *file = nullptr);
|
||||
void ExecCommands() const;
|
||||
void AddPullins(TArray<FString> &wads) const;
|
||||
};
|
||||
|
@ -107,7 +109,7 @@ public:
|
|||
FConsoleCommand (const char *name, CCmdRun RunFunc);
|
||||
virtual ~FConsoleCommand ();
|
||||
virtual bool IsAlias ();
|
||||
void PrintCommand () { Printf ("%s\n", m_Name); }
|
||||
void PrintCommand();
|
||||
|
||||
virtual void Run (FCommandLine &args, AActor *instigator, int key);
|
||||
static FConsoleCommand* FindByName (const char* name);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "c_dispatch.h"
|
||||
#include "c_cvars.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#ifndef __V_TEXT_H__
|
||||
#define __V_TEXT_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "v_font.h"
|
||||
|
||||
struct FBrokenLines
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "templates.h"
|
||||
#include "c_cvars.h"
|
||||
#include "w_wad.h"
|
||||
#include "doomtype.h"
|
||||
#ifdef _DEBUG
|
||||
#include "c_dispatch.h"
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "v_text.h"
|
||||
#include "c_cvars.h"
|
||||
#include "stats.h"
|
||||
#include "s_music.h"
|
||||
#include "zmusic/zmusic.h"
|
||||
|
||||
|
||||
|
@ -259,20 +258,12 @@ void I_InitSound ()
|
|||
return;
|
||||
}
|
||||
|
||||
#ifndef NO_OPENAL
|
||||
// Simplify transition to OpenAL backend
|
||||
if (stricmp(snd_backend, "fmod") == 0)
|
||||
{
|
||||
Printf (TEXTCOLOR_ORANGE "FMOD Ex sound system was removed, switching to OpenAL\n");
|
||||
snd_backend = "openal";
|
||||
}
|
||||
#endif // NO_OPENAL
|
||||
|
||||
// Keep it simple: let everything except "null" init the sound.
|
||||
if (stricmp(snd_backend, "null") == 0)
|
||||
{
|
||||
GSnd = new NullSoundRenderer;
|
||||
}
|
||||
else if(stricmp(snd_backend, "openal") == 0)
|
||||
else
|
||||
{
|
||||
#ifndef NO_OPENAL
|
||||
if (IsOpenALPresent())
|
||||
|
@ -281,11 +272,6 @@ void I_InitSound ()
|
|||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf (TEXTCOLOR_RED"%s: Unknown sound system specified\n", *snd_backend);
|
||||
snd_backend = "null";
|
||||
}
|
||||
if (!GSnd || !GSnd->IsValid ())
|
||||
{
|
||||
I_CloseSound();
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "vectors.h"
|
||||
#include "tarray.h"
|
||||
#include "zmusic/sounddecoder.h"
|
||||
|
|
|
@ -35,17 +35,18 @@
|
|||
#include <functional>
|
||||
#include <chrono>
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "c_cvars.h"
|
||||
#include "templates.h"
|
||||
#include "oalsound.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "v_text.h"
|
||||
#include "i_module.h"
|
||||
#include "cmdlib.h"
|
||||
#include "menu/menu.h"
|
||||
#include "m_fixed.h"
|
||||
#include "zmusic/sounddecoder.h"
|
||||
#include "filereadermusicinterface.h"
|
||||
|
||||
|
||||
const char *GetSampleTypeName(SampleType type);
|
||||
const char *GetChannelConfigName(ChannelConfig chan);
|
||||
|
||||
|
@ -96,58 +97,6 @@ bool IsOpenALPresent()
|
|||
|
||||
|
||||
|
||||
void I_BuildALDeviceList(FOptionValues *opt)
|
||||
{
|
||||
opt->mValues.Resize(1);
|
||||
opt->mValues[0].TextValue = "Default";
|
||||
opt->mValues[0].Text = "Default";
|
||||
|
||||
#ifndef NO_OPENAL
|
||||
if (IsOpenALPresent())
|
||||
{
|
||||
const ALCchar *names = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") ?
|
||||
alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER) :
|
||||
alcGetString(NULL, ALC_DEVICE_SPECIFIER));
|
||||
if (!names)
|
||||
Printf("Failed to get device list: %s\n", alcGetString(NULL, alcGetError(NULL)));
|
||||
else while (*names)
|
||||
{
|
||||
unsigned int i = opt->mValues.Reserve(1);
|
||||
opt->mValues[i].TextValue = names;
|
||||
opt->mValues[i].Text = names;
|
||||
|
||||
names += strlen(names) + 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_BuildALResamplersList(FOptionValues *opt)
|
||||
{
|
||||
opt->mValues.Resize(1);
|
||||
opt->mValues[0].TextValue = "Default";
|
||||
opt->mValues[0].Text = "Default";
|
||||
|
||||
#ifndef NO_OPENAL
|
||||
if (!IsOpenALPresent())
|
||||
return;
|
||||
if (!alcGetCurrentContext() || !alIsExtensionPresent("AL_SOFT_source_resampler"))
|
||||
return;
|
||||
|
||||
LPALGETSTRINGISOFT alGetStringiSOFT = reinterpret_cast<LPALGETSTRINGISOFT>(alGetProcAddress("alGetStringiSOFT"));
|
||||
ALint num_resamplers = alGetInteger(AL_NUM_RESAMPLERS_SOFT);
|
||||
|
||||
unsigned int idx = opt->mValues.Reserve(num_resamplers);
|
||||
for(ALint i = 0;i < num_resamplers;++i)
|
||||
{
|
||||
const ALchar *name = alGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i);
|
||||
opt->mValues[idx].TextValue = name;
|
||||
opt->mValues[idx].Text = name;
|
||||
++idx;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ReverbContainer *ForcedEnvironment;
|
||||
|
||||
|
@ -2359,4 +2308,60 @@ FSoundChan *OpenALSoundRenderer::FindLowestChannel()
|
|||
return lowest;
|
||||
}
|
||||
|
||||
|
||||
#include "menu/menu.h"
|
||||
|
||||
void I_BuildALDeviceList(FOptionValues* opt)
|
||||
{
|
||||
opt->mValues.Resize(1);
|
||||
opt->mValues[0].TextValue = "Default";
|
||||
opt->mValues[0].Text = "Default";
|
||||
|
||||
#ifndef NO_OPENAL
|
||||
if (IsOpenALPresent())
|
||||
{
|
||||
const ALCchar* names = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") ?
|
||||
alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER) :
|
||||
alcGetString(NULL, ALC_DEVICE_SPECIFIER));
|
||||
if (!names)
|
||||
Printf("Failed to get device list: %s\n", alcGetString(NULL, alcGetError(NULL)));
|
||||
else while (*names)
|
||||
{
|
||||
unsigned int i = opt->mValues.Reserve(1);
|
||||
opt->mValues[i].TextValue = names;
|
||||
opt->mValues[i].Text = names;
|
||||
|
||||
names += strlen(names) + 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_BuildALResamplersList(FOptionValues* opt)
|
||||
{
|
||||
opt->mValues.Resize(1);
|
||||
opt->mValues[0].TextValue = "Default";
|
||||
opt->mValues[0].Text = "Default";
|
||||
|
||||
#ifndef NO_OPENAL
|
||||
if (!IsOpenALPresent())
|
||||
return;
|
||||
if (!alcGetCurrentContext() || !alIsExtensionPresent("AL_SOFT_source_resampler"))
|
||||
return;
|
||||
|
||||
LPALGETSTRINGISOFT alGetStringiSOFT = reinterpret_cast<LPALGETSTRINGISOFT>(alGetProcAddress("alGetStringiSOFT"));
|
||||
ALint num_resamplers = alGetInteger(AL_NUM_RESAMPLERS_SOFT);
|
||||
|
||||
unsigned int idx = opt->mValues.Reserve(num_resamplers);
|
||||
for (ALint i = 0; i < num_resamplers; ++i)
|
||||
{
|
||||
const ALchar* name = alGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i);
|
||||
opt->mValues[idx].TextValue = name;
|
||||
opt->mValues[idx].Text = name;
|
||||
++idx;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif // NO_OPENAL
|
||||
|
|
|
@ -32,21 +32,11 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_soundinternal.h"
|
||||
#include "sc_man.h"
|
||||
#include "cmdlib.h"
|
||||
#include "templates.h"
|
||||
#include "w_wad.h"
|
||||
#include "i_system.h"
|
||||
#include "m_misc.h"
|
||||
|
||||
#include "c_cvars.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "vm.h"
|
||||
#include "dobject.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
|
||||
FReverbField ReverbFields[] =
|
||||
{
|
||||
|
@ -526,7 +516,7 @@ void S_ReadReverbDef (FScanner &sc)
|
|||
|
||||
while (sc.GetString ())
|
||||
{
|
||||
name = copystring (sc.String);
|
||||
name = strdup (sc.String);
|
||||
sc.MustGetNumber ();
|
||||
id1 = sc.Number;
|
||||
sc.MustGetNumber ();
|
||||
|
@ -627,7 +617,7 @@ void S_UnloadReverbDef ()
|
|||
if (!probe->Builtin)
|
||||
{
|
||||
if (pNext != NULL) *pNext = probe->Next;
|
||||
delete[] const_cast<char *>(probe->Name);
|
||||
free(const_cast<char *>(probe->Name));
|
||||
delete probe;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "i_system.h"
|
||||
#include "i_sound.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_soundinternal.h"
|
||||
#include "m_swap.h"
|
||||
#include "superfasthash.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue