The win sound plays on win screen

This commit is contained in:
stiffly
2016-03-14 00:58:53 +01:00
parent 7855cf03d2
commit 1345889e62
3 changed files with 6102 additions and 6002 deletions
+1
View File
@@ -81,6 +81,7 @@ private:
void setSoundProperties(Source* source, ComponentWrapper* soundComponent);
float getDurationSeconds(Source* source);
float getTimeOffsetSeconds(Source* source);
void setTimeOffsetSeconds(Source* source, float timeOffset);
// Specific logic
void playSound(Source* source);
File diff suppressed because it is too large Load Diff
+16 -2
View File
@@ -417,8 +417,17 @@ bool SoundManager::OnSetCamera(const Events::SetCamera& e)
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
setGain(m_CurrentBGMCombo, 0);
playSound(m_CurrentBGMCombo);
} else if (e.CameraEntity.Name() == "WINCAMERAISH") {
// Play win sound!
} else if (m_World->HasComponent(e.CameraEntity.ID, "EndScreen")) {
float timeOffset = getTimeOffsetSeconds(m_CurrentBGM);
stopSound(m_CurrentBGM);
m_CurrentBGM = createSource("Audio/BGM/Layer3.wav");
m_CurrentBGM->Type = SoundType::BGM;
alSourcei(m_CurrentBGM->ALsource, AL_LOOPING, 1);
playSound(m_CurrentBGM);
setTimeOffsetSeconds(m_CurrentBGM, timeOffset);
//Events::ChangeBGM changeBGM;
//changeBGM.FilePath = "Audio/BGM/Layer3.wav";
//m_EventBroker->Publish(changeBGM);
}
}
@@ -479,6 +488,11 @@ float SoundManager::getTimeOffsetSeconds(Source* source)
return time;
}
void SoundManager::setTimeOffsetSeconds(Source * source, float timeOffset)
{
alSourcef(source->ALsource, AL_SEC_OFFSET, timeOffset);
}
void SoundManager::initOpenAL()
{
// Initialize OpenAL