Interesting issue with source:setEffect()

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Schwender.exe
Prole
Posts: 25
Joined: Mon Oct 16, 2017 6:07 pm
Location: the moon
Contact:

Interesting issue with source:setEffect()

Post by Schwender.exe »

So, I started trying to apply sounds to a project I'm working on and found a very strange issue of sorts? Essentially what I'm doing is playing a looped stream type audio source and applying reverb to the source depending on if the player is inside or outside. Then, I also have a short source which is static. I press a button to test the sound and on playing, it also applies reverb depending on if they're inside or outside. What happens is if I play the static sound inside then go outside, both sources have a lowered volume for a few seconds after? this only happens when I play the static source inside with reverb applied, then go outside. Even if the reverb is no longer applied to the sound effect and isn't playing while outside, the volume will still be lowered for a few seconds, after which it jumps back to the intended volume. I know it has to do with the static source applying/removing reverb because it only happens when I play the sound inside and then go outside. Volume is never touched/changed at all during this, so I know it has nothing to do with that.
Listening closely while inside, I can actually hear the volume of the stream source lowering when I play the sound effect as well which is strange? it shouldn't do that?

Here's what my code looks like:

Code: Select all

-- within sfx.lua file which is required at init
love.audio.setEffect( "reverb", {type="reverb",decaytime=0.5,roomrolloff=0,density=0.8} )
-- -- --
set_test = love.audio.newSource( "sfx/test.wav", 'static' )
sfx_soundscape = love.audio.newSource( "music/soundscape.wav", 'stream' )

-- updated within main update loop
function updateSoundscape()
  local tvolume = 0
  local volume = Settings.Audio.Volume/2
  local effect = false
  if _currentRoom == "outside" then
    tvolume = volume/4
  else
    tvolume = volume/12
    effect = true
  end
  sfx_soundscape:setEffect( "reverb", effect )
  sfx_soundscape:setVolume( tvolume )
end

-- this is within an update function which is within main update loop as well
sfx_test:setEffect( "reverb", _currentRoom ~= "outside" )

-- called when I press button to test sfx
sfx_test:stop()
sfx_test:setVolume( Settings.Audio.Volume*Settings.Audio.SFXVolume/2 )
sfx_test:play()

-- Settings.Audio.Volume and Settings.Audio.SFXVolume is never touched/altered/edited during any point
-- tvolume is the only value which is changed, however this acts as it should, volume changes instantaniously when going inside/outside, is only lowered when the problem I stated above is in effect.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 16 guests