lovebrew / lovepotion

LÖVE for Nintendo Homebrew
https://lovebrew.org
Other
538 stars 41 forks source link

Fixed static sources not looping #198

Closed Nawias closed 1 year ago

Nawias commented 1 year ago

Summary of the Pull Request

This little change fixes a bug where static audio sources wouldn't loop. Solution by piepie62, I just put the code in place.

Validation Steps

  1. Take any audio file, preferably a short one. I tried both MP3 and OGG, but it should be irrelevant.
  2. Create a Source object from it and call :setLooping(true) on the source object.
  3. Call love.audio.play(your_source)

Example lua code (main.lua):

function love.load()
    local staticSource = love.audio.newSource('assets/sfx/sound.ogg',"static")
    staticSource:setLooping(true)
    love.audio.play(staticSource)
end

function love.gamepadpressed(joystick, button)
    if button == "start" then
        love.event.quit()
    end
end

Checklist

Screenshots

N/A