Commit Graph

36 Commits

Author SHA1 Message Date
Randy Heit 51eb6465a2 - Fixed two bugs in FMODSoundRenderer::HandleChannelDelay():
* Looping sounds that have been playing for a very long time, were evicted,
    and then were restarted need to have their positions clamped to lie
    within the bounds of the sounds. If we try to set a start position very
    far beyond the end, it will overflow inside FMOD and not work.
  * A start time of 0 is not actually valid and means the sound was never
    assigned a start time.
- The latter bug also reveals a problem with starting looped sounds evicted:
  They need to be assigned a start time so if they should have the opportunity
  to start later, they will be properly synchronized.


SVN r1987 (trunk)
2009-11-18 04:45:20 +00:00
Randy Heit fb74d9b1ec - Added virtual status and audibility to the noise debug display.
SVN r1961 (trunk)
2009-11-04 02:07:39 +00:00
Randy Heit 50b0340a56 - Fixed: S_EvictAllChannels() must replace the channel's start time with its
position when evicting sounds, because restarting the sound system causes
  the DSP clock to restart at 0, so start times that were recorded before
  the reset are no longer applicable after the reset.
- Fixed: S_StopChannel() always set the channel's actor to NULL, eliminating
  origin information when resetting the sound system.


SVN r1949 (trunk)
2009-10-30 02:18:07 +00:00
Randy Heit f74f6a1659 - Split the joystick menu into two parts: A top level with general options
and a list of all attached controllers, and a second level for configuring
  an individual controller.
- Fixed: Pressing Up at the top of a menu with more lines than fit on screen
  would find an incorrect bottom position if the menu had a custom top height.
- Added the cvars joy_dinput, joy_ps2raw, and joy_xinput to enable/disable
  specific game controller input systems independant of each other.
- Device change broadcasts are now sent to the Doom event queue, so
  device scanning can be handled in one common place.
- Added a fast version of IsXInputDevice that uses the Raw Input device
  list, because querying WMI for this information is painfully slow.
- Added support for compiling with FMOD Ex 4.26+ and running the game
  with an older DLL. This combination will now produce sound.


SVN r1717 (trunk)
2009-07-15 05:53:06 +00:00
Randy Heit ae2c4a6dbc - Relaxed the FMOD version check. Anything from 4.20.00 through 4.26.xx should work
for both building and running now.

SVN r1712 (trunk)
2009-07-06 23:42:00 +00:00
Randy Heit aee99c2bd0 - Added an SDL output plugin, so FMOD can produce sound using SDL's audio
support instead of its own OSS/ALSA/ESD support. This is selectable by
  setting snd_output to "sdl".



SVN r1473 (trunk)
2009-03-11 04:56:43 +00:00
Randy Heit 4535382031 - The SFX Reverb unit is now moved so that it serves as an input to the water
effect rather than as an input to the ChannelGroup Target Unit. This means
  the water effect is now applied after any room reverb, rather than in
  parallel with it.
- Fixed: UI sounds should not have reverb applied to them.


SVN r1450 (trunk)
2009-02-26 06:23:05 +00:00
Randy Heit 3b4479df44 - Removed GC barriers from the sound channels. If we must, we can always
do it the old way and scan every channel to see if it matches an actor/
  entchannel pair.
- Fixed: S_RelinkSounds() did not move the SoundChans bitfield to the new
  actor.
- Fixed: Stolen channels could be kept around by the high-level channels
  indefinitely.


SVN r1289 (trunk)
2008-11-15 01:01:04 +00:00
Randy Heit c1cefee2f4 - Made sdl/i_system.cpp:I_GetTimePolled() functionally equivalent to the
Win32 version.
- Updated fmod_wrap.h and fmodsound.cpp for FMOD 4.20.
- GCC warning removal.


SVN r1286 (trunk)
2008-11-09 05:50:54 +00:00
Christoph Oelckers d1f8518a79 - Separated low level sound code from all high level dependencies.
SVN r1228 (trunk)
2008-09-15 18:18:04 +00:00
Christoph Oelckers 5d9483b632 - Moved some more high level sound logic out of FMODSoundRenderer:
The rolloff and channel ended callbacks now call functions in s_sound.cpp
  instead of working on the data itself and GSnd->StopSound has been replaced
  with S_StopChannel.


SVN r1227 (trunk)
2008-09-15 16:02:05 +00:00
Christoph Oelckers e033cbf9f8 - Since loading of the sound lump is now done in S_LoadSound I added an IsNull
method to the SoundRenderer class so that this function doesn't need to 
  load the sound for the NullSoundRenderer.
