diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-03 16:52:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-03 16:55:25 +0300 |
commit | aa1e8a7a7236d49d91501eac2da81bdb96f0bba5 (patch) | |
tree | 833744617232b18ae86aa108dddc72dad8381360 | |
parent | d69ea30539a6fe816dd6e1d943a0a2adcbd95c19 (diff) | |
download | mv-aa1e8a7a7236d49d91501eac2da81bdb96f0bba5.tar.gz mv-aa1e8a7a7236d49d91501eac2da81bdb96f0bba5.tar.bz2 mv-aa1e8a7a7236d49d91501eac2da81bdb96f0bba5.tar.xz mv-aa1e8a7a7236d49d91501eac2da81bdb96f0bba5.zip |
Rename music.cpp/h to sdlmusic.
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 6 | ||||
-rw-r--r-- | src/resources/resourcemanager.h | 4 | ||||
-rw-r--r-- | src/resources/sdlmusic.cpp (renamed from src/resources/music.cpp) | 12 | ||||
-rw-r--r-- | src/resources/sdlmusic.h (renamed from src/resources/music.h) | 14 | ||||
-rw-r--r-- | src/sound.cpp | 4 | ||||
-rw-r--r-- | src/sound.h | 4 |
8 files changed, 26 insertions, 26 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d312a9415..944423738 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -439,8 +439,6 @@ SET(SRCS resources/mapreader.h resources/monsterdb.cpp resources/monsterdb.h - resources/music.cpp - resources/music.h resources/npcdb.cpp resources/npcdb.h resources/openglimagehelper.cpp @@ -451,6 +449,8 @@ SET(SRCS resources/resourcemanager.h resources/sdlimagehelper.cpp resources/sdlimagehelper.h + resources/sdlmusic.cpp + resources/sdlmusic.h resources/soundeffect.h resources/soundeffect.cpp resources/spritedef.h diff --git a/src/Makefile.am b/src/Makefile.am index 5523c0159..1f1dd23a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -441,8 +441,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ resources/mapreader.h \ resources/monsterdb.cpp \ resources/monsterdb.h \ - resources/music.cpp \ - resources/music.h \ resources/npcdb.cpp \ resources/npcdb.h \ resources/openglimagehelper.cpp \ @@ -453,6 +451,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ resources/resourcemanager.h \ resources/sdlimagehelper.cpp \ resources/sdlimagehelper.h \ + resources/sdlmusic.cpp \ + resources/sdlmusic.h \ resources/soundeffect.cpp \ resources/soundeffect.h \ resources/spritedef.cpp \ diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 6779419f1..20cd37587 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -32,7 +32,7 @@ #include "resources/image.h" #include "resources/imagehelper.h" #include "resources/imageset.h" -#include "resources/music.h" +#include "resources/sdlmusic.h" #include "resources/openglimagehelper.h" #include "resources/soundeffect.h" #include "resources/spritedef.h" @@ -549,9 +549,9 @@ Resource *ResourceManager::load(const std::string &path, const loader fun) return get(path, ResourceLoader::load, &rl); } -Music *ResourceManager::getMusic(const std::string &idPath) +SDLMusic *ResourceManager::getMusic(const std::string &idPath) { - return static_cast<Music*>(load(idPath, Music::load)); + return static_cast<SDLMusic*>(load(idPath, SDLMusic::load)); } SoundEffect *ResourceManager::getSoundEffect(const std::string &idPath) diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 220c5f3f3..d08f8043c 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -37,7 +37,7 @@ class AnimationDelayLoad; class Image; class ImageSet; -class Music; +class SDLMusic; class Resource; class SoundEffect; class SpriteDef; @@ -195,7 +195,7 @@ class ResourceManager final * Convenience wrapper around ResourceManager::get for loading * songs. */ - Music *getMusic(const std::string &idPath) A_WARN_UNUSED; + SDLMusic *getMusic(const std::string &idPath) A_WARN_UNUSED; /** * Convenience wrapper around ResourceManager::get for loading diff --git a/src/resources/music.cpp b/src/resources/sdlmusic.cpp index d88b3ccac..fe06b43f1 100644 --- a/src/resources/music.cpp +++ b/src/resources/sdlmusic.cpp @@ -20,28 +20,28 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "resources/music.h" +#include "resources/sdlmusic.h" #include "logger.h" #include "debug.h" -Music::Music(Mix_Music *const music) : +SDLMusic::SDLMusic(Mix_Music *const music) : Resource(), mMusic(music) { } -Music::~Music() +SDLMusic::~SDLMusic() { Mix_FreeMusic(mMusic); } -Resource *Music::load(SDL_RWops *const rw) +Resource *SDLMusic::load(SDL_RWops *const rw) { if (Mix_Music *const music = Mix_LoadMUS_RW(rw)) { - return new Music(music); + return new SDLMusic(music); } else { @@ -50,7 +50,7 @@ Resource *Music::load(SDL_RWops *const rw) } } -bool Music::play(const int loops, const int fadeIn) +bool SDLMusic::play(const int loops, const int fadeIn) { if (fadeIn > 0) return Mix_FadeInMusic(mMusic, loops, fadeIn); diff --git a/src/resources/music.h b/src/resources/sdlmusic.h index bf0a572dc..2d599cb4b 100644 --- a/src/resources/music.h +++ b/src/resources/sdlmusic.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MUSIC_H -#define MUSIC_H +#ifndef SDLMUSIC_H +#define SDLMUSIC_H #include "resources/resource.h" @@ -32,20 +32,20 @@ /** * Defines a class for loading and storing music. */ -class Music final : public Resource +class SDLMusic final : public Resource { public: - Music() : + SDLMusic() : Resource(), mMusic(nullptr) { } - A_DELETE_COPY(Music) + A_DELETE_COPY(SDLMusic) /** * Destructor. */ - virtual ~Music(); + virtual ~SDLMusic(); /** * Loads a music from a buffer in memory. @@ -73,7 +73,7 @@ class Music final : public Resource /** * Constructor. */ - Music(Mix_Music *const music); + SDLMusic(Mix_Music *const music); Mix_Music *mMusic; }; diff --git a/src/sound.cpp b/src/sound.cpp index 82e7b2f6d..a316abc9d 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -25,7 +25,7 @@ #include "configuration.h" #include "localplayer.h" -#include "resources/music.h" +#include "resources/sdlmusic.h" #include "resources/resourcemanager.h" #include "resources/soundeffect.h" @@ -211,7 +211,7 @@ void Sound::setSfxVolume(const int volume) Mix_Volume(-1, mSfxVolume); } -static Music *loadMusic(const std::string &fileName) +static SDLMusic *loadMusic(const std::string &fileName) { ResourceManager *const resman = ResourceManager::getInstance(); return resman->getMusic(paths.getStringValue("music") + fileName); diff --git a/src/sound.h b/src/sound.h index 7aba7e7be..12b75a86b 100644 --- a/src/sound.h +++ b/src/sound.h @@ -31,7 +31,7 @@ #include "localconsts.h" -class Music; +class SDLMusic; static const std::string SOUND_INFO = "soundinfo"; static const std::string SOUND_ERROR = "sounderror"; @@ -164,7 +164,7 @@ class Sound final : public ConfigListener int mMusicVolume; std::string mCurrentMusicFile; - Music *mMusic; + SDLMusic *mMusic; bool mPlayBattle; bool mPlayGui; bool mPlayMusic; |