- Fixed compilation with FMOD 4.38+. The removal of hardware voices and EAX was a fairly

major change, so I'm making no provisions for using older FMOD DLLs when compiled with the
  4.38 API. However, sound positioning is still broken like in 4.28, so you are recommended
  to continue building with 4.26. Also, the Freeverb-based DSP unit is no longer present in
  FMOD, so the underwater effect is currently unavailable when using 4.38 until I can figure
  out how to make it work with the SFX Reverb unit instead. (And on that topic, the Freeverb
  DSP was officially only for stereo outputs, so I really shouldn't have been using it in the
  first place.)
- Since I would like to eventually figure out the sound positioning issues with the newer
  FMODs, the following have been added:
  * snd_drawoutput now labels its outputs with the speakers they represent.
  * DCanvas::DrawTextA was added as an alias for DrawText, since the Windows headers #define
    DrawText to a Unicode/non-Unicode variant.
  * The loopsound console command was added to spawn an actor at the player's location and
    have it loop a sound infinitely.
  Hopefully I can figure it out. FMOD's 3D example works, so I assume the problem lies with
  my code, though I don't really know where to begin looking for the problem.

SVN r3350 (trunk)
This commit is contained in:
Randy Heit 2012-02-10 00:53:50 +00:00
parent 5d7ee4dbfd
commit 68fbd75897
9 changed files with 613 additions and 436 deletions

View file

@ -671,7 +671,7 @@ void drawquad(float x0, float y0, float x1, float y1, float x2, float y2, float
void printnum(int x, int y, int num) void printnum(int x, int y, int num)
{ {
char foo[16]; mysnprintf (foo, countof(foo), "%d", num); char foo[16]; mysnprintf (foo, countof(foo), "%d", num);
RenderTarget->DrawText (SmallFont, CR_WHITE, x, y, foo); RenderTarget->DrawText (SmallFont, CR_WHITE, x, y, foo, TAG_DONE);
} }
void drawpolymosttest() void drawpolymosttest()

View file

@ -2591,7 +2591,44 @@ CCMD (playsound)
{ {
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
S_Sound (CHAN_AUTO | CHAN_UI, argv[1], 1.f, ATTN_NONE); FSoundID id = argv[1];
if (id == 0)
{
Printf("'%s' is not a sound\n", argv[1]);
}
else
{
S_Sound (CHAN_AUTO | CHAN_UI, id, 1.f, ATTN_NONE);
}
}
}
//==========================================================================
//
// CCMD loopsound
//
//==========================================================================
CCMD (loopsound)
{
if (players[consoleplayer].mo != NULL && !netgame && argv.argc() > 1)
{
FSoundID id = argv[1];
if (id == 0)
{
Printf("'%s' is not a sound\n", argv[1]);
}
else
{
AActor *icon = Spawn("SpeakerIcon", players[consoleplayer].mo->x,
players[consoleplayer].mo->y,
players[consoleplayer].mo->z + 32*FRACUNIT,
ALLOW_REPLACE);
if (icon != NULL)
{
S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE);
}
}
} }
} }

View file

