mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- Added virtual status and audibility to the noise debug display.
SVN r1961 (trunk)
This commit is contained in:
parent
f1738b0e03
commit
fb74d9b1ec
8 changed files with 71 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
November 3, 2009
|
||||
- Added virtual status and audibility to the noise debug display.
|
||||
- Added a command line option -warpwipe to perform the screen wipe if you
|
||||
start with -warp or +map.
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ void S_NoiseDebug (void)
|
|||
screen->DrawText (SmallFont, CR_GOLD, 300, y, "chan", TAG_DONE);
|
||||
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);
|
||||
y += 8;
|
||||
|
||||
if (Channels == NULL)
|
||||
|
@ -236,7 +237,7 @@ void S_NoiseDebug (void)
|
|||
screen->DrawText(SmallFont, color, 340, y, temp, TAG_DONE);
|
||||
|
||||
// Flags
|
||||
mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE",
|
||||
mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE%sV",
|
||||
(chan->ChanFlags & CHAN_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
(chan->ChanFlags & CHAN_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
(chan->ChanFlags & CHAN_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
|
@ -244,9 +245,14 @@ void S_NoiseDebug (void)
|
|||
(chan->ChanFlags & CHAN_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
(chan->ChanFlags & CHAN_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
(chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
(chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK);
|
||||
(chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||
(chan->ChanFlags & CHAN_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK);
|
||||
screen->DrawText(SmallFont, color, 380, y, temp, TAG_DONE);
|
||||
|
||||
// Audibility
|
||||
mysnprintf(temp, countof(temp), "%.2g", GSnd->GetAudibility(chan));
|
||||
screen->DrawText(SmallFont, color, 460, y, temp, TAG_DONE);
|
||||
|
||||
y += 8;
|
||||
if (chan->PrevChan == &Channels)
|
||||
{
|
||||
|
@ -2003,6 +2009,25 @@ void S_ChannelEnded(FISoundChannel *ichan)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_ChannelVirtualChanged (callback for sound interface code)
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_ChannelVirtualChanged(FISoundChannel *ichan, bool is_virtual)
|
||||
{
|
||||
FSoundChan *schan = static_cast<FSoundChan*>(ichan);
|
||||
if (is_virtual)
|
||||
{
|
||||
schan->ChanFlags |= CHAN_VIRTUAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
schan->ChanFlags &= ~CHAN_VIRTUAL;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_StopChannel
|
||||
|
|
|
@ -262,6 +262,7 @@ void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sfxid, floa
|
|||
#define CHAN_FORGETTABLE 4 // internal: Forget channel data when sound stops.
|
||||
#define CHAN_JUSTSTARTED 512 // internal: Sound has not been updated yet.
|
||||
#define CHAN_ABSTIME 1024// internal: Start time is absolute and does not depend on current time.
|
||||
#define CHAN_VIRTUAL 2048// internal: Channel is currently virtual
|
||||
|
||||
// sound attenuation values
|
||||
#define ATTN_NONE 0.f // full volume the entire level
|
||||
|
|
|
@ -1846,6 +1846,27 @@ unsigned int FMODSoundRenderer::GetPosition(FISoundChannel *chan)
|
|||
return pos;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMODSoundRenderer :: GetAudibility
|
||||
//
|
||||
// Returns the audible volume of the channel, after rollof and any other
|
||||
// factors are applied.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
float FMODSoundRenderer::GetAudibility(FISoundChannel *chan)
|
||||
{
|
||||
float aud;
|
||||
|
||||
if (chan == NULL || chan->SysChannel == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
((FMOD::Channel *)chan->SysChannel)->getAudibility(&aud);
|
||||
return aud;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMODSoundRenderer :: SetSfxPaused
|
||||
|
@ -2284,16 +2305,19 @@ unsigned int FMODSoundRenderer::GetSampleLength(SoundHandle sfx)
|
|||
FMOD_RESULT F_CALLBACK FMODSoundRenderer::ChannelCallback
|
||||
(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2)
|
||||
{
|
||||
if (type != FMOD_CHANNEL_CALLBACKTYPE_END)
|
||||
{
|
||||
return FMOD_OK;
|
||||
}
|
||||
FMOD::Channel *chan = (FMOD::Channel *)channel;
|
||||
FISoundChannel *schan;
|
||||
|
||||
if (chan->getUserData((void **)&schan) == FMOD_OK && schan != NULL)
|
||||
{
|
||||
S_ChannelEnded(schan);
|
||||
if (type == FMOD_CHANNEL_CALLBACKTYPE_END)
|
||||
{
|
||||
S_ChannelEnded(schan);
|
||||
}
|
||||
else if (type == FMOD_CHANNEL_CALLBACKTYPE_VIRTUALVOICE)
|
||||
{
|
||||
S_ChannelVirtualChanged(schan, data1 != 0);
|
||||
}
|
||||
}
|
||||
return FMOD_OK;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,9 @@ public:
|
|||
// Returns position of sound on this channel, in samples.
|
||||
unsigned int GetPosition(FISoundChannel *chan);
|
||||
|
||||
// Gets a channel's audibility (real volume).
|
||||
float GetAudibility(FISoundChannel *chan);
|
||||
|
||||
// Synchronizes following sound startups.
|
||||
void Sync (bool sync);
|
||||
|
||||
|
|
|
@ -175,6 +175,12 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Gets a channel's audibility (real volume).
|
||||
float GetAudibility(FISoundChannel *chan)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Synchronizes following sound startups.
|
||||
void Sync (bool sync)
|
||||
{
|
||||
|
|
|
@ -112,6 +112,9 @@ public:
|
|||
// Returns position of sound on this channel, in samples.
|
||||
virtual unsigned int GetPosition(FISoundChannel *chan) = 0;
|
||||
|
||||
// Gets a channel's audibility (real volume).
|
||||
virtual float GetAudibility(FISoundChannel *chan) = 0;
|
||||
|
||||
// Synchronizes following sound startups.
|
||||
virtual void Sync (bool sync) = 0;
|
||||
|
||||
|
@ -142,6 +145,7 @@ void I_InitSound ();
|
|||
void I_ShutdownSound ();
|
||||
|
||||
void S_ChannelEnded(FISoundChannel *schan);
|
||||
void S_ChannelVirtualChanged(FISoundChannel *schan, bool is_virtual);
|
||||
float S_GetRolloff(FRolloffInfo *rolloff, float distance, bool logarithmic);
|
||||
FISoundChannel *S_GetChannel(void *syschan);
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ struct FISoundChannel
|
|||
// callback that can't be passed a sound channel pointer
|
||||
FRolloffInfo Rolloff;
|
||||
float DistanceScale;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue