mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Cleanup audio action constness
This commit is contained in:
parent
38423341c2
commit
35e243f0eb
|
|
@ -14,7 +14,7 @@ bool MacroActionAudio::_registered = MacroActionFactory::Register(
|
|||
{MacroActionAudio::Create, MacroActionAudioEdit::Create,
|
||||
"AdvSceneSwitcher.action.audio"});
|
||||
|
||||
const static std::map<MacroActionAudio::Action, std::string> actionTypes = {
|
||||
static const std::map<MacroActionAudio::Action, std::string> actionTypes = {
|
||||
{MacroActionAudio::Action::MUTE,
|
||||
"AdvSceneSwitcher.action.audio.type.mute"},
|
||||
{MacroActionAudio::Action::UNMUTE,
|
||||
|
|
@ -31,7 +31,7 @@ const static std::map<MacroActionAudio::Action, std::string> actionTypes = {
|
|||
"AdvSceneSwitcher.action.audio.type.balance"},
|
||||
};
|
||||
|
||||
const static std::map<MacroActionAudio::FadeType, std::string> fadeTypes = {
|
||||
static const std::map<MacroActionAudio::FadeType, std::string> fadeTypes = {
|
||||
{MacroActionAudio::FadeType::DURATION,
|
||||
"AdvSceneSwitcher.action.audio.fade.type.duration"},
|
||||
{MacroActionAudio::FadeType::RATE,
|
||||
|
|
@ -72,7 +72,7 @@ auto get_master_volume = obs_get_master_volume;
|
|||
auto set_master_volume = obs_set_master_volume;
|
||||
#endif
|
||||
|
||||
void MacroActionAudio::SetFadeActive(bool value)
|
||||
void MacroActionAudio::SetFadeActive(bool value) const
|
||||
{
|
||||
if (_action == Action::SOURCE_VOLUME) {
|
||||
audioFades[_audioSource.ToString()].active = value;
|
||||
|
|
@ -81,7 +81,7 @@ void MacroActionAudio::SetFadeActive(bool value)
|
|||
}
|
||||
}
|
||||
|
||||
bool MacroActionAudio::FadeActive()
|
||||
bool MacroActionAudio::FadeActive() const
|
||||
{
|
||||
bool active = true;
|
||||
if (_action == Action::SOURCE_VOLUME) {
|
||||
|
|
@ -97,7 +97,7 @@ bool MacroActionAudio::FadeActive()
|
|||
return active;
|
||||
}
|
||||
|
||||
std::atomic_int *MacroActionAudio::GetFadeIdPtr()
|
||||
std::atomic_int *MacroActionAudio::GetFadeIdPtr() const
|
||||
{
|
||||
|
||||
if (_action == Action::SOURCE_VOLUME) {
|
||||
|
|
@ -110,12 +110,12 @@ std::atomic_int *MacroActionAudio::GetFadeIdPtr()
|
|||
return &masterAudioFade.id;
|
||||
}
|
||||
|
||||
float MacroActionAudio::GetVolume()
|
||||
float MacroActionAudio::GetVolume() const
|
||||
{
|
||||
return _useDb ? decibelToPercent(_volumeDB) : (float)_volume / 100.0f;
|
||||
}
|
||||
|
||||
void MacroActionAudio::SetVolume(float vol)
|
||||
void MacroActionAudio::SetVolume(float vol) const
|
||||
{
|
||||
if (_action == Action::SOURCE_VOLUME) {
|
||||
auto s = obs_weak_source_get_source(_audioSource.GetSource());
|
||||
|
|
@ -126,7 +126,7 @@ void MacroActionAudio::SetVolume(float vol)
|
|||
}
|
||||
}
|
||||
|
||||
float MacroActionAudio::GetCurrentVolume()
|
||||
float MacroActionAudio::GetCurrentVolume() const
|
||||
{
|
||||
float curVol;
|
||||
if (_action == Action::SOURCE_VOLUME) {
|
||||
|
|
@ -142,7 +142,7 @@ float MacroActionAudio::GetCurrentVolume()
|
|||
return curVol;
|
||||
}
|
||||
|
||||
void MacroActionAudio::FadeVolume()
|
||||
void MacroActionAudio::FadeVolume() const
|
||||
{
|
||||
float vol = GetVolume();
|
||||
float curVol = GetCurrentVolume();
|
||||
|
|
@ -184,7 +184,7 @@ void MacroActionAudio::FadeVolume()
|
|||
SetFadeActive(false);
|
||||
}
|
||||
|
||||
void MacroActionAudio::StartFade()
|
||||
void MacroActionAudio::StartFade() const
|
||||
{
|
||||
if (_action == Action::SOURCE_VOLUME && !_audioSource.GetSource()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -57,14 +57,14 @@ public:
|
|||
bool _abortActiveFade = false;
|
||||
|
||||
private:
|
||||
void StartFade();
|
||||
void FadeVolume();
|
||||
void SetVolume(float vol);
|
||||
float GetCurrentVolume();
|
||||
void SetFadeActive(bool value);
|
||||
bool FadeActive();
|
||||
std::atomic_int *GetFadeIdPtr();
|
||||
float GetVolume();
|
||||
void StartFade() const;
|
||||
void FadeVolume() const;
|
||||
void SetVolume(float vol) const;
|
||||
float GetCurrentVolume() const;
|
||||
void SetFadeActive(bool value) const;
|
||||
bool FadeActive() const;
|
||||
std::atomic_int *GetFadeIdPtr() const;
|
||||
float GetVolume() const;
|
||||
|
||||
static bool _registered;
|
||||
static const std::string id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user