Removed: Warning messages

This commit is contained in:
kaetemi 2012-04-12 17:56:54 +02:00
parent dec156f728
commit e0369c701c
3 changed files with 38 additions and 3 deletions

View file

@ -254,6 +254,7 @@ bool CSourceAL::play()
else else
{ {
nlwarning("Invalid play call, not streaming and no static buffer assigned"); nlwarning("Invalid play call, not streaming and no static buffer assigned");
return false;
} }
} }

View file

@ -40,6 +40,8 @@
using namespace std; using namespace std;
// using namespace NLMISC; // using namespace NLMISC;
// #define NLSOUND_STREAM_FILE_DEBUG
namespace NLSOUND { namespace NLSOUND {
CStreamFileSource::CStreamFileSource(CStreamFileSound *streamFileSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) CStreamFileSource::CStreamFileSource(CStreamFileSound *streamFileSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController)
@ -69,16 +71,20 @@ void CStreamFileSource::play()
{ {
if (m_NextBuffer || !m_FreeBuffers) if (m_NextBuffer || !m_FreeBuffers)
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("play waiting, play stream %s", getStreamFileSound()->getFilePath().c_str()); nldebug("play waiting, play stream %s", getStreamFileSound()->getFilePath().c_str());
#endif
CStreamSource::play(); CStreamSource::play();
if (!_Playing && !m_WaitingForPlay) if (!_Playing && !m_WaitingForPlay)
{ {
nldebug("playing not possible or necessary for some reason"); nldebug("Stream file source playback not possible or necessary for some reason");
} }
} }
else else
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("play waiting, hop onto waiting list %s", getStreamFileSound()->getFilePath().c_str()); nldebug("play waiting, hop onto waiting list %s", getStreamFileSound()->getFilePath().c_str());
#endif
m_WaitingForPlay = true; m_WaitingForPlay = true;
CAudioMixerUser *mixer = CAudioMixerUser::instance(); CAudioMixerUser *mixer = CAudioMixerUser::instance();
mixer->addSourceWaitingForPlay(this); mixer->addSourceWaitingForPlay(this);
@ -93,7 +99,9 @@ void CStreamFileSource::play()
} }
else if (!_Playing) else if (!_Playing)
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("play go %s", getStreamFileSound()->getFilePath().c_str()); nldebug("play go %s", getStreamFileSound()->getFilePath().c_str());
#endif
//if (!m_WaitingForPlay) //if (!m_WaitingForPlay)
//{ //{
// thread may be stopping from stop call // thread may be stopping from stop call
@ -119,7 +127,9 @@ void CStreamFileSource::play()
// wait until at least one buffer is ready // wait until at least one buffer is ready
while (!(m_NextBuffer || !m_FreeBuffers) && m_WaitingForPlay && m_Thread->isRunning()) while (!(m_NextBuffer || !m_FreeBuffers) && m_WaitingForPlay && m_Thread->isRunning())
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("wait buffer"); nldebug("wait buffer");
#endif
NLMISC::nlSleep(100); NLMISC::nlSleep(100);
} }
if (m_WaitingForPlay && m_Thread->isRunning()) if (m_WaitingForPlay && m_Thread->isRunning())
@ -158,11 +168,15 @@ void CStreamFileSource::play()
void CStreamFileSource::stop() void CStreamFileSource::stop()
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("stop %s", getStreamFileSound()->getFilePath().c_str()); nldebug("stop %s", getStreamFileSound()->getFilePath().c_str());
#endif
CStreamSource::stopInt(); CStreamSource::stopInt();
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("stopInt ok"); nldebug("stopInt ok");
#endif
if (_Spawn) if (_Spawn)
{ {
@ -172,21 +186,27 @@ void CStreamFileSource::stop()
delete this; delete this;
} }
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("stop ok"); nldebug("stop ok");
#endif
// thread will check _Playing to stop // thread will check _Playing to stop
} }
bool CStreamFileSource::isPlaying() bool CStreamFileSource::isPlaying()
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("isPlaying"); nldebug("isPlaying");
#endif
return m_Thread->isRunning(); return m_Thread->isRunning();
} }
void CStreamFileSource::pause() void CStreamFileSource::pause()
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("pause"); nldebug("pause");
#endif
if (!m_Paused) if (!m_Paused)
{ {
@ -206,7 +226,9 @@ void CStreamFileSource::pause()
void CStreamFileSource::resume() void CStreamFileSource::resume()
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("resume"); nldebug("resume");
#endif
if (m_Paused) if (m_Paused)
{ {
@ -282,8 +304,10 @@ inline bool CStreamFileSource::bufferMore(uint bytes) // buffer from bytes (mini
void CStreamFileSource::run() void CStreamFileSource::run()
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("run %s", getStreamFileSound()->getFilePath().c_str()); nldebug("run %s", getStreamFileSound()->getFilePath().c_str());
uint dumpI = 0; uint dumpI = 0;
#endif
bool looping = _Looping; bool looping = _Looping;
if (getStreamFileSound()->getAsync()) if (getStreamFileSound()->getAsync())
@ -299,12 +323,14 @@ void CStreamFileSource::run()
{ {
if (!m_AudioDecoder->isMusicEnded()) if (!m_AudioDecoder->isMusicEnded())
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
++dumpI; ++dumpI;
if (!(dumpI % 100)) if (!(dumpI % 100))
{ {
nldebug("buffer %s %s %s", _Playing ? "PLAYING" : "NP", m_WaitingForPlay ? "WAITING" : "NW", getStreamFileSound()->getFilePath().c_str()); nldebug("buffer %s %s %s", _Playing ? "PLAYING" : "NP", m_WaitingForPlay ? "WAITING" : "NW", getStreamFileSound()->getFilePath().c_str());
nldebug("gain %f", hasPhysicalSource() ? getPhysicalSource()->getGain() : -1.0f); nldebug("gain %f", hasPhysicalSource() ? getPhysicalSource()->getGain() : -1.0f);
} }
#endif
bool newLooping = _Looping; bool newLooping = _Looping;
if (looping != newLooping) if (looping != newLooping)
@ -323,7 +349,9 @@ void CStreamFileSource::run()
// wait until done playing buffers // wait until done playing buffers
while (this->hasFilledBuffersAvailable() && (_Playing || m_WaitingForPlay)) while (this->hasFilledBuffersAvailable() && (_Playing || m_WaitingForPlay))
{ {
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("music ended, wait until done %s", getStreamFileSound()->getFilePath().c_str()); nldebug("music ended, wait until done %s", getStreamFileSound()->getFilePath().c_str());
#endif
NLMISC::nlSleep(40); NLMISC::nlSleep(40);
} }
// stop the physical source // stop the physical source
@ -346,7 +374,9 @@ void CStreamFileSource::run()
m_FreeBuffers = 3; m_FreeBuffers = 3;
m_NextBuffer = 0; m_NextBuffer = 0;
#ifdef NLSOUND_STREAM_FILE_DEBUG
nldebug("run end %s", getStreamFileSound()->getFilePath().c_str()); nldebug("run end %s", getStreamFileSound()->getFilePath().c_str());
#endif
} }
} /* namespace NLSOUND */ } /* namespace NLSOUND */

View file

@ -26,6 +26,8 @@
// using namespace std; // using namespace std;
using namespace NLMISC; using namespace NLMISC;
// #define NLSOUND_DEBUG_STREAM
namespace NLSOUND { namespace NLSOUND {
CStreamSource::CStreamSource(CStreamSound *streamSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) CStreamSource::CStreamSource(CStreamSound *streamSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController)
@ -160,7 +162,9 @@ void CStreamSource::play()
_SpawnEndCb(this, _CbUserParam); _SpawnEndCb(this, _CbUserParam);
delete this; delete this;
} }
#ifdef NLSOUND_DEBUG_STREAM
nldebug("CStreamSource %p : play FAILED, source is too far away !", (CAudioMixerUser::IMixerEvent*)this); 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 // m_WaitingForPlay = false; // not necessary, delete ensures waiting for thread stop
return; return;
} }
@ -190,7 +194,7 @@ void CStreamSource::play()
} }
else else
{ {
pSource->setDirection(NLMISC::CVector::Null); pSource->setDirection(NLMISC::CVector::I);
pSource->setCone(float(Pi * 2), float(Pi * 2), 1.0f); pSource->setCone(float(Pi * 2), float(Pi * 2), 1.0f);
pSource->setVelocity(NLMISC::CVector::Null); pSource->setVelocity(NLMISC::CVector::Null);
} }
@ -232,7 +236,7 @@ void CStreamSource::play()
{ {
CSourceCommon::play(); CSourceCommon::play();
m_WaitingForPlay = false; m_WaitingForPlay = false;
#if 1 #ifdef NLSOUND_DEBUG_STREAM
// Dump source info // Dump source info
nlwarning("--- DUMP SOURCE INFO ---"); nlwarning("--- DUMP SOURCE INFO ---");
nlwarning(" * getLooping: %s", getPhysicalSource()->getLooping() ? "YES" : "NO"); nlwarning(" * getLooping: %s", getPhysicalSource()->getLooping() ? "YES" : "NO");