mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 00:18:43 +00:00
Changed: Provide a fake sound name for fake CSound created by music channel
This commit is contained in:
parent
ac948b8a53
commit
de4e298fb6
2 changed files with 19 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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("<MusicChannel:") + NLMISC::CFile::getFilenameWithoutExtension(filePath) + ">");
|
||||
#else
|
||||
_Name = NLMISC::CStringMapper::map("<MusicChannel>");
|
||||
#endif
|
||||
_ConeInnerAngle = NLMISC::Pi * 2;
|
||||
_ConeOuterAngle = NLMISC::Pi * 2;
|
||||
_Looping = loop;
|
||||
|
|
Loading…
Reference in a new issue