@ -63,6 +63,10 @@ extern HWND Window;
#include "cmdlib.h" #include "cmdlib.h"
#include "s_sound.h" #include "s_sound.h"
#if FMOD_VERSION > 0x42899 && FMOD_VERSION < 0x43800
#error You are trying to compile with an unsupported version of FMOD.
#endif
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
// killough 2/21/98: optionally use varying pitched sounds // killough 2/21/98: optionally use varying pitched sounds
@ -173,12 +177,12 @@ static const FEnumList OutputNames[] =
{ "ESD", FMOD_OUTPUTTYPE_ESD }, { "ESD", FMOD_OUTPUTTYPE_ESD },
#if FMOD_VERSION >= 0x43400 #if FMOD_VERSION >= 0x43400
{ "PulseAudio", FMOD_OUTPUTTYPE_PULSEAUDIO }, { "PulseAudio", FMOD_OUTPUTTYPE_PULSEAUDIO },
{ "Pulse", FMOD_OUTPUTTYPE_PULSEAUDIO },
#endif #endif
{ "SDL", 666 }, { "SDL", 666 },
// Mac // Mac
#if FMOD_VERSION < 0x43000 #if FMOD_VERSION < 0x43000
// Sound Manager support was removed sometime in the 4.29 line.
{ "Sound Manager", FMOD_OUTPUTTYPE_SOUNDMANAGER }, { "Sound Manager", FMOD_OUTPUTTYPE_SOUNDMANAGER },
#endif #endif
{ "Core Audio", FMOD_OUTPUTTYPE_COREAUDIO }, { "Core Audio", FMOD_OUTPUTTYPE_COREAUDIO },
@ -238,6 +242,9 @@ static const char *OpenStateNames[] =
"Streaming" "Streaming"
}; };
const FMODSoundRenderer::spk FMODSoundRenderer::SpeakerNames4[4] = { "L", "R", "BL", "BR" };
const FMODSoundRenderer::spk FMODSoundRenderer::SpeakerNamesMore[8] = { "L", "R", "C", "LFE", "BL", "BR", "SL", "SR" };
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
//========================================================================== //==========================================================================
@ -348,7 +355,7 @@ public:
Channel->setSpeakerMix(1, 1, 1, 1, 1, 1, 1, 1); Channel->setSpeakerMix(1, 1, 1, 1, 1, 1, 1, 1);
Channel->setVolume(volume); Channel->setVolume(volume);
// Ensure reverb is disabled. // Ensure reverb is disabled.
FMOD_REVERB_CHANNELPROPERTIES reverb = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; FMOD_REVERB_CHANNELPROPERTIES reverb = { 0, };
if (FMOD_OK == Channel->getReverbProperties(&reverb)) if (FMOD_OK == Channel->getReverbProperties(&reverb))
{ {
reverb.Room = -10000; reverb.Room = -10000;
@ -704,7 +711,11 @@ bool FMODSoundRenderer::Init()
} }
const char *wrongver = NULL; const char *wrongver = NULL;
#if FMOD_VERSION >= 0x43800
if (version < 0x43800)
#else
if (version < 0x42000) if (version < 0x42000)
#endif
{ {
wrongver = "an old"; wrongver = "an old";
} }
@ -842,7 +853,14 @@ bool FMODSoundRenderer::Init()
result = Sys->setDriver(driver); result = Sys->setDriver(driver);
} }
result = Sys->getDriver(&driver); result = Sys->getDriver(&driver);
#if FMOD_VERSION >= 0x43700
// We were built with an FMOD that only returns the control panel frequency
result = Sys->getDriverCaps(driver, &Driver_Caps, &Driver_MinFrequency, &speakermode);
Driver_MaxFrequency = Driver_MinFrequency;
#else
// We were built with an FMOD that returns a frequency range
result = Sys->getDriverCaps(driver, &Driver_Caps, &Driver_MinFrequency, &Driver_MaxFrequency, &speakermode); result = Sys->getDriverCaps(driver, &Driver_Caps, &Driver_MinFrequency, &Driver_MaxFrequency, &speakermode);
#endif
if (result != FMOD_OK) if (result != FMOD_OK)
{ {
Printf(TEXTCOLOR_BLUE"Could not ascertain driver capabilities. Some things may be weird. (Error %d)\n", result); Printf(TEXTCOLOR_BLUE"Could not ascertain driver capabilities. Some things may be weird. (Error %d)\n", result);
@ -871,7 +889,9 @@ bool FMODSoundRenderer::Init()
format = eval >= 0 ? FMOD_SOUND_FORMAT(eval) : FMOD_SOUND_FORMAT_PCM16; format = eval >= 0 ? FMOD_SOUND_FORMAT(eval) : FMOD_SOUND_FORMAT_PCM16;
eval = Enum_NumForName(ResamplerNames, snd_resampler); eval = Enum_NumForName(ResamplerNames, snd_resampler);
resampler = eval >= 0 ? FMOD_DSP_RESAMPLER(eval) : FMOD_DSP_RESAMPLER_LINEAR; resampler = eval >= 0 ? FMOD_DSP_RESAMPLER(eval) : FMOD_DSP_RESAMPLER_LINEAR;
samplerate = clamp<int>(snd_samplerate, Driver_MinFrequency, Driver_MaxFrequency); // These represented the frequency limits for hardware channels, which we never used anyway.
// samplerate = clamp<int>(snd_samplerate, Driver_MinFrequency, Driver_MaxFrequency);
samplerate = snd_samplerate;
if (samplerate == 0 || snd_samplerate == 0) if (samplerate == 0 || snd_samplerate == 0)
{ // Creative's ASIO drivers report the only supported frequency as 0! { // Creative's ASIO drivers report the only supported frequency as 0!
if (FMOD_OK != Sys->getSoftwareFormat(&samplerate, NULL, NULL, NULL, NULL, NULL)) if (FMOD_OK != Sys->getSoftwareFormat(&samplerate, NULL, NULL, NULL, NULL, NULL))
@ -922,7 +942,12 @@ bool FMODSoundRenderer::Init()
initflags = FMOD_INIT_NORMAL; initflags = FMOD_INIT_NORMAL;
if (snd_hrtf) if (snd_hrtf)
{ {
// These flags are the same thing, just with different names.
#ifdef FMOD_INIT_SOFTWARE_HRTF
initflags |= FMOD_INIT_SOFTWARE_HRTF; initflags |= FMOD_INIT_SOFTWARE_HRTF;
#else
initflags |= FMOD_INIT_HRTF_LOWPASS;
#endif
} }
if (snd_profile) if (snd_profile)
{ {
@ -1007,6 +1032,7 @@ bool FMODSoundRenderer::Init()
} }
// Create DSP units for underwater effect // Create DSP units for underwater effect
#if FMOD_VERSION < 0x43701
result = Sys->createDSPByType(FMOD_DSP_TYPE_LOWPASS, &WaterLP); result = Sys->createDSPByType(FMOD_DSP_TYPE_LOWPASS, &WaterLP);
if (result != FMOD_OK) if (result != FMOD_OK)
{ {
@ -1020,6 +1046,9 @@ bool FMODSoundRenderer::Init()
Printf(TEXTCOLOR_BLUE" Could not create underwater reverb unit. (Error %d)\n", result); Printf(TEXTCOLOR_BLUE" Could not create underwater reverb unit. (Error %d)\n", result);
} }
} }
#else
result = FMOD_ERR_UNSUPPORTED;
#endif
// Connect underwater DSP unit between PausableSFX and SFX groups, while // Connect underwater DSP unit between PausableSFX and SFX groups, while
// retaining the connection established by SfxGroup->addGroup(). // retaining the connection established by SfxGroup->addGroup().
@ -1066,6 +1095,7 @@ bool FMODSoundRenderer::Init()
WaterLP->setActive(false); WaterLP->setActive(false);
WaterLP->setParameter(FMOD_DSP_LOWPASS_CUTOFF, snd_waterlp); WaterLP->setParameter(FMOD_DSP_LOWPASS_CUTOFF, snd_waterlp);
WaterLP->setParameter(FMOD_DSP_LOWPASS_RESONANCE, 2); WaterLP->setParameter(FMOD_DSP_LOWPASS_RESONANCE, 2);
#if FMOD_VERSION < 0x43701
if (WaterReverb != NULL) if (WaterReverb != NULL)
{ {
FMOD::DSPConnection *dry; FMOD::DSPConnection *dry;
@ -1090,6 +1120,7 @@ bool FMODSoundRenderer::Init()
} }
} }
else else
#endif
{ {
result = sfx_head->addInput(WaterLP, NULL); result = sfx_head->addInput(WaterLP, NULL);
} }
@ -1209,7 +1240,6 @@ void FMODSoundRenderer::PrintStatus()
int driver; int driver;
int samplerate; int samplerate;
int numoutputchannels; int numoutputchannels;
int num2d, num3d, total;
unsigned int bufferlength; unsigned int bufferlength;
int numbuffers; int numbuffers;
@ -1233,12 +1263,6 @@ void FMODSoundRenderer::PrintStatus()
Printf ("Driver: "TEXTCOLOR_GREEN"%d"TEXTCOLOR_NORMAL" ("TEXTCOLOR_ORANGE"%s"TEXTCOLOR_NORMAL")\n", driver, name); Printf ("Driver: "TEXTCOLOR_GREEN"%d"TEXTCOLOR_NORMAL" ("TEXTCOLOR_ORANGE"%s"TEXTCOLOR_NORMAL")\n", driver, name);
DumpDriverCaps(Driver_Caps, Driver_MinFrequency, Driver_MaxFrequency); DumpDriverCaps(Driver_Caps, Driver_MinFrequency, Driver_MaxFrequency);
} }
if (FMOD_OK == Sys->getHardwareChannels(&num2d, &num3d, &total))
{
Printf (TEXTCOLOR_YELLOW "Hardware 2D channels: "TEXTCOLOR_GREEN"%d\n", num2d);
Printf (TEXTCOLOR_YELLOW "Hardware 3D channels: "TEXTCOLOR_GREEN"%d\n", num3d);
Printf (TEXTCOLOR_YELLOW "Total hardware channels: "TEXTCOLOR_GREEN"%d\n", total);
}
if (FMOD_OK == Sys->getSoftwareFormat(&samplerate, &format, &numoutputchannels, NULL, &resampler, NULL)) if (FMOD_OK == Sys->getSoftwareFormat(&samplerate, &format, &numoutputchannels, NULL, &resampler, NULL))
{ {
Printf (TEXTCOLOR_LIGHTBLUE "Software mixer sample rate: "TEXTCOLOR_GREEN"%d\n", samplerate); Printf (TEXTCOLOR_LIGHTBLUE "Software mixer sample rate: "TEXTCOLOR_GREEN"%d\n", samplerate);
@ -1276,15 +1300,6 @@ void FMODSoundRenderer::DumpDriverCaps(FMOD_CAPS caps, int minfrequency, int max
{ {
Printf("\n"); Printf("\n");
} }
if (caps & FMOD_CAPS_REVERB_EAX2) Printf(TEXTCOLOR_OLIVE " EAX2");
if (caps & FMOD_CAPS_REVERB_EAX3) Printf(TEXTCOLOR_OLIVE " EAX3");
if (caps & FMOD_CAPS_REVERB_EAX4) Printf(TEXTCOLOR_OLIVE " EAX4");
if (caps & FMOD_CAPS_REVERB_EAX5) Printf(TEXTCOLOR_OLIVE " EAX5");
if (caps & FMOD_CAPS_REVERB_I3DL2) Printf(TEXTCOLOR_OLIVE " I3DL2");
if (caps & (FMOD_CAPS_REVERB_EAX2 | FMOD_CAPS_REVERB_EAX3 | FMOD_CAPS_REVERB_EAX4 | FMOD_CAPS_REVERB_EAX5 | FMOD_CAPS_REVERB_I3DL2))
{
Printf("\n");
}
if (caps & FMOD_CAPS_REVERB_LIMITED) Printf("TEXTCOLOR_OLIVE Limited reverb\n"); if (caps & FMOD_CAPS_REVERB_LIMITED) Printf("TEXTCOLOR_OLIVE Limited reverb\n");
} }
@ -1689,7 +1704,7 @@ FISoundChannel *FMODSoundRenderer::StartSound(SoundHandle sfx, float vol, int pi
} }
if (flags & SNDF_NOREVERB) if (flags & SNDF_NOREVERB)
{ {
FMOD_REVERB_CHANNELPROPERTIES reverb = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; FMOD_REVERB_CHANNELPROPERTIES reverb = { 0, };
if (FMOD_OK == chan->getReverbProperties(&reverb)) if (FMOD_OK == chan->getReverbProperties(&reverb))
{ {
reverb.Room = -10000; reverb.Room = -10000;
@ -1809,7 +1824,7 @@ FISoundChannel *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener *
} }
if (flags & SNDF_NOREVERB) if (flags & SNDF_NOREVERB)
{ {
FMOD_REVERB_CHANNELPROPERTIES reverb = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; FMOD_REVERB_CHANNELPROPERTIES reverb = { 0, };
if (FMOD_OK == chan->getReverbProperties(&reverb)) if (FMOD_OK == chan->getReverbProperties(&reverb))
{ {
reverb.Room = -10000; reverb.Room = -10000;
@ -2180,7 +2195,7 @@ void FMODSoundRenderer::UpdateListener(SoundListener *listener)
{ {
DPrintf ("Reverb Environment %s\n", env->Name); DPrintf ("Reverb Environment %s\n", env->Name);
const_cast<ReverbContainer*>(env)->Modified = false; const_cast<ReverbContainer*>(env)->Modified = false;
Sys->setReverbProperties((FMOD_REVERB_PROPERTIES *)(&env->Properties)); SetSystemReverbProperties(&env->Properties);
PrevEnvironment = env; PrevEnvironment = env;
if (!SfxReverbHooked) if (!SfxReverbHooked)
@ -2567,23 +2582,60 @@ void FMODSoundRenderer::DrawWaveDebug(int mode)
const int window_height = 100; const int window_height = 100;
int window_size; int window_size;
int numoutchans; int numoutchans;
int y; int y, yy;
const spk *labels;
int labelcount;
if (FMOD_OK != Sys->getSoftwareFormat(NULL, NULL, &numoutchans, NULL, NULL, NULL)) if (FMOD_OK != Sys->getSoftwareFormat(NULL, NULL, &numoutchans, NULL, NULL, NULL))
{ {
return; return;
} }
// Decide on which set of labels to use.
labels = (numoutchans == 4) ? SpeakerNames4 : SpeakerNamesMore;
labelcount = MIN<int>(numoutchans, countof(SpeakerNamesMore));
// Scale all the channel windows so one group fits completely on one row, with // Scale all the channel windows so one group fits completely on one row, with
// 16 pixels of padding between each window. // 16 pixels of padding between each window.
window_size = (screen->GetWidth() - 16) / numoutchans - 16; window_size = (screen->GetWidth() - 16) / numoutchans - 16;
float *wavearray = (float*)alloca(MAX(SPECTRUM_SIZE,window_size)*sizeof(float)); float *wavearray = (float*)alloca(MAX(SPECTRUM_SIZE,window_size)*sizeof(float));
y = 16; y = 16;
y = DrawChannelGroupOutput(SfxGroup, wavearray, window_size, window_height, y, mode);
y = DrawChannelGroupOutput(MusicGroup, wavearray, window_size, window_height, y, mode >> 2); yy = DrawChannelGroupOutput(SfxGroup, wavearray, window_size, window_height, y, mode);
y = DrawSystemOutput(wavearray, window_size, window_height, y, mode >> 4); if (y != yy)
{
DrawSpeakerLabels(labels, yy-14, window_size, labelcount);
}
y = DrawChannelGroupOutput(MusicGroup, wavearray, window_size, window_height, yy, mode >> 2);
if (y != yy)
{
DrawSpeakerLabels(labels, y-14, window_size, labelcount);
}
yy = DrawSystemOutput(wavearray, window_size, window_height, y, mode >> 4);
if (y != yy)
{
DrawSpeakerLabels(labels, yy-14, window_size, labelcount);
}
}
//==========================================================================
//
// FMODSoundRenderer :: DrawSpeakerLabels
//
//==========================================================================
void FMODSoundRenderer::DrawSpeakerLabels(const spk *labels, int y, int width, int count)
{
if (labels == NULL)
{
return;
}
for (int i = 0, x = 16; i < count; ++i)
{
screen->DrawText(SmallFont, CR_LIGHTBLUE, x, y, labels[i], TAG_DONE);
x += width + 16;
}
} }
//========================================================================== //==========================================================================
@ -2716,7 +2768,7 @@ void FMODSoundRenderer::DrawWave(float *wavearray, int x, int y, int width, int
// Draw a box around the oscilloscope. // Draw a box around the oscilloscope.
screen->DrawLine(x - 1, y - 1, x + width, y - 1, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x - 1, y - 1, x + width, y - 1, -1, MAKEARGB(160, 0, 40, 200));
screen->DrawLine(x + width + 1, y - 1, x + width, y + height, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x + width, y - 1, x + width, y + height, -1, MAKEARGB(160, 0, 40, 200));
screen->DrawLine(x + width, y + height, x - 1, y + height, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x + width, y + height, x - 1, y + height, -1, MAKEARGB(160, 0, 40, 200));
screen->DrawLine(x - 1, y + height, x - 1, y - 1, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x - 1, y + height, x - 1, y - 1, -1, MAKEARGB(160, 0, 40, 200));
@ -2823,7 +2875,7 @@ void FMODSoundRenderer::DrawSpectrum(float *spectrumarray, int x, int y, int wid
// Draw a border and dark background for the spectrum. // Draw a border and dark background for the spectrum.
screen->DrawLine(x - 1, y - 1, x + width, y - 1, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x - 1, y - 1, x + width, y - 1, -1, MAKEARGB(160, 0, 40, 200));
screen->DrawLine(x + width + 1, y - 1, x + width, y + height, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x + width, y - 1, x + width, y + height, -1, MAKEARGB(160, 0, 40, 200));
screen->DrawLine(x + width, y + height, x - 1, y + height, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x + width, y + height, x - 1, y + height, -1, MAKEARGB(160, 0, 40, 200));
screen->DrawLine(x - 1, y + height, x - 1, y - 1, -1, MAKEARGB(160, 0, 40, 200)); screen->DrawLine(x - 1, y + height, x - 1, y - 1, -1, MAKEARGB(160, 0, 40, 200));
screen->Dim(MAKERGB(0,0,0), 0.3f, x, y, width, height); screen->Dim(MAKERGB(0,0,0), 0.3f, x, y, width, height);
@ -2912,17 +2964,60 @@ short *FMODSoundRenderer::DecodeSample(int outlen, const void *coded, int sizeby
void FMODSoundRenderer::InitCreateSoundExInfo(FMOD_CREATESOUNDEXINFO *exinfo) const void FMODSoundRenderer::InitCreateSoundExInfo(FMOD_CREATESOUNDEXINFO *exinfo) const
{ {
#if FMOD_VERSION >= 0x42600 memset(exinfo, 0, sizeof(*exinfo));
if (ActiveFMODVersion < 0x42600) #if FMOD_VERSION >= 0x42600 && FMOD_VERSION < 0x43800
{ if (ActiveFMODVersion < 0x42600)
// This parameter was added for 4.26.00, and trying to pass it to older {
// DLLs will fail. // This parameter was added for 4.26.00, and trying to pass it to older
exinfo->cbsize = myoffsetof(FMOD_CREATESOUNDEXINFO, ignoresetfilesystem); // DLLs will fail.
} exinfo->cbsize = myoffsetof(FMOD_CREATESOUNDEXINFO, ignoresetfilesystem);
else }
else
#endif #endif
{ {
exinfo->cbsize = sizeof(*exinfo); exinfo->cbsize = sizeof(*exinfo);
} }
memset((BYTE *)exinfo + sizeof(exinfo->cbsize), 0, exinfo->cbsize - sizeof(exinfo->cbsize));
} }
//==========================================================================
//
// FMODSoundRenderer :: SetSystemReverbProperties
//
// Set the global reverb properties.
//
//==========================================================================
FMOD_RESULT FMODSoundRenderer::SetSystemReverbProperties(const REVERB_PROPERTIES *props)
{
#if FMOD_VERSION < 0x43800
return Sys->setReverbProperties((const FMOD_REVERB_PROPERTIES *)props);
#else
// The reverb format changed when hardware mixing support was dropped, because
// all EAX-only properties were removed from the structure.
FMOD_REVERB_PROPERTIES fr;
fr.Instance = props->Instance;
fr.Environment = props->Environment;
fr.EnvDiffusion = props->EnvDiffusion;
fr.Room = props->Room;
fr.RoomHF = props->RoomHF;
fr.RoomLF = props->RoomLF;
fr.DecayTime = props->DecayTime;
fr.DecayHFRatio = props->DecayHFRatio;
fr.DecayLFRatio = props->DecayLFRatio;
fr.Reflections = props->Reflections;
fr.ReflectionsDelay = props->ReflectionsDelay;
fr.Reverb = props->Reverb;
fr.ReverbDelay = props->ReverbDelay;
fr.ModulationTime = props->ModulationTime;
fr.ModulationDepth = props->ModulationDepth;
fr.HFReference = props->HFReference;
fr.LFReference = props->LFReference;
fr.Diffusion = props->Diffusion;
fr.Density = props->Density;
fr.Flags = props->Flags;
return Sys->setReverbProperties(&fr);
#endif
}

View file

@ -81,6 +81,7 @@ private:
bool ReconnectSFXReverbUnit(); bool ReconnectSFXReverbUnit();
void InitCreateSoundExInfo(FMOD_CREATESOUNDEXINFO *exinfo) const; void InitCreateSoundExInfo(FMOD_CREATESOUNDEXINFO *exinfo) const;
FMOD_RESULT SetSystemReverbProperties(const REVERB_PROPERTIES *props);
bool Init (); bool Init ();
void Shutdown (); void Shutdown ();
@ -97,6 +98,10 @@ private:
int DrawSystemSpectrum(float *wavearray, int width, int height, int y, bool skip); int DrawSystemSpectrum(float *wavearray, int width, int height, int y, bool skip);
void DrawSpectrum(float *spectrumarray, int x, int y, int width, int height); void DrawSpectrum(float *spectrumarray, int x, int y, int width, int height);
typedef char spk[4];
static const spk SpeakerNames4[4], SpeakerNamesMore[8];
void DrawSpeakerLabels(const spk *labels, int y, int width, int count);
FMOD::System *Sys; FMOD::System *Sys;
FMOD::ChannelGroup *SfxGroup, *PausableSfx; FMOD::ChannelGroup *SfxGroup, *PausableSfx;
FMOD::ChannelGroup *MusicGroup; FMOD::ChannelGroup *MusicGroup;

View file

@ -78,11 +78,11 @@ void STACK_ARGS DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, B
// //
// Write a string using the given font // Write a string using the given font
// //
void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, const char *string, ...) void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag1, va_list taglist)
{ {
va_list tags;
DWORD tag;
INTBOOL boolval; INTBOOL boolval;
va_list tags;
uint32 tag;
int maxstrlen = INT_MAX; int maxstrlen = INT_MAX;
int w, maxwidth; int w, maxwidth;
@ -117,8 +117,12 @@ void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, c
maxwidth = Width; maxwidth = Width;
scalex = scaley = 1; scalex = scaley = 1;
va_start (tags, string); #ifndef NO_VA_COPY
tag = va_arg (tags, DWORD); va_copy(tags, taglist);
#else
tags = taglist;
#endif
tag = tag1;
while (tag != TAG_DONE) while (tag != TAG_DONE)
{ {
@ -203,7 +207,7 @@ void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, c
height = va_arg (tags, int); height = va_arg (tags, int);
break; break;
} }
tag = va_arg (tags, DWORD); tag = va_arg (tags, uint32);
} }
height *= scaley; height *= scaley;
@ -233,8 +237,12 @@ void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, c
if (NULL != (pic = font->GetChar (c, &w))) if (NULL != (pic = font->GetChar (c, &w)))
{ {
va_list taglist; #ifndef NO_VA_COPY
va_start (taglist, string); va_copy(tags, taglist);
#else
tags = taglist;
#endif
tag = tag1;
if (forcedwidth) if (forcedwidth)
{ {
w = forcedwidth; w = forcedwidth;
@ -242,20 +250,35 @@ void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, c
DTA_Translation, range, DTA_Translation, range,
DTA_DestWidth, forcedwidth, DTA_DestWidth, forcedwidth,
DTA_DestHeight, height, DTA_DestHeight, height,
TAG_MORE, &taglist); TAG_MORE, &tags);
} }
else else
{ {
DrawTexture (pic, cx, cy, DrawTexture (pic, cx, cy,
DTA_Translation, range, DTA_Translation, range,
TAG_MORE, &taglist); TAG_MORE, &tags);
} }
va_end (taglist); va_end (tags);
} }
cx += (w + kerning) * scalex; cx += (w + kerning) * scalex;
} }
} }
void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...)
{
va_list tags;
va_start(tags, tag);
DrawTextV(font, normalcolor, x, y, string, tag, tags);
}
// A synonym so that this can still be used in files that #include Windows headers
void STACK_ARGS DCanvas::DrawTextA (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...)
{
va_list tags;
va_start(tags, tag);
DrawTextV(font, normalcolor, x, y, string, tag, tags);
}
// //
// Find string width using this font // Find string width using this font
// //

