mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- Added support for Blood's SFX loop start markers.
SVN r2221 (trunk)
This commit is contained in:
parent
aedb646a52
commit
740d52cf5b
7 changed files with 33 additions and 13 deletions
|
@ -509,6 +509,7 @@ int S_AddSoundLump (const char *logicalname, int lump)
|
|||
newsfx.Rolloff.RolloffType = ROLLOFF_Doom;
|
||||
newsfx.Rolloff.MinDistance = 0;
|
||||
newsfx.Rolloff.MaxDistance = 0;
|
||||
newsfx.LoopStart = -1;
|
||||
|
||||
return (int)S_sfx.Push (newsfx);
|
||||
}
|
||||
|
@ -1366,18 +1367,15 @@ static void S_AddSNDINFO (int lump)
|
|||
|
||||
static void S_AddBloodSFX (int lumpnum)
|
||||
{
|
||||
char name[13];
|
||||
FMemLump sfxlump = Wads.ReadLump (lumpnum);
|
||||
FMemLump sfxlump = Wads.ReadLump(lumpnum);
|
||||
const FBloodSFX *sfx = (FBloodSFX *)sfxlump.GetMem();
|
||||
int rawlump = Wads.CheckNumForName (sfx->RawName, ns_bloodraw);
|
||||
int rawlump = Wads.CheckNumForName(sfx->RawName, ns_bloodraw);
|
||||
int sfxnum;
|
||||
|
||||
if (rawlump != -1)
|
||||
{
|
||||
Wads.GetLumpName (name, lumpnum);
|
||||
name[8] = 0;
|
||||
strcat (name, ".SFX");
|
||||
sfxnum = S_AddSound (name, rawlump);
|
||||
const char *name = Wads.GetLumpFullName(lumpnum);
|
||||
sfxnum = S_AddSound(name, rawlump);
|
||||
if (sfx->Format == 5)
|
||||
{
|
||||
S_sfx[sfxnum].bForce22050 = true;
|
||||
|
@ -1387,6 +1385,7 @@ static void S_AddBloodSFX (int lumpnum)
|
|||
S_sfx[sfxnum].bForce11025 = true;
|
||||
}
|
||||
S_sfx[sfxnum].bLoadRAW = true;
|
||||
S_sfx[sfxnum].LoopStart = LittleLong(sfx->LoopStart);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ void S_NoiseDebug (void)
|
|||
screen->DrawText (SmallFont, CR_GOLD, 340, y, "pri", TAG_DONE);
|
||||
screen->DrawText (SmallFont, CR_GOLD, 380, y, "flags", TAG_DONE);
|
||||
screen->DrawText (SmallFont, CR_GOLD, 460, y, "aud", TAG_DONE);
|
||||
screen->DrawText (SmallFont, CR_GOLD, 520, y, "pos", TAG_DONE);
|
||||
y += 8;
|
||||
|
||||
if (Channels == NULL)
|
||||
|
@ -253,6 +254,11 @@ void S_NoiseDebug (void)
|
|||
mysnprintf(temp, countof(temp), "%.4f", GSnd->GetAudibility(chan));
|
||||
screen->DrawText(SmallFont, color, 460, y, temp, TAG_DONE);
|
||||
|
||||
// Position
|
||||
mysnprintf(temp, countof(temp), "%u", GSnd->GetPosition(chan));
|
||||
screen->DrawText(SmallFont, color, 520, y, temp, TAG_DONE);
|
||||
|
||||
|
||||
y += 8;
|
||||
if (chan->PrevChan == &Channels)
|
||||
{
|
||||
|
@ -1322,7 +1328,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
|
|||
}
|
||||
sfxstart = sfxdata + 8;
|
||||
}
|
||||
sfx->data = GSnd->LoadSoundRaw(sfxstart, len, frequency, 1, 8);
|
||||
sfx->data = GSnd->LoadSoundRaw(sfxstart, len, frequency, 1, 8, sfx->LoopStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -59,6 +59,8 @@ struct sfxinfo_t
|
|||
WORD bSingular:1;
|
||||
WORD bTentative:1;
|
||||
|
||||
int LoopStart; // -1 means no specific loop defined
|
||||
|
||||
unsigned int link;
|
||||
enum { NO_LINK = 0xffffffff };
|
||||
|
||||
|
|
|
@ -2190,12 +2190,16 @@ void FMODSoundRenderer::UpdateSounds()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
SoundHandle FMODSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits)
|
||||
SoundHandle FMODSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart)
|
||||
{
|
||||
FMOD_CREATESOUNDEXINFO exinfo;
|
||||
SoundHandle retval = { NULL };
|
||||
int numsamples;
|
||||
|
||||
if (length == 0) return retval;
|
||||
if (length <= 0)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
InitCreateSoundExInfo(&exinfo);
|
||||
exinfo.length = length;
|
||||
|
@ -2212,14 +2216,17 @@ SoundHandle FMODSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequ
|
|||
|
||||
case -8:
|
||||
exinfo.format = FMOD_SOUND_FORMAT_PCM8;
|
||||
numsamples = length;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
|
||||
numsamples = length >> 1;
|
||||
break;
|
||||
|
||||
case 32:
|
||||
exinfo.format = FMOD_SOUND_FORMAT_PCM32;
|
||||
numsamples = length >> 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2236,6 +2243,12 @@ SoundHandle FMODSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequ
|
|||
DPrintf("Failed to allocate sample: Error %d\n", result);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (loopstart >= 0)
|
||||
{
|
||||
sample->setLoopPoints(loopstart, FMOD_TIMEUNIT_PCM, numsamples - 1, FMOD_TIMEUNIT_PCM);
|
||||
}
|
||||
|
||||
retval.data = sample;
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
void SetSfxVolume (float volume);
|
||||
void SetMusicVolume (float volume);
|
||||
SoundHandle LoadSound(BYTE *sfxdata, int length);
|
||||
SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits);
|
||||
SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart);
|
||||
void UnloadSound (SoundHandle sfx);
|
||||
unsigned int GetMSLength(SoundHandle sfx);
|
||||
unsigned int GetSampleLength(SoundHandle sfx);
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
SoundHandle retval = { NULL };
|
||||
return retval;
|
||||
}
|
||||
SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits)
|
||||
SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart)
|
||||
{
|
||||
SoundHandle retval = { NULL };
|
||||
return retval;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
virtual void SetSfxVolume (float volume) = 0;
|
||||
virtual void SetMusicVolume (float volume) = 0;
|
||||
virtual SoundHandle LoadSound(BYTE *sfxdata, int length) = 0;
|
||||
virtual SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits) = 0;
|
||||
virtual SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart) = 0;
|
||||
virtual void UnloadSound (SoundHandle sfx) = 0; // unloads a sound from memory
|
||||
virtual unsigned int GetMSLength(SoundHandle sfx) = 0; // Gets the length of a sound at its default frequency
|
||||
virtual unsigned int GetSampleLength(SoundHandle sfx) = 0; // Gets the length of a sound at its default frequency
|
||||
|
|
Loading…
Reference in a new issue