zorggn / love-asl

Advanced Source Library for Löve
ISC License
32 stars 3 forks source link

asource:setRolloff doesn't remain through clones #5

Open lilmike opened 1 year ago

lilmike commented 1 year ago

Hiya,

I got ripple mostly working with ASL, I'll be opening a new issue with info to update the readme with later... But in my usage, I've notice that doing something like the following:

tmpSound = love.audio.newAdvancedSource("sounds/blah.ogg", "static")
tmpSound:setRolloff(0)
sound = ripple.newSound(tmpSound)
love.audio.setPosition(0, 500, 0)
sound:play()

Will result in no sound being heard because the sound is positioned by default at 0, 0, 0, something the setRolloff is supposed to prevent. The fix is to do something like this:

local instance = sound:play()
instance._source:setRolloff(0)

Which will result in sound. This works, but should not be needed, because by cloning a source that already has the rolloff set to 0, it should keep that rolloff.

Thanks,

-Michael.

zorggn commented 1 year ago

Hi;

Good news is that i found relatively quickly why that (and any other parameter regular sources can have that i don't touch and just pass through) wouldn't get cloned... while i don't recall how i encountered the bug, i did push this commit to address it: https://github.com/zorggn/love-asl/commit/e5785d399a135039288023ce6cc941d7d600045c ...however, i did forget to implement copying over those exact parameters, so i'll implement this ASAP.

(Tangentially related, but now that i have more time on my hands, i'll probably be able to implement a few major changes to the internals which might make instancing possible, and potentially tagging, along with a few other things i do need to improve upon.)

Thank you for your report!

zorggn commented 1 year ago

Please test it out, it should work. :3