mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(sound): add SESound::SetVolume
This commit is contained in:
parent
08dc4513af
commit
775c1cbce8
@ -4,6 +4,7 @@
|
||||
#include "util/SFile.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
#include <storm/String.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
|
||||
#define LOG_WRITE(result, ...) \
|
||||
@ -622,3 +623,15 @@ void SESound::SetUserData(SEUserData* userData) {
|
||||
|
||||
this->m_internal->m_userData = userData;
|
||||
}
|
||||
|
||||
void SESound::SetVolume(float volume) {
|
||||
if (!this->m_internal) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->m_internal->m_volume = std::min(std::max(volume, 0.0f), 1.0f);
|
||||
|
||||
if (this->m_internal->m_fmodChannel) {
|
||||
this->m_internal->m_fmodChannel->setVolume(this->m_internal->GetVolume());
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ class SESound {
|
||||
void SetFadeInTime(float fadeInTime);
|
||||
void SetFadeOutTime(float fadeOutTime);
|
||||
void SetUserData(SEUserData* userData);
|
||||
void SetVolume(float volume);
|
||||
|
||||
private:
|
||||
// Private static functions
|
||||
|
||||
Loading…
Reference in New Issue
Block a user