Added menu music
This commit is contained in:
+1
-1
Submodule assets updated: 33455a9d10...bc6e7df04c
@@ -89,9 +89,9 @@ private:
|
|||||||
Source* createSource(std::string filePath);
|
Source* createSource(std::string filePath);
|
||||||
std::unordered_map<EntityID, Source*> m_Sources;
|
std::unordered_map<EntityID, Source*> m_Sources;
|
||||||
void matchBGMLoop();
|
void matchBGMLoop();
|
||||||
Source* m_CurrentBGM;
|
Source* m_CurrentBGM = nullptr;
|
||||||
Source* m_CurrentBGMCombo;
|
Source* m_CurrentBGMCombo = nullptr;
|
||||||
bool m_TempPleaseDeleteMeASAP = false;
|
bool m_DrumLoopHasBeenStarted = false;
|
||||||
|
|
||||||
// Logic
|
// Logic
|
||||||
World* m_World = nullptr;
|
World* m_World = nullptr;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "../Engine/Sound/EPlayAnnouncerVoice.h"
|
#include "../Engine/Sound/EPlayAnnouncerVoice.h"
|
||||||
#include "../Game/Events/EDoubleJump.h"
|
#include "../Game/Events/EDoubleJump.h"
|
||||||
#include "../Game/Events/EDashAbility.h"
|
#include "../Game/Events/EDashAbility.h"
|
||||||
|
#include "../Engine/Sound/EChangeBGM.h"
|
||||||
|
|
||||||
class SoundSystem : public PureSystem, ImpureSystem
|
class SoundSystem : public PureSystem, ImpureSystem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ SoundManager::SoundManager(World* world, EventBroker* eventBroker)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundManager::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundManager::OnPlayerSpawned);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayQueueOnEntity, &SoundManager::OnPlayQueueOnEntity);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayQueueOnEntity, &SoundManager::OnPlayQueueOnEntity);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EChangeBGM, &SoundManager::OnChangeBGM);
|
EVENT_SUBSCRIBE_MEMBER(m_EChangeBGM, &SoundManager::OnChangeBGM);
|
||||||
|
|
||||||
|
Events::ChangeBGM e;
|
||||||
|
e.FilePath = "Audio/bgm/MenuMusic.wav";
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundManager::~SoundManager()
|
SoundManager::~SoundManager()
|
||||||
@@ -63,7 +67,7 @@ void SoundManager::Update(double dt)
|
|||||||
deleteInactiveEmitters();
|
deleteInactiveEmitters();
|
||||||
updateEmitters(dt);
|
updateEmitters(dt);
|
||||||
updateListener(dt);
|
updateListener(dt);
|
||||||
if (m_TempPleaseDeleteMeASAP)
|
if (m_DrumLoopHasBeenStarted)
|
||||||
matchBGMLoop();
|
matchBGMLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +363,7 @@ bool SoundManager::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
|||||||
{
|
{
|
||||||
if (e.PlayerID == -1) { // Local player
|
if (e.PlayerID == -1) { // Local player
|
||||||
m_LocalPlayer = e.Player;
|
m_LocalPlayer = e.Player;
|
||||||
if (m_TempPleaseDeleteMeASAP) {
|
if (m_DrumLoopHasBeenStarted) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
|
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
|
||||||
@@ -367,7 +371,7 @@ bool SoundManager::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
|||||||
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
|
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
|
||||||
setGain(m_CurrentBGMCombo, 0);
|
setGain(m_CurrentBGMCombo, 0);
|
||||||
playSound(m_CurrentBGMCombo);
|
playSound(m_CurrentBGMCombo);
|
||||||
m_TempPleaseDeleteMeASAP = true;
|
m_DrumLoopHasBeenStarted = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -390,10 +394,9 @@ bool SoundManager::OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e)
|
|||||||
|
|
||||||
bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
|
bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
|
||||||
{
|
{
|
||||||
if (m_CurrentBGM == nullptr) {
|
if (m_CurrentBGM != nullptr) {
|
||||||
return false;
|
stopSound(m_CurrentBGM);
|
||||||
}
|
}
|
||||||
stopSound(m_CurrentBGM);
|
|
||||||
m_CurrentBGM = createSource(e.FilePath);
|
m_CurrentBGM = createSource(e.FilePath);
|
||||||
playSound(m_CurrentBGM);
|
playSound(m_CurrentBGM);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ bool SoundSystem::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
|||||||
Events::PlayAnonuncerVoice go;
|
Events::PlayAnonuncerVoice go;
|
||||||
go.FilePath = "Audio/Announcer/" + m_Announcer + "/Go.wav";
|
go.FilePath = "Audio/Announcer/" + m_Announcer + "/Go.wav";
|
||||||
m_EventBroker->Publish(go);
|
m_EventBroker->Publish(go);
|
||||||
// TEMP: starts bgm
|
|
||||||
{
|
{
|
||||||
Events::PlayBackgroundMusic ev;
|
Events::ChangeBGM ev;
|
||||||
ev.FilePath = "Audio/BGM/Layer1.wav";
|
ev.FilePath = "Audio/BGM/Layer1.wav";
|
||||||
m_EventBroker->Publish(ev);
|
m_EventBroker->Publish(ev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user