Commit 59189580 authored by Thomas Eppers's avatar Thomas Eppers
Browse files

renamed sound to sound_file

parent 12789100
...@@ -22,7 +22,7 @@ namespace gdw { ...@@ -22,7 +22,7 @@ namespace gdw {
virtual std::shared_ptr<const asset> load_asset(const std::string& name) const = 0; virtual std::shared_ptr<const asset> load_asset(const std::string& name) const = 0;
virtual std::string native_name(const std::string& name) const { virtual std::string native_name(const std::string&) const {
return std::string(); return std::string();
} }
}; };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <audio/music.hpp> #include <audio/music.hpp>
#include <audio/music_manager.hpp> #include <audio/music_manager.hpp>
#include <audio/sound.hpp> #include <audio/sound_file.hpp>
#include <audio/sound_manager.hpp> #include <audio/sound_manager.hpp>
namespace gdw { namespace gdw {
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
#include <SDL_mixer.h> #include <SDL_mixer.h>
namespace gdw { namespace gdw {
class sound { class sound_file {
private: private:
Mix_Chunk* impl_; Mix_Chunk* impl_;
public: public:
sound(const char* mem, int size); sound_file(const char* mem, int size);
~sound(); ~sound_file();
Mix_Chunk* get() const; Mix_Chunk* get() const;
}; };
......
#ifndef __GDW_SOUND_MANAGER_HPP__ #ifndef __GDW_SOUND_MANAGER_HPP__
#define __GDW_SOUND_MANAGER_HPP__ #define __GDW_SOUND_MANAGER_HPP__
#include <audio/sound.hpp> #include <audio/sound_file.hpp>
#include <util/cached_resource_manager.hpp> #include <util/cached_resource_manager.hpp>
namespace gdw{ namespace gdw{
...@@ -9,13 +9,13 @@ namespace gdw{ ...@@ -9,13 +9,13 @@ namespace gdw{
} }
namespace gdw { namespace gdw {
using sound_ptr = std::shared_ptr<const sound>; using sound_ptr = std::shared_ptr<const sound_file>;
class sound_manager: public cached_resource_manager<const sound, sound_manager> { class sound_manager: public cached_resource_manager<const sound_file, sound_manager> {
private: private:
engine& engine_; engine& engine_;
friend class cached_resource_manager<const sound, sound_manager>; friend class cached_resource_manager<const sound_file, sound_manager>;
public: public:
sound_manager(engine& engine); sound_manager(engine& engine);
......
#include <audio/audio_helper.hpp> #include <audio/audio_helper.hpp>
#include <audio/sound.hpp> #include <audio/sound_file.hpp>
namespace gdw { namespace gdw {
sound::sound(const char* mem, int size) { sound_file::sound_file(const char* mem, int size) {
SDL_RWops* raw = SDL_RWFromConstMem((void*)mem, size); SDL_RWops* raw = SDL_RWFromConstMem((void*)mem, size);
if (raw == nullptr) { if (raw == nullptr) {
audio_error("could not load music from memory"); audio_error("could not load music from memory");
...@@ -10,13 +10,13 @@ namespace gdw { ...@@ -10,13 +10,13 @@ namespace gdw {
impl_ = Mix_LoadWAV_RW(raw, 1); impl_ = Mix_LoadWAV_RW(raw, 1);
} }
sound::~sound() { sound_file::~sound_file() {
if (impl_ != nullptr) { if (impl_ != nullptr) {
Mix_FreeChunk(impl_); Mix_FreeChunk(impl_);
} }
} }
Mix_Chunk* sound::get() const { Mix_Chunk*sound_file::get() const {
return impl_; return impl_;
} }
} }
...@@ -13,6 +13,6 @@ namespace gdw { ...@@ -13,6 +13,6 @@ namespace gdw {
return sound_ptr(); return sound_ptr();
} }
auto& content = asset->content(); auto& content = asset->content();
return std::make_shared<const sound>(content.data(), content.size()); return std::make_shared<const sound_file>(content.data(), content.size());
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment