Rocket-Bytes/Source/Musicbox.lua

23 lines
656 B
Lua
Raw Normal View History

2022-06-20 05:56:43 +00:00
local paused = false
local playbackRate = 1.0
function updateBox()
local change, aChange = playdate.getCrankChange()
if paused then
song:setRate(change*0.03)
else
playbackRate += change*0.001
if playbackRate < 0.1 then playbackRate = 0.1 end
song:setRate(playbackRate)
end
if playdate.buttonJustPressed(playdate.kButtonA) then
if paused == true then paused = false else paused = true end
playbackRate = 1.0
end
if playdate.buttonJustPressed(playdate.kButtonB) or playdate.buttonJustPressed(playdate.kButtonLeft) then
createMenu(songlist)
song:stop()
end
end