Stop sound event up and running.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace dd
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct PlaySFX : Event
|
||||
struct PlaySound : Event
|
||||
{
|
||||
std::string path;
|
||||
float volume = 1.f;
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef EVENTS_ESTOPSOUND_H__
|
||||
#define EVENTS_ESTOPSOUND_H__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct StopSound : public Event
|
||||
{
|
||||
std::string path;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,7 @@ class Sound : public Resource
|
||||
friend class ResourceManager;
|
||||
public:
|
||||
ALuint Buffer() { return m_Buffer; };
|
||||
std::string Path() { return m_Path; };
|
||||
private:
|
||||
Sound(std::string path);
|
||||
|
||||
@@ -28,6 +29,7 @@ private:
|
||||
ALuint LoadFile(std::string path);
|
||||
|
||||
ALuint m_Buffer;
|
||||
std::string m_Path;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
#include "AL/alc.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/World.h"
|
||||
#include "Sound.h"
|
||||
#include "Sound/EPlaySFX.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Sound.h"
|
||||
#include "Sound/EPlaySound.h"
|
||||
#include "Sound/EStopSound.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Game/CBrick.h"
|
||||
#include "Game/CPad.h"
|
||||
@@ -34,19 +35,20 @@ public:
|
||||
|
||||
private:
|
||||
//Events
|
||||
dd::EventRelay<SoundSystem, dd::Events::PlaySFX> m_EPlaySFX;
|
||||
dd::EventRelay<SoundSystem, dd::Events::PlaySound> m_EPlaySFX;
|
||||
dd::EventRelay<SoundSystem, dd::Events::Contact> m_EContact;
|
||||
bool OnPlaySFX(const dd::Events::PlaySFX &event);
|
||||
dd::EventRelay<SoundSystem, dd::Events::StopSound> m_EStopSound;
|
||||
bool OnPlaySound(const dd::Events::PlaySound &event);
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
bool OnStopSound(const dd::Events::StopSound &event);
|
||||
|
||||
ALuint CreateSource();
|
||||
|
||||
std::map<ALuint, ALuint> m_SourcesToBuffers;
|
||||
std::map<ALuint, Sound*> m_SourcesToBuffers;
|
||||
|
||||
ALCdevice* m_Device;
|
||||
|
||||
//Temp
|
||||
ALuint m_Source, m_BGMSource, m_BGMSupportSource;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user