View file

@ -214,7 +214,11 @@ public:
void VirtualToRealCoordsInt(int &x, int &y, int &w, int &h, int vwidth, int vheight, bool vbottom=false, bool handleaspect=true) const; void VirtualToRealCoordsInt(int &x, int &y, int &w, int &h, int vwidth, int vheight, bool vbottom=false, bool handleaspect=true) const;
// 2D Text drawing // 2D Text drawing
void STACK_ARGS DrawText (FFont *font, int normalcolor, int x, int y, const char *string, ...); void STACK_ARGS DrawText (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...);
#ifndef DrawText // See WinUser.h for the definition of DrawText as a macro
void STACK_ARGS DrawTextA (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...);
#endif
void DrawTextV (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, va_list tags);
void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...); void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...);
struct DrawParms struct DrawParms

View file

@ -68,7 +68,7 @@ ACTOR MapSpotGravity : MapSpot 9013
-NOGRAVITY -NOGRAVITY
} }
// Point Pushers --------------------------------------------------- // Point Pushers -----------------------------------------------------------
ACTOR PointPusher 5001 ACTOR PointPusher 5001
{ {
@ -110,7 +110,7 @@ ACTOR Gibs : RealGibs 24
ClearFlags ClearFlags
} }
// Needed for loading Build maps --------------------------------------- // Needed for loading Build maps -------------------------------------------
ACTOR CustomSprite 9988 native ACTOR CustomSprite 9988 native
{ {
@ -124,7 +124,7 @@ ACTOR CustomSprite 9988 native
} }
} }
// SwitchableDecoration: Activate and Deactivate change state --------------- // SwitchableDecoration: Activate and Deactivate change state --------------
ACTOR SwitchableDecoration native ACTOR SwitchableDecoration native
{ {
@ -135,7 +135,7 @@ ACTOR SwitchingDecoration : SwitchableDecoration native
{ {
} }
// Random spawner ----------------------------------------------------------- // Random spawner ----------------------------------------------------------
ACTOR RandomSpawner native ACTOR RandomSpawner native
{ {
@ -145,14 +145,14 @@ ACTOR RandomSpawner native
+THRUACTORS +THRUACTORS
} }
// Fast projectiles ----------------------------------------------------------- // Fast projectiles --------------------------------------------------------
ACTOR FastProjectile native ACTOR FastProjectile native
{ {
Projectile Projectile
} }
// Sector flag setter ----------------------------------------------------------- // Sector flag setter ------------------------------------------------------
ACTOR SectorFlagSetter 9041 native ACTOR SectorFlagSetter 9041 native
{ {
@ -161,3 +161,16 @@ ACTOR SectorFlagSetter 9041 native
+DONTSPLASH +DONTSPLASH
RenderStyle None RenderStyle None
} }
// Marker for sounds -------------------------------------------------------
ACTOR SpeakerIcon : Unknown
{
States
{
Spawn:
SPKR A -1 BRIGHT
Stop
}
Scale 0.125
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

File diff suppressed because it is too large Load diff