From beae63c1a038f7c79d17ae36e86aa74446a2d930 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 13 Apr 2012 03:10:13 +0200 Subject: [PATCH] Changed: Provide a fake sound name for fake CSound created by music channel --- code/nel/src/sound/source_music_channel.cpp | 15 ++++++++++++++- code/nel/src/sound/stream_file_sound.cpp | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/code/nel/src/sound/source_music_channel.cpp b/code/nel/src/sound/source_music_channel.cpp index bd8f152e0..677370dd3 100644 --- a/code/nel/src/sound/source_music_channel.cpp +++ b/code/nel/src/sound/source_music_channel.cpp @@ -54,6 +54,8 @@ CSourceMusicChannel::~CSourceMusicChannel() bool CSourceMusicChannel::play(const std::string &filepath, bool async, bool loop) { + // delete previous source if any + // note that this waits for the source's thread to finish if the source was still playing if (m_Source) delete m_Source; @@ -71,12 +73,14 @@ bool CSourceMusicChannel::play(const std::string &filepath, bool async, bool loo void CSourceMusicChannel::stop() { + // stop but don't delete the source, deleting source may cause waiting for thread if (m_Source) m_Source->stop(); } void CSourceMusicChannel::reset() { + // forces the source to be deleted, happens when audio mixer is reset delete m_Source; m_Source = NULL; } @@ -96,7 +100,16 @@ void CSourceMusicChannel::resume() bool CSourceMusicChannel::isEnded() { if (m_Source) - return m_Source->isEnded(); + { + if (m_Source->isEnded()) + { + // we can delete the source now without worrying about thread wait + delete m_Source; + m_Source = NULL; + return true; + } + return false; + } return true; } diff --git a/code/nel/src/sound/stream_file_sound.cpp b/code/nel/src/sound/stream_file_sound.cpp index 4fc17b51c..44da5a31d 100644 --- a/code/nel/src/sound/stream_file_sound.cpp +++ b/code/nel/src/sound/stream_file_sound.cpp @@ -73,6 +73,11 @@ void CStreamFileSound::serial(NLMISC::IStream &s) void CStreamFileSound::setMusicFilePath(const std::string &filePath, bool async, bool loop) { +#if !FINAL_VERSION + _Name = NLMISC::CStringMapper::map(std::string(""); +#else + _Name = NLMISC::CStringMapper::map(""); +#endif _ConeInnerAngle = NLMISC::Pi * 2; _ConeOuterAngle = NLMISC::Pi * 2; _Looping = loop;