- Took some more non-FMOD related code out of fmodsound.cpp, including the
  code that checks for raw and Doom sounds. This means that sfxinfo_t is no
  longer needed in the SoundRenderer class so I took out all references to it.


SVN r1208 (trunk)
2008-09-09 20:49:53 +00:00
Christoph Oelckers 3b35ad2db2 - Fixed: FMODSoundRenderer::StartSound3D must set the static variable pointing
to the rolloff information back to NULL when starting the sound fails.
- Fixed: Rolloff information was taken from the sfxinfo that contained the
  actual sound data, not the one that was used for starting the sound.



SVN r1206 (trunk)
2008-09-09 09:22:47 +00:00
Christoph Oelckers 2df65c70cb - Fixed: GetMSLength didn't resolve random and player sounds.
- Moved sound aliasing code out of fmodsound.cpp into S_LoadSound.


SVN r1203 (trunk)
2008-09-07 14:45:50 +00:00
Christoph Oelckers bcbd2162b7 - Changed sound interface so that all references to game data like actors
and sectors are done in s_sound.cpp and not in fmodsound.cpp. Also removed
  several 'sector' parameters because they were never used inside the sound code.


SVN r1200 (trunk)
2008-09-06 11:07:27 +00:00
Randy Heit 78890d57bc - Fixed: Screenwipes now pause sounds, since there can be sounds playing
during it.
- UI sounds are now omitted from savegames.
- Fixed: Menu sounds had been restricted to one at a time again.
- Moved the P_SerializeSounds() call to the end of G_SerializeLevel() so that
  it will occur after the players are loaded.
- Added fixes from FreeBSD for 0-length and very large string buffers
  passed to myvsnprintf.


SVN r1063 (trunk)
2008-07-05 03:32:44 +00:00
Randy Heit a3e8a0cefd - Removed the S_Sound() variant that allows for pointing the origin at an
arbitrary point. It has been replaced with a variant that takes a polyobject
  as a source, since that was the only use that couldn't be rewritten with the
  other variants. This also fixes the bug that polyobject sounds were not
  successfully saved and caused a crash when reloading the game. Note that
  this is a significant change to how equality of sound sources is determined,
  so some things may not behave quite the same as before. (Which would be a
  bug, but hopefully everything still sounds the same.)


SVN r1059 (trunk)
2008-07-01 04:06:56 +00:00
Randy Heit d0b2c41270 - The sound code now handles restarting looping sounds itself. As far as
the rest of the game is concerned, these sounds will never stop once they
  have been started until they are explicitly stopped. If they are evicted
  from their channels, the sound code will restart them as soon as possible.
  This means that instead of this:
	if (!S_IsActorPlayingSomething(actor, CHAN_WEAPON, -1))
	{
		S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
	}
  The following is now just as effective:
	S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
  There are also a couple of other ramifications presented by this change:
    * The full state of the sound system (sans music) is now stored in save
      games. Any sounds that were playing when you saved will still be
      playing when you load. (Try saving while Korax is making a speech in
      Hexen to hear it.)
    * Using snd_reset will also preserve any playing sounds.
    * Movie playback is disabled, probably forever. I did not want to 
      update the MovieDisable/ResumeSound stuff for the new eviction
      tracking code. A properly updated movie player will use the VMR,
      which doesn't need these functions, since it would pipe the sound
      straight through the sound system like everything else, so I decided
      to dump them now, which leaves the movie player in a totally unworkable
      state.

June 26, 2008
- Changed S_Sound() to take the same floating point attenuation that the
  internal S_StartSound() uses. Now ambient sounds can use the public
  S_Sound() interface.
- Fixed: S_RelinkSound() compared the points of the channels against the
  from actor's point, rather than checking the channels' mover.
- Changed Strife's animated doors so that their sounds originate from the
  interior of the sector making them and not from the entire vertical height
  of the map.


SVN r1055 (trunk)
2008-06-29 04:19:38 +00:00
Randy Heit 9e42cdaf08 - Replaced the naive area sound implementation with one that takes into
consideration the size and shape of the sector producing the sound. See
  the lifts on Doom 2 MAP30 and compare with previous versions.
- Fixed: The stop sound for sector-based sound sequences was not played with
  the CHAN_AREA flag.
- Removed the distinction between S_Sound() and S_SoundID() functions. Use
  S_Sound() for both names and IDs from now on.


SVN r1034 (trunk)
2008-06-15 02:25:09 +00:00
Randy Heit d657e31a8c - Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.


