mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
Fixed: #1298 Replace assert with warning when physical sound source fails to play
This commit is contained in:
parent
76eae94605
commit
b13f0dcb34
2 changed files with 13 additions and 2 deletions
|
@ -134,6 +134,7 @@ void CSimpleSource::play()
|
|||
|| (_RelativeMode ? getPos().sqrnorm() : (mixer->getListenPosVector() - getPos()).sqrnorm()) > _SimpleSound->getMaxDistance() * _SimpleSound->getMaxDistance())
|
||||
{
|
||||
// The sample buffer is not available, don't play (we don't know the length)
|
||||
_WaitingForPlay = false;
|
||||
if (_Spawn)
|
||||
{
|
||||
if (_SpawnEndCb != 0)
|
||||
|
@ -175,7 +176,14 @@ void CSimpleSource::play()
|
|||
|
||||
// and play the sound
|
||||
bool play = pSource->play();
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
nlassert(play);
|
||||
#else
|
||||
if (!play)
|
||||
nlwarning("Failed to play physical sound source. This is a serious error");
|
||||
#endif
|
||||
|
||||
// nldebug("CSimpleSource %p : REAL play done", (CAudioMixerUser::IMixerEvent*)this);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -156,6 +156,7 @@ void CStreamSource::play()
|
|||
if ((_RelativeMode ? getPos().sqrnorm() : (mixer->getListenPosVector() - getPos()).sqrnorm()) > m_StreamSound->getMaxDistance() * m_StreamSound->getMaxDistance())
|
||||
{
|
||||
// Source is too far to play
|
||||
m_WaitingForPlay = false;
|
||||
if (_Spawn)
|
||||
{
|
||||
if (_SpawnEndCb != NULL)
|
||||
|
@ -165,7 +166,6 @@ void CStreamSource::play()
|
|||
#ifdef NLSOUND_DEBUG_STREAM
|
||||
nldebug("CStreamSource %p : play FAILED, source is too far away !", (CAudioMixerUser::IMixerEvent*)this);
|
||||
#endif
|
||||
// m_WaitingForPlay = false; // not necessary, delete ensures waiting for thread stop
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -221,13 +221,13 @@ void CStreamSource::play()
|
|||
else
|
||||
{
|
||||
// No source available, kill.
|
||||
m_WaitingForPlay = false;
|
||||
if (_Spawn)
|
||||
{
|
||||
if (_SpawnEndCb != NULL)
|
||||
_SpawnEndCb(this, _CbUserParam);
|
||||
delete this;
|
||||
}
|
||||
m_WaitingForPlay = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +269,9 @@ void CStreamSource::play()
|
|||
|
||||
#ifdef NL_DEBUG
|
||||
nlassert(play);
|
||||
#else
|
||||
if (!play)
|
||||
nlwarning("Failed to play physical sound source. This is a serious error");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue