diff --git a/include/Sound/SoundSystem.h b/include/Sound/SoundSystem.h index 254b989..8c6cb97 100644 --- a/include/Sound/SoundSystem.h +++ b/include/Sound/SoundSystem.h @@ -27,14 +27,7 @@ public: : System(world, eventBroker) { } ~SoundSystem(); void Initialize() override; - - //void UpdateEntity(double dt, EntityID entity, EntityID parent) override; void Update(double dt) override; - //void OnComponentCreated(std::string type, std::shared_ptr component) override; - //void OnComponentRemoved(std::string type, Component* component) override; - //void PlaySound(Components::SoundEmitter* emitter, std::string path); // Use if you want to play a temporary .wav file not from component - //void PlaySound(std::shared_ptr emitter); // Use if you want to play .wav file from component - //void StopSound(std::shared_ptr emitter); @@ -45,8 +38,6 @@ private: dd::EventRelay m_EContact; bool OnPlaySFX(const dd::Events::PlaySFX &event); bool OnContact(const dd::Events::Contact &event); - - ALuint LoadFile(std::string fileName); ALuint CreateSource(); //std::map m_Sources; diff --git a/src/game/Sound/Sound.cpp b/src/game/Sound/Sound.cpp index f38ddf7..d2012c3 100644 --- a/src/game/Sound/Sound.cpp +++ b/src/game/Sound/Sound.cpp @@ -7,8 +7,6 @@ dd::Sound::Sound(std::string path) ALuint dd::Sound::LoadFile(std::string path) { - - LOG_ERROR("Detta meddelande ska du bara få 1 gång! -----------------------------"); if (m_BufferCache.find(path) != m_BufferCache.end()) { return m_BufferCache[path]; } diff --git a/src/game/Sound/SoundSystem.cpp b/src/game/Sound/SoundSystem.cpp index 9ba277f..9599952 100644 --- a/src/game/Sound/SoundSystem.cpp +++ b/src/game/Sound/SoundSystem.cpp @@ -3,7 +3,8 @@ dd::Systems::SoundSystem::~SoundSystem() { - //alDeleteSources(1, m_Source); + alSourcei(m_Source, AL_BUFFER, 0); + alDeleteSources(1, &m_Source); } void dd::Systems::SoundSystem::Initialize() @@ -39,10 +40,8 @@ void dd::Systems::SoundSystem::Update(double dt) bool dd::Systems::SoundSystem::OnPlaySFX(const dd::Events::PlaySFX &event) { m_Source = CreateSource(); - //ALuint buffer = LoadFile(event.path); //change to resourcemanager load Sound *sound = ResourceManager::Load(event.path); ALuint buffer = sound->Buffer(); - alSourcei(m_Source, AL_BUFFER, buffer); alSourcePlay(m_Source); } @@ -73,8 +72,3 @@ ALuint dd::Systems::SoundSystem::CreateSource() return source; } - -ALuint dd::Systems::SoundSystem::LoadFile(std::string path) -{ - /*Moved code*/ -}