SVN r1005 (trunk)
2008-05-31 02:18:09 +00:00
Randy Heit 01f59fa85f - Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
  It has been slightly modified by me:
  * Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
  * Removed excessive mallocs from the replay core.
  * Rerolled the loops in resample.c. Unrolling them made the object file
    ~250k large while providing little benefit. Even at ~100k, I think it's
    still larger than it ought to be, but I'll live with it for now.
  Other than that, it's essentially the same thing you'd hear in foobar2000,
  minus some subsong detection features. Release builds of the library look
  like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.


SVN r995 (trunk)
2008-05-29 23:33:07 +00:00
Randy Heit 5a066788b5 - Revised underwater effect now uses a lowpass filter in combination with an
optional freeverb unit.
- Removed ResetEnvironment hack, since with software reverb, losing the
  existing reverb when focus is lost isn't a problem.
- Commented out the TiMidity FIXME messages.


SVN r973 (trunk)
2008-05-15 04:51:57 +00:00
Randy Heit 03b4f71edf - Reduced the range that area sounds require to interpolate between 2D and
3D panning.
- The listener's velocity is now set at 0 for the sound engine. The player
  moves so fast that you can hear the doppler shift just by running around,
  otherwise.
- Changed the sound code so that all sounds that start playing on a single
  tic actually start playing at the exact same sample position.


SVN r927 (trunk)
2008-04-19 22:47:54 +00:00
Randy Heit 10c0d67b78 - Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
  event which only has a 1 in 127 chance of being for a note that's playing
  on that channel. Then I decided it would probably be a good idea to reset
  all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
  (copied from the OPL player) improved its sound dramatically, so apparently
  Timidity has issues with short stream buffers. It's now at 1/2 sec in
  length. However, there seems to be something weird going on with
  corazonazul_ff6boss.mid near the beginning where it stops and immediately
  restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
  oscilloscopes and spectrums.
- Internal TiMidity now plays music.
- Changed the progdir global variable into an FString.

SVN r900 (trunk)
2008-04-11 04:59:23 +00:00
Randy Heit 8f49ea7f48 - Changed the output of the OPL emulator from 32-bit integers to 32-bit
floats, so I can write its output directly to the stream buffer. In
  addition, this lets me bring the OPL volume level much closer to the
  standard MIDI volume.


SVN r863 (trunk)
2008-03-29 01:30:37 +00:00
Randy Heit aef34f9aa5 - Removed xlat_parser.h from the repository. Lemon was always being run on
xlat_parser.y because both files had the same time stamp after an update,
  and Lemon only rewrites the header file if it's changed.
- Added $volume SNDINFO command. This is multiplied with the volume the sound
  is played at to arrive at the final volume (before distance attenuation).
- Added the CHAN_AREA flag to disable 3D panning within the min distance of a
  sound. Sector sound sequences (except doors) use this flag.
- Added the CHAN_LOOP flag to replace the S_Looped* sound functions.
- Restored the sound limiting.


SVN r849 (trunk)
2008-03-25 04:42:26 +00:00
Randy Heit 84d125cf21 - Fixed: Actor-less sounds that aren't played on CHAN_AUTO should still be
subject to channel overriding.
- Re-added priority selection based on sound usage.
- Reduced the number of virtual channels to match the number of real
  channels.
- Added customizable rolloff, including Doom's standard linear gain rolloff.
  SNDINFO commands are:
    $rolloff <sound> <min distance> <max distance>          -- linear gain (like Doom)
    $rolloff <sound> linear <min distance> <max distance>   -- linear volume
    $rolloff <sound> log <min distance> <rolloff factor>    -- logarithmic
    $rolloff <sound> custom <min distance> <max distance>   -- use SNDCURVE lump
  Anything closer than min distance is full volume and anything further than
  max distance is inaudible. Logarithmic rolloff does not have a maximum
  distance; it has a scalar that controls how quickly the volume drops off
  instead.


SVN r834 (trunk)
2008-03-22 03:33:41 +00:00
Randy Heit 10920ffe75 - Removed some debug output from SBarInfo::ParseSBarInfo().
- Fixed: Heretic linetype translations included the wrong file.
- Removed all 2D sound positioning code from s_sound.cpp. Everything uses
  FMOD's 3D engine now.
- Removed all the channel selection code from s_sound.cpp. FMOD has code to
  handle this sort of thing, so let's use it.
- Replaced S_StopSoundID() with S_CheckSingular(). There is no longer a limit
  on the number of copies of a particular sound that can be playing at once,
  aside from Strife's special singular sounds. (Sorry, Heretic and Hexen.)
  Consequently, the SNDINFO $limit command is now ignored.
- Removed ATTN_SURROUND, since FMOD Ex doesn't exactly support it, and it
  only worked as intended on stereo speakers anyway.
- Cleaned out ancient crud from i_sound.cpp.


