diff --git a/code/nel/include/nel/sound/source_music_channel.h b/code/nel/include/nel/sound/music_channel.h similarity index 80% rename from code/nel/include/nel/sound/source_music_channel.h rename to code/nel/include/nel/sound/music_channel.h index c0e0e1f6d..f6927a19a 100644 --- a/code/nel/include/nel/sound/source_music_channel.h +++ b/code/nel/include/nel/sound/music_channel.h @@ -1,9 +1,9 @@ /** * \file source_music_channel.h - * \brief CSourceMusicChannel + * \brief CMusicChannel * \date 2012-04-11 16:08GMT * \author Jan Boon (Kaetemi) - * CSourceMusicChannel + * CMusicChannel */ /* @@ -40,58 +40,58 @@ namespace NLSOUND { class CStreamFileSource; /** - * \brief CSourceMusicChannel + * \brief CMusicChannel * \date 2012-04-11 16:08GMT * \author Jan Boon (Kaetemi) - * CSourceMusicChannel - * TODO_DEPRECATED + * CMusicChannel + * Background music channel */ -class CSourceMusicChannel +class CMusicChannel { public: - CSourceMusicChannel(); - virtual ~CSourceMusicChannel(); + CMusicChannel(); + ~CMusicChannel(); - /** Play some music (.ogg etc...) + /** Play some music (.ogg only) * NB: if an old music was played, it is first stop with stopMusic() * \param filepath file path, CPath::lookup is done here * \param async stream music from hard disk, preload in memory if false * \param loop must be true to play the music in loop. */ - virtual bool play(const std::string &filepath, bool async, bool loop); + bool play(const std::string &filepath, bool async, bool loop); /// Stop the music previously loaded and played (the Memory is also freed) - virtual void stop(); + void stop(); /// Makes sure any resources are freed, but keeps available for next play call - virtual void reset(); + void reset(); /// Pause the music previously loaded and played (the Memory is not freed) - virtual void pause(); + void pause(); /// Resume the music previously paused - virtual void resume(); + void resume(); /// Return true if a song is finished. - virtual bool isEnded(); + bool isEnded(); /// Return true if the song is still loading asynchronously and hasn't started playing yet (false if not async), used to delay fading - virtual bool isLoadingAsync(); + bool isLoadingAsync(); /// Return the total length (in second) of the music currently played - virtual float getLength(); + float getLength(); /** Set the music volume (if any music played). (volume value inside [0 , 1]) (default: 1) * NB: the volume of music is NOT affected by IListener::setGain() */ - virtual void setVolume(float gain); + void setVolume(float gain); private: CStreamFileSound m_Sound; CStreamFileSource *m_Source; float m_Gain; -}; /* class CSourceMusicChannel */ +}; /* class CMusicChannel */ } /* namespace NLSOUND */ diff --git a/code/nel/include/nel/sound/music_channel_fader.h b/code/nel/include/nel/sound/music_channel_fader.h index 4fa11b635..ec3227501 100644 --- a/code/nel/include/nel/sound/music_channel_fader.h +++ b/code/nel/include/nel/sound/music_channel_fader.h @@ -33,7 +33,7 @@ namespace NLSOUND { class ISoundDriver; - class CSourceMusicChannel; + class CMusicChannel; /** * \brief CMusicChannelFader @@ -47,7 +47,7 @@ private: struct _CMusicFader { _CMusicFader() : MusicChannel(NULL), XFadeVolume(0.f), XFadeDVolume(0.f), Playing(false), Fade(false) { } - CSourceMusicChannel *MusicChannel; + CMusicChannel *MusicChannel; float XFadeVolume; // 0--1 float XFadeDVolume; // delta bool Playing; @@ -96,7 +96,7 @@ private: void updateVolume(); public: - /** Play some music (.ogg etc...) + /** Play some music (.ogg only) * NB: if an old music was played, it is first stop with stopMusic() * \param filepath file path, CPath::lookup is done here * \param async stream music from hard disk, preload in memory if false @@ -104,10 +104,10 @@ public: */ bool play(const std::string &filepath, uint xFadeTime = 0, bool async = true, bool loop = true); - /// Stop the music previously loaded and played (the Memory is also freed) + /// Stop the music previously loaded and played void stop(uint xFadeTime = 0); - /// Pause the music previously loaded and played (the Memory is not freed) + /// Pause the music previously loaded and played void pause(); /// Resume the music previously paused diff --git a/code/nel/include/nel/sound/stream_file_sound.h b/code/nel/include/nel/sound/stream_file_sound.h index f1e85a0e4..049fc1603 100644 --- a/code/nel/include/nel/sound/stream_file_sound.h +++ b/code/nel/include/nel/sound/stream_file_sound.h @@ -37,7 +37,7 @@ #include namespace NLSOUND { - class CSourceMusicChannel; + class CMusicChannel; /** * \brief CStreamFileSound @@ -48,7 +48,7 @@ namespace NLSOUND { class CStreamFileSound : public CStreamSound { public: - friend class CSourceMusicChannel; + friend class CMusicChannel; public: CStreamFileSound(); @@ -74,7 +74,7 @@ public: inline const std::string &getFilePath() { return m_FilePath; } private: - /// Used by CSourceMusicChannel to set the filePath and default settings on other parameters. + /// Used by CMusicChannel to set the filePath and default settings on other parameters. void setMusicFilePath(const std::string &filePath, bool async = true, bool loop = false); private: diff --git a/code/nel/src/sound/source_music_channel.cpp b/code/nel/src/sound/music_channel.cpp similarity index 79% rename from code/nel/src/sound/source_music_channel.cpp rename to code/nel/src/sound/music_channel.cpp index b9f61e272..a2015bc43 100644 --- a/code/nel/src/sound/source_music_channel.cpp +++ b/code/nel/src/sound/music_channel.cpp @@ -1,9 +1,9 @@ /** * \file source_music_channel.cpp - * \brief CSourceMusicChannel + * \brief CMusicChannel * \date 2012-04-11 16:08GMT * \author Jan Boon (Kaetemi) - * CSourceMusicChannel + * CMusicChannel */ /* @@ -26,7 +26,7 @@ */ #include "stdsound.h" -#include +#include // STL includes @@ -41,19 +41,19 @@ using namespace std; namespace NLSOUND { -CSourceMusicChannel::CSourceMusicChannel() : m_Source(NULL), m_Gain(1.0f) +CMusicChannel::CMusicChannel() : m_Source(NULL), m_Gain(1.0f) { } -CSourceMusicChannel::~CSourceMusicChannel() +CMusicChannel::~CMusicChannel() { nlassert(!m_Source); delete m_Source; m_Source = NULL; } -bool CSourceMusicChannel::play(const std::string &filepath, bool async, bool loop) +bool CMusicChannel::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 @@ -72,33 +72,33 @@ bool CSourceMusicChannel::play(const std::string &filepath, bool async, bool loo return m_Source->isPlaying(); } -void CSourceMusicChannel::stop() +void CMusicChannel::stop() { // stop but don't delete the source, deleting source may cause waiting for thread if (m_Source) m_Source->stop(); } -void CSourceMusicChannel::reset() +void CMusicChannel::reset() { // forces the source to be deleted, happens when audio mixer is reset delete m_Source; m_Source = NULL; } -void CSourceMusicChannel::pause() +void CMusicChannel::pause() { if (m_Source) m_Source->pause(); } -void CSourceMusicChannel::resume() +void CMusicChannel::resume() { if (m_Source) m_Source->resume(); } -bool CSourceMusicChannel::isEnded() +bool CMusicChannel::isEnded() { if (m_Source) { @@ -114,21 +114,21 @@ bool CSourceMusicChannel::isEnded() return true; } -bool CSourceMusicChannel::isLoadingAsync() +bool CMusicChannel::isLoadingAsync() { if (m_Source) return m_Source->isLoadingAsync(); return false; } -float CSourceMusicChannel::getLength() +float CMusicChannel::getLength() { if (m_Source) return m_Source->getLength(); return 0.0f; } -void CSourceMusicChannel::setVolume(float gain) +void CMusicChannel::setVolume(float gain) { m_Gain = gain; if (m_Source) diff --git a/code/nel/src/sound/music_channel_fader.cpp b/code/nel/src/sound/music_channel_fader.cpp index e2072a4da..608d38e25 100644 --- a/code/nel/src/sound/music_channel_fader.cpp +++ b/code/nel/src/sound/music_channel_fader.cpp @@ -19,7 +19,7 @@ // Project includes #include "nel/sound/driver/sound_driver.h" -#include "nel/sound/source_music_channel.h" +#include "nel/sound/music_channel.h" using namespace std; using namespace NLMISC; @@ -48,7 +48,7 @@ void CMusicChannelFader::init(ISoundDriver *soundDriver) nlassert(!_MusicFader[i].MusicChannel); if (_SoundDriver->getOption(ISoundDriver::OptionHasBufferStreaming)) { - _MusicFader[i].MusicChannel = new CSourceMusicChannel(); + _MusicFader[i].MusicChannel = new CMusicChannel(); } else {