From 5f746bea5e3bca2d3126411bc0bd36ff44175a8f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 11 Mar 2008 03:19:16 +0000 Subject: [PATCH] - Fixed: Sounds apparently don't default to location 0,0,0 so I need to set that explicitly for 2D sounds in 3D mode. - Fixed: I had forgotten to actually set the head relative flag for 2D sounds played in 3D. - Fixed: Reverb was applied to digital music in software 3D mode. SVN r793 (trunk) --- docs/rh-log.txt | 12 ++++++++++++ src/sound/fmodsound.cpp | 21 ++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 89a54bae7..93cbb037f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,15 @@ +March 10, 2008 +- EAX is a pain in the butt to get it to work reliably. Why? I can get the + reverb to work just fine with software, but with hardware, I hear nothing + special at all. +- Fixed: Sounds apparently don't default to location 0,0,0 so I need to set + that explicitly for 2D sounds in 3D mode. +- Fixed: I had forgotten to actually set the head relative flag for 2D sounds + played in 3D. +- Fixed: Reverb was applied to digital music in software 3D mode. I tried + turning off reverb for 2D sounds too, but that turned it off for _all_ + subsequent sounds and not that specific channel. + March 9, 2008 (Changes by Graf Zahl) - fixed: StreamSong::SetPosition required a NULL pointer check. - fixed: The release build still linked to the old FMOD version. diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 90292e7e9..9e75cf065 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -277,8 +277,15 @@ public: } Channel->setChannelGroup(Owner->MusicGroup); Channel->setVolume(volume); - Channel->setPaused(false); - + if (Owner->Sound3D) + { // Ensure reverb is disabled when using 3D sound. + FMOD_REVERB_CHANNELPROPERTIES reverb; + if (FMOD_OK == Channel->getReverbProperties(&reverb)) + { + reverb.Room = -10000; + Channel->setReverbProperties(&reverb); + } + } if (normalize) { // Attach a normalizer DSP unit to the channel. result = Owner->Sys->createDSPByType(FMOD_DSP_TYPE_NORMALIZE, &DSP); @@ -287,6 +294,7 @@ public: Channel->addDSP(DSP); } } + Channel->setPaused(false); return true; } @@ -891,16 +899,19 @@ long FMODSoundRenderer::StartSound(sfxinfo_t *sfx, float vol, float sep, int pit chan->setFrequency(freq); chan->setVolume(vol); chan->setPan(sep); - chan->setPaused(false); if (Sound3D) - { + { // Make 2D sounds head relative. FMOD_MODE mode; if (FMOD_OK == chan->getMode(&mode)) { mode = (mode & ~FMOD_3D_WORLDRELATIVE) | (FMOD_3D_HEADRELATIVE); + chan->setMode(mode); } + FMOD_VECTOR zero = { 0, 0, 0 }; + chan->set3DAttributes(&zero, &zero); } + chan->setPaused(false); ChannelMap[channel].channelID = chan; ChannelMap[channel].soundID = id; ChannelMap[channel].bIsLooping = looping; @@ -952,7 +963,7 @@ void FMODSoundRenderer::StopSound(long handle) { ChannelMap[handle].channelID->stop(); UncheckSound(&S_sfx[ChannelMap[handle].soundID], ChannelMap[handle].bIsLooping); - ChannelMap[handle].soundID = 0; + ChannelMap[handle].soundID = -1; } }