SVN r826 (trunk)
2008-03-21 05:13:59 +00:00
Randy Heit 087e34bbb3 - Fixed: The source no longer built with GCC.
- Added a cheap pitch shifting for underwater environments that should be fairly
  close to Duke's. It sounds okay for some sounds, but others like the BFG, where
  the timing of the sound actually matters, don't sound good. I shall have to
  replace it with a real pitch shifter DSP unit.


SVN r819 (trunk)
2008-03-19 23:03:14 +00:00
Randy Heit 2b721975dd 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)
2008-03-09 03:13:49 +00:00
Randy Heit 58d4c4f9ae - Fixed: S_ClearSoundData() did not stop any channels before freeing the
samples, a problem for the alternate sound renderer if it happened to be
  playing any sounds at the time, since it would try to keep on playing them.

SVN r483 (trunk)
2007-02-14 20:18:22 +00:00
Randy Heit c412b42703 - Fixed: cycle_t was still a DWORD and not a QWORD under GCC.
- The stat meters now return an FString instead of sprintfing into a fixed
  output buffer.
- NOASM is now automatically defined when compiling for a non-x86 target.
- Some changes have been made to the integral types in doomtype.h:
  - For consistancy with the other integral types, byte is no longer a
    synonym for BYTE.
  - Most uses of BOOL have been change to the standard C++ bool type. Those
    that weren't were changed to INTBOOL to indicate they may contain values
    other than 0 or 1 but are still used as a boolean.
  - Compiler-provided types with explicit bit sizes are now used. In
    particular, DWORD is no longer a long so it will work with both 64-bit
    Windows and Linux.
  - Since some files need to include Windows headers, uint32 is a synonym
    for the non-Windows version of DWORD.
- Removed d_textur.h. The pic_t struct it defined was used nowhere, and that
  was all it contained.


SVN r326 (trunk)
2006-09-14 00:02:31 +00:00
Randy Heit 9fdcb553aa - Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
  same situation that causes the keyboard to return DIERR_NOTACQUIRED in
  KeyRead(): The window is sort of in focus and sort of not. User.dll
  considers it to be focused and it's drawn as such, but another focused
  window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
  handles DIERR_INPUTLOST errors. This can happen if our window had the
  focus stolen away from it before we tried to acquire the keyboard in
  DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
  last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
  taking too long on large dumps.
- And now I know why gathering crash information in the same process that
  crashed can be bad: Stack overflows. You get one spare page to play with
  when the stack overflows. MiniDumpWriteDump() needs more than that and
  causes an access violation when it runs out of leftover stack, silently
  terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
  to increase this, but that isn't available on anything older, including
  32-bit XP. To get around this, a new thread is created to write the mini
  dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
  associated call to SpawnBot(). So if the bot can't spawn, botnum can
  go negative, which will cause problems later in DCajunMaster::Main()
  when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
  drop the recorder out of the game without notifying the other players.
  In fact, there's no reason why it should drop them out of multiplayer at
  all.
- Fixed: Earthquakes were unreliable in multiplayer games because
  P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
  who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
  in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
  and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
  directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
  per-application. So if you play a multiplayer ZDoom game on one computer
  (or even another EAX-using application), ZDoom needs to restore the
  environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
  PacketGet can receive ECONNRESET from nodes that aren't in the game. It
  should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
  the player who left was player 0. This is because if a remaining player
  receives a "recoverable" error, they will become player 0. Once that happens,
  they game will try to update sounds through their camera and crash in
  FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
  G_NewInit() should also clear all the player structures.


SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
Randy Heit cb18719d05 - Fixed: The new sound pausing on menu open interrupted Strife conversations.
- Did some very preliminary support for x64 compiling.
- Now I see why makewad is using the __fastcall calling convention by default:
  Because the release zlib is built with it as well.
- Fixed: Conversion from 'const char *' to 'char *' in DEM_SAVEGAME case in
  Net_DoCommand().
- Updated the project files for Visual C++ 2005.


SVN r138 (trunk)
2006-05-23 04:25:49 +00:00
Randy Heit 62b7dd3efc - Fixed default.cbd and Makefile.mingw for current code state.
- New: Pausing the game (through any means, not just the pause key) now pauses
  sound effects as well as music. "PauseMusicInMenus" has been added as a
  MAPINFO flag to also pause the music when a menu or the console are open.


SVN r134 (trunk)
2006-05-21 02:10:16 +00:00
Randy Heit cf11cbdb30 Directory restructuring to make it easier to version projects that don't build zdoom.exe.
SVN r4 (trunk)
2006-02-24 04:48:15 +00:00