diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index d424be45d..5b2e4e7c1 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -511,8 +511,6 @@ int S_AddSoundLump (const char *logicalname, int lump) newsfx.LimitRange = 256*256; newsfx.bRandomHeader = false; newsfx.bPlayerReserve = false; - newsfx.bForce11025 = false; - newsfx.bForce22050 = false; newsfx.bLoadRAW = false; newsfx.bPlayerCompat = false; newsfx.b16bit = false; @@ -520,6 +518,7 @@ int S_AddSoundLump (const char *logicalname, int lump) newsfx.bSingular = false; newsfx.bTentative = false; newsfx.bPlayerSilent = false; + newsfx.RawRate = 0; newsfx.link = sfxinfo_t::NO_LINK; newsfx.Rolloff.RolloffType = ROLLOFF_Doom; newsfx.Rolloff.MinDistance = 0; @@ -1414,13 +1413,17 @@ static void S_AddBloodSFX (int lumpnum) { const char *name = Wads.GetLumpFullName(lumpnum); sfxnum = S_AddSound(name, rawlump); - if (sfx->Format == 5) - { - S_sfx[sfxnum].bForce22050 = true; + if (sfx->Format < 5 || sfx->Format > 12) + { // [0..4] + invalid formats + S_sfx[sfxnum].RawRate = 11025; } - else // I don't know any other formats for this - { - S_sfx[sfxnum].bForce11025 = true; + else if (sfx->Format < 9) + { // [5..8] + S_sfx[sfxnum].RawRate = 22050; + } + else + { // [9..12] + S_sfx[sfxnum].RawRate = 44100; } S_sfx[sfxnum].bLoadRAW = true; S_sfx[sfxnum].LoopStart = LittleLong(sfx->LoopStart); diff --git a/src/s_sound.cpp b/src/s_sound.cpp index d1c313967..32a245675 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1334,7 +1334,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx) if (sfx->bLoadRAW) { len = Wads.LumpLength (sfx->lumpnum); - frequency = (sfx->bForce22050 ? 22050 : 11025); + frequency = sfx->RawRate; } else { diff --git a/src/s_sound.h b/src/s_sound.h index 346e51ce1..da8bf3cbc 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -49,8 +49,6 @@ struct sfxinfo_t WORD bRandomHeader:1; WORD bPlayerReserve:1; - WORD bForce11025:1; - WORD bForce22050:1; WORD bLoadRAW:1; WORD bPlayerCompat:1; WORD b16bit:1; @@ -59,6 +57,8 @@ struct sfxinfo_t WORD bTentative:1; 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 unsigned int link;