Skip to content

Commit

Permalink
Added: Console variable "sound-overlap-stop" (default: 1)
Browse files Browse the repository at this point in the history
Determines if the "one sound per origin" rule is in effect. That is,
if set to 1, any currently playing sound from an emitter object is
stopped if a new sound starts playing from the same emitter.
  • Loading branch information
skyjake committed Mar 7, 2012
1 parent 17ee0d9 commit 607e6a9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doomsday/engine/data/cphelp.txt
Expand Up @@ -930,6 +930,9 @@ desc = Sound effects sample rate (11025, 22050, 44100).
[sound-16bit]
desc = 1=16-bit sound effects/resampling.

[sound-overlap-stop]
desc = 1=Only allow one sound per emitter object (as in traditional Doom).

[sound-3d]
desc = 1=Play sound effects in 3D.

Expand Down
1 change: 1 addition & 0 deletions doomsday/engine/portable/include/s_sfx.h
Expand Up @@ -60,6 +60,7 @@ extern float sfxReverbStrength;
extern int sfxMaxCacheKB, sfxMaxCacheTics;
extern int sfxBits, sfxRate;
extern int sfx3D, sfx16Bit, sfxSampleRate;
extern byte sfxOneSoundPerEmitter;

boolean Sfx_Init(void);
void Sfx_Shutdown(void);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/s_logic.c
Expand Up @@ -153,7 +153,7 @@ void Sfx_StartLogical(int id, mobj_t *origin, boolean isRepeating)
return;
}

if(origin)
if(origin && sfxOneSoundPerEmitter)
{
// Stop all previous sounds from this origin (only one per origin).
Sfx_StopLogical(0, origin);
Expand Down
1 change: 1 addition & 0 deletions doomsday/engine/portable/src/s_main.c
Expand Up @@ -94,6 +94,7 @@ void S_Register(void)
C_VAR_INT("sound-rate", &sfxSampleRate, 0, 11025, 44100);
C_VAR_INT("sound-16bit", &sfx16Bit, 0, 0, 1);
C_VAR_INT("sound-3d", &sfx3D, 0, 0, 1);
C_VAR_BYTE("sound-overlap-stop", &sfxOneSoundPerEmitter, 0, 0, 1);
C_VAR_FLOAT2("sound-reverb-volume", &sfxReverbStrength, 0, 0, 10, S_ReverbVolumeChanged);

// Ccmds
Expand Down
3 changes: 2 additions & 1 deletion doomsday/engine/portable/src/s_sfx.c
Expand Up @@ -73,6 +73,7 @@ int sfxRate = 11025;
int sfx3D = false;
int sfx16Bit = false;
int sfxSampleRate = 11025;
byte sfxOneSoundPerEmitter = true;

// PRIVATE DATA DEFINITIONS ------------------------------------------------

Expand Down Expand Up @@ -654,7 +655,7 @@ int Sfx_StartSound(sfxsample_t* sample, float volume, float freq,
volume <= 0)
return false;

if(emitter)
if(emitter && sfxOneSoundPerEmitter)
{
// Stop any other sounds from the same origin. Only one sound is
// allowed per emitter.
Expand Down

0 comments on commit 607e6a9

Please sign in to comment.