Correctly assign the sample rate for all Blood SFX formats

- Blood can do 44100 Hz sounds!
This commit is contained in:
Randy Heit 2014-07-29 21:09:29 -05:00
parent e0e00c4f8c
commit 449a17c2f4
3 changed files with 14 additions and 11 deletions

View file

@ -511,8 +511,6 @@ int S_AddSoundLump (const char *logicalname, int lump)
newsfx.LimitRange = 256*256; newsfx.LimitRange = 256*256;
newsfx.bRandomHeader = false; newsfx.bRandomHeader = false;
newsfx.bPlayerReserve = false; newsfx.bPlayerReserve = false;
newsfx.bForce11025 = false;
newsfx.bForce22050 = false;
newsfx.bLoadRAW = false; newsfx.bLoadRAW = false;
newsfx.bPlayerCompat = false; newsfx.bPlayerCompat = false;
newsfx.b16bit = false; newsfx.b16bit = false;
@ -520,6 +518,7 @@ int S_AddSoundLump (const char *logicalname, int lump)
newsfx.bSingular = false; newsfx.bSingular = false;
newsfx.bTentative = false; newsfx.bTentative = false;
newsfx.bPlayerSilent = false; newsfx.bPlayerSilent = false;
newsfx.RawRate = 0;
newsfx.link = sfxinfo_t::NO_LINK; newsfx.link = sfxinfo_t::NO_LINK;
newsfx.Rolloff.RolloffType = ROLLOFF_Doom; newsfx.Rolloff.RolloffType = ROLLOFF_Doom;
newsfx.Rolloff.MinDistance = 0; newsfx.Rolloff.MinDistance = 0;
@ -1414,13 +1413,17 @@ static void S_AddBloodSFX (int lumpnum)
{ {
const char *name = Wads.GetLumpFullName(lumpnum); const char *name = Wads.GetLumpFullName(lumpnum);
sfxnum = S_AddSound(name, rawlump); sfxnum = S_AddSound(name, rawlump);
if (sfx->Format == 5) if (sfx->Format < 5 || sfx->Format > 12)
{ { // [0..4] + invalid formats
S_sfx[sfxnum].bForce22050 = true; S_sfx[sfxnum].RawRate = 11025;
} }
else // I don't know any other formats for this else if (sfx->Format < 9)
{ { // [5..8]
S_sfx[sfxnum].bForce11025 = true; S_sfx[sfxnum].RawRate = 22050;
}
else
{ // [9..12]
S_sfx[sfxnum].RawRate = 44100;
} }
S_sfx[sfxnum].bLoadRAW = true; S_sfx[sfxnum].bLoadRAW = true;
S_sfx[sfxnum].LoopStart = LittleLong(sfx->LoopStart); S_sfx[sfxnum].LoopStart = LittleLong(sfx->LoopStart);

View file

@ -1334,7 +1334,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
if (sfx->bLoadRAW) if (sfx->bLoadRAW)
{ {
len = Wads.LumpLength (sfx->lumpnum); len = Wads.LumpLength (sfx->lumpnum);
frequency = (sfx->bForce22050 ? 22050 : 11025); frequency = sfx->RawRate;
} }
else else
{ {

View file

@ -49,8 +49,6 @@ struct sfxinfo_t
WORD bRandomHeader:1; WORD bRandomHeader:1;
WORD bPlayerReserve:1; WORD bPlayerReserve:1;
WORD bForce11025:1;
WORD bForce22050:1;
WORD bLoadRAW:1; WORD bLoadRAW:1;
WORD bPlayerCompat:1; WORD bPlayerCompat:1;
WORD b16bit:1; WORD b16bit:1;
@ -59,6 +57,8 @@ struct sfxinfo_t
WORD bTentative:1; WORD bTentative:1;
WORD bPlayerSilent:1; // This player sound is intentionally silent. WORD bPlayerSilent:1; // This player sound is intentionally silent.
WORD RawRate; // Sample rate to use when bLoadRAW is true
int LoopStart; // -1 means no specific loop defined int LoopStart; // -1 means no specific loop defined
unsigned int link; unsigned int link;