Added bgm and sfx sliders.
This commit is contained in:
@@ -88,7 +88,7 @@ void SoundEffect::PlaySFX(const std::string_view eventName,const vf2d&pos){
|
||||
float pitch=util::random(pitchDiff)+sfx.minPitch;
|
||||
|
||||
if(pos==CENTERED){
|
||||
Audio::Engine().Play(operator""_SFX(sfx.filename.c_str(),sfx.filename.length()),sfx.vol,0.0f,pitch);
|
||||
Audio::Engine().Play(operator""_SFX(sfx.filename.c_str(),sfx.filename.length()),sfx.vol*Audio::GetSFXVolume(),0.0f,pitch);
|
||||
}else{
|
||||
const float soundActivationRange="Audio.Environmental Audio Activation Range"_F;
|
||||
|
||||
@@ -97,7 +97,7 @@ void SoundEffect::PlaySFX(const std::string_view eventName,const vf2d&pos){
|
||||
float distRatio=1-distanceFromPlayer/soundActivationRange; //0-1 where 1 is full volume.
|
||||
float xDistRatio=(pos.x-game->GetPlayer()->GetX())/soundActivationRange; //0-1 where 1 is full volume.
|
||||
|
||||
float vol=distRatio*sfx.vol;
|
||||
float vol=distRatio*sfx.vol*Audio::GetSFXVolume();
|
||||
float pan=xDistRatio;
|
||||
Audio::Engine().Play(operator""_SFX(sfx.filename.c_str(),sfx.filename.length()),vol,pan,pitch);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user