Davidobot / love.js

LÖVE ported to the web using Emscripten, updated to the latest Emscripten and LÖVE (v11.5)
MIT License
605 stars 27 forks source link

Cloning and playing audio source doesn't remove the active source count after it's finished playing. #66

Closed Yolwoocle closed 2 years ago

Yolwoocle commented 2 years ago

First off, thank you for continuing to maintain this. It's been very useful for me.

Cloning a sound, then playing it, doesn't remove the source from active sources after it's finished. How to reproduce:

somesound = love.audio.newSource("whatever/path.wav", "static")
function love.keypressed(key)
    if key == "space" then
        local newsource = somesound:clone()
        newsource:play()
    end
end

function love.update(dt)
    -- This number goes back to 0 on normal LÖVE after playback is finished, but continues to grow with love.js
    print(love.audio.getActiveSourceCount()) 
end
Davidobot commented 2 years ago

Does this happen in both the compat and the normal version?

Yolwoocle commented 2 years ago

I do not know. I'm using makelove to compile it, where the code used can be seen here: https://github.com/pfirsich/makelove/blob/master/makelove/makelove.py

Davidobot commented 2 years ago

Yeah from the looks of it, it uses the compatibility version. The notes specify that the audio is dodgy on there. This: https://github.com/Davidobot/love.js/issues/61 should fix this issue.

Let me sit down and try to work on it.

Yolwoocle commented 2 years ago

Thank you very much!

Davidobot commented 2 years ago

Should be working as of the latest release. See the updated specification test here https://davidobot.net/lovejs/lovejs_spec_c/

The compatibility version's audio works just fine now. Let me know if this fixes this issue.

Yolwoocle commented 2 years ago

Thank you very much! I will report back if I encounter the issue again.