1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 16:45:20 +02:00

Sounds: Various little improvements (#12486)

Use SimpleSoundSpec where reasonable (OpenAL)
Ensure the sound IDs do not underflow or get overwritten -> loop in u16
Proper use of an enum.
This commit is contained in:
SmallJoker
2022-07-09 22:32:24 +02:00
committed by GitHub
parent 051181fa6e
commit e51f474613
9 changed files with 112 additions and 108 deletions

View File

@@ -4498,7 +4498,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
if ((s.ftype == f_TabHeader) &&
(s.fid == event.GUIEvent.Caller->getID())) {
if (!s.sound.empty() && m_sound_manager)
m_sound_manager->playSound(s.sound, false, 1.0f);
m_sound_manager->playSound(SimpleSoundSpec(s.sound, false, 1.0f));
s.send = true;
acceptInput();
s.send = false;
@@ -4543,7 +4543,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
if (s.ftype == f_Button || s.ftype == f_CheckBox) {
if (!s.sound.empty() && m_sound_manager)
m_sound_manager->playSound(s.sound, false, 1.0f);
m_sound_manager->playSound(SimpleSoundSpec(s.sound, false, 1.0f));
s.send = true;
if (s.is_exit) {
@@ -4568,7 +4568,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
}
}
if (!s.sound.empty() && m_sound_manager)
m_sound_manager->playSound(s.sound, false, 1.0f);
m_sound_manager->playSound(SimpleSoundSpec(s.sound, false, 1.0f));
s.send = true;
acceptInput(quit_mode_no);
@@ -4586,7 +4586,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
s.fdefault = L"";
} else if (s.ftype == f_Unknown || s.ftype == f_HyperText) {
if (!s.sound.empty() && m_sound_manager)
m_sound_manager->playSound(s.sound, false, 1.0f);
m_sound_manager->playSound(SimpleSoundSpec(s.sound, false, 1.0f));
s.send = true;
acceptInput();
s.send = false;