VERY IMPORTANT NOTE FOR ANYBODY BUILDING FROM THE TRUNK: This commit adds support
for FMOD Ex while at the same time removing support for FMOD 3. Be sure to update your SDKs. GCC users, be sure to do a "make cleandep && make clean" before building, or you will likely get inexplicable errors. - Fixed: If you wanted to make cleandep with MinGW, you had to specifically specify Makefile.mingw as the makefile to use. - Added a normalizer to the OPL synth. It helped bring up the volume a little, but not nearly as much as I would have liked. - Removed MIDI Mapper references. It doesn't work with the stream API, and it doesn't really exist on NT kernels, either. - Reworked music volume: Except for MIDI, all music volume is controlled through GSnd and not at the individual song level. - Removed the mididevice global variable. - Removed snd_midivolume. Now that all music uses a linear volume scale, there's no need for two separate music volume controls. - Increased snd_samplerate default up to 48000. - Added snd_format, defaulting to "PCM-16". - Added snd_speakermode, defaulting to "Auto". - Replaced snd_fpu with snd_resampler, defaulting to "Linear". - Bumped the snd_channels default up from a pitiful 12 to 32. - Changed snd_3d default to true. The new cvar snd_hw3d determines if hardware 3D support is used and default to false. - Removed the libFLAC source, since FMOD Ex has native FLAC support. - Removed the altsound code, since it was terribly gimped in comparison to the FMOD code. It's original purpose was to have been as a springboard for writing a non-FMOD sound system for Unix-y systems, but that never happened. - Finished preliminary FMOD Ex support. SVN r789 (trunk)
This commit is contained in:
parent
a5004f8827
commit
2b721975dd
74 changed files with 1651 additions and 20132 deletions
|
|
@ -16,7 +16,6 @@
|
|||
//
|
||||
//
|
||||
// DESCRIPTION: none
|
||||
// Dolby Pro Logic code by Gavino.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -74,11 +73,11 @@
|
|||
|
||||
#define NORM_PITCH 128
|
||||
#define NORM_PRIORITY 64
|
||||
#define NORM_SEP 128
|
||||
#define NORM_SEP 0
|
||||
#define NONE_SEP -2
|
||||
|
||||
#define S_PITCH_PERTURB 1
|
||||
#define S_STEREO_SWING (96<<FRACBITS)
|
||||
#define S_STEREO_SWING 0.25f
|
||||
|
||||
/* Sound curve parameters for Doom */
|
||||
|
||||
|
|
@ -89,7 +88,7 @@ const int S_CLIPPING_DIST = 1200;
|
|||
// Originally: 200.
|
||||
const int S_CLOSE_DIST = 160;
|
||||
|
||||
const int S_ATTENUATOR = S_CLIPPING_DIST - S_CLOSE_DIST;
|
||||
const float S_ATTENUATOR = S_CLIPPING_DIST - S_CLOSE_DIST;
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
|
|
@ -146,7 +145,7 @@ static bool SoundPaused; // whether sound effects are paused
|
|||
static bool MusicPaused; // whether music is paused
|
||||
static MusPlayingInfo mus_playing; // music currently being played
|
||||
static FString LastSong; // last music that was played
|
||||
static BYTE *SoundCurve;
|
||||
static float *SoundCurve;
|
||||
static int nextcleanup;
|
||||
static FPlayList *PlayList;
|
||||
|
||||
|
|
@ -158,8 +157,7 @@ int numChannels;
|
|||
|
||||
CVAR (Bool, snd_surround, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // [RH] Use surround sounds?
|
||||
FBoolCVar noisedebug ("noise", false, 0); // [RH] Print sound debugging info?
|
||||
CVAR (Int, snd_channels, 12, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // number of channels available
|
||||
CVAR (Bool, snd_matrix, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR (Int, snd_channels, 32, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // number of channels available
|
||||
CVAR (Bool, snd_flipstereo, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
|
@ -282,35 +280,41 @@ void S_Init ()
|
|||
atterm (S_Shutdown);
|
||||
|
||||
// remove old data (S_Init can be called multiple times!)
|
||||
if (SoundCurve) delete [] SoundCurve;
|
||||
if (SoundCurve)
|
||||
{
|
||||
delete[] SoundCurve;
|
||||
}
|
||||
|
||||
// Heretic and Hexen have sound curve lookup tables. Doom does not.
|
||||
curvelump = Wads.CheckNumForName ("SNDCURVE");
|
||||
if (curvelump >= 0)
|
||||
{
|
||||
MAX_SND_DIST = Wads.LumpLength (curvelump);
|
||||
SoundCurve = new BYTE[MAX_SND_DIST];
|
||||
Wads.ReadLump (curvelump, SoundCurve);
|
||||
SoundCurve = new float[MAX_SND_DIST];
|
||||
FMemLump lump = Wads.ReadLump(curvelump);
|
||||
BYTE *lumpmem = (BYTE *)lump.GetMem();
|
||||
|
||||
// The maximum value in a SNDCURVE lump is 127, so scale it to
|
||||
// fit our sound system's volume levels.
|
||||
// fit our sound system's volume levels. Also, FMOD's volumes
|
||||
// are linear, whereas we want the "dumb" logarithmic volumes
|
||||
// for our "2D" sounds.
|
||||
for (i = 0; i < S_CLIPPING_DIST; ++i)
|
||||
{
|
||||
SoundCurve[i] = SoundCurve[i] * 255 / 127;
|
||||
SoundCurve[i] = (powf(10.f, (lumpmem[i] / 127.f)) - 1.f) / 9.f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MAX_SND_DIST = S_CLIPPING_DIST;
|
||||
SoundCurve = new BYTE[S_CLIPPING_DIST];
|
||||
SoundCurve = new float[S_CLIPPING_DIST];
|
||||
for (i = 0; i < S_CLIPPING_DIST; ++i)
|
||||
{
|
||||
SoundCurve[i] = MIN (255, (S_CLIPPING_DIST - i) * 255 / S_ATTENUATOR);
|
||||
SoundCurve[i] = (powf(10.f, MIN(1.f, (S_CLIPPING_DIST - i) / S_ATTENUATOR)) - 1.f) / 9.f;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocating the virtual channels
|
||||
numChannels = GSnd ? GSnd->SetChannels (snd_channels) : 0;
|
||||
numChannels = GSnd ? GSnd->GetNumChannels() : 0;
|
||||
if (Channel != NULL)
|
||||
{
|
||||
delete[] Channel;
|
||||
|
|
@ -594,11 +598,12 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
int sound_id, float volume, float attenuation, bool looping)
|
||||
{
|
||||
sfxinfo_t *sfx;
|
||||
int dist, vol;
|
||||
int dist;
|
||||
float vol;
|
||||
int i;
|
||||
int chanflags;
|
||||
int basepriority, priority;
|
||||
int sep;
|
||||
float sep;
|
||||
int org_id;
|
||||
fixed_t x, y, z;
|
||||
angle_t angle;
|
||||
|
|
@ -655,7 +660,7 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
}
|
||||
else if (attenuation < 0)
|
||||
{
|
||||
sep = snd_surround ? -1 : NONE_SEP;
|
||||
sep = NONE_SEP;
|
||||
dist = 0;
|
||||
}
|
||||
else
|
||||
|
|
@ -827,7 +832,7 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
}
|
||||
}
|
||||
|
||||
vol = (int)(SoundCurve[dist]*volume);
|
||||
vol = SoundCurve[dist] * volume;
|
||||
if (sep == -3)
|
||||
{
|
||||
AActor *listener = players[consoleplayer].camera;
|
||||
|
|
@ -846,21 +851,10 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
angle = angle - listener->angle;
|
||||
else
|
||||
angle = angle + (ANGLE_MAX - listener->angle);
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
sep = NORM_SEP - (FixedMul (S_STEREO_SWING, finesine[angle])>>FRACBITS);
|
||||
sep = NORM_SEP - S_STEREO_SWING * sin((angle >> 1) * M_PI / 2147483648.0);
|
||||
if (snd_flipstereo)
|
||||
{
|
||||
sep = 255-sep;
|
||||
}
|
||||
if (snd_matrix)
|
||||
{
|
||||
int rearsep = NORM_SEP -
|
||||
(FixedMul (S_STEREO_SWING, finecosine[angle])>>FRACBITS);
|
||||
if (rearsep > 128)
|
||||
{
|
||||
sep = -1;
|
||||
attenuation = -1;
|
||||
}
|
||||
sep = -sep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1308,9 +1302,9 @@ void S_UpdateSounds (void *listener_p)
|
|||
{
|
||||
fixed_t *listener;
|
||||
fixed_t x, y;
|
||||
int i, dist, vol;
|
||||
int i, dist;
|
||||
angle_t angle;
|
||||
int sep;
|
||||
float vol, sep;
|
||||
|
||||
I_UpdateMusic();
|
||||
|
||||
|
|
@ -1366,7 +1360,7 @@ void S_UpdateSounds (void *listener_p)
|
|||
{
|
||||
dist = 0;
|
||||
}
|
||||
vol = (int)(SoundCurve[dist]*Channel[i].volume);
|
||||
vol = SoundCurve[dist] * Channel[i].volume;
|
||||
if (dist > 0)
|
||||
{
|
||||
angle = R_PointToAngle2(listener[0], listener[1], x, y);
|
||||
|
|
@ -1374,20 +1368,10 @@ void S_UpdateSounds (void *listener_p)
|
|||
angle = angle - players[consoleplayer].camera->angle;
|
||||
else
|
||||
angle = angle + (ANGLE_MAX - players[consoleplayer].camera->angle);
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
sep = NORM_SEP - (FixedMul (S_STEREO_SWING, finesine[angle])>>FRACBITS);
|
||||
sep = NORM_SEP - S_STEREO_SWING * sin((angle >> 1) * M_PI / 2147483648.0);
|
||||
if (snd_flipstereo)
|
||||
{
|
||||
sep = 255-sep;
|
||||
}
|
||||
if (snd_matrix)
|
||||
{
|
||||
int rearsep = NORM_SEP -
|
||||
(FixedMul (S_STEREO_SWING, finecosine[angle])>>FRACBITS);
|
||||
if (rearsep > 128)
|
||||
{
|
||||
sep = -1;
|
||||
}
|
||||
sep = -sep;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue