Skip to content

Commit

Permalink
fix: music stop
Browse files Browse the repository at this point in the history
  • Loading branch information
hteumeuleu committed Feb 12, 2023
1 parent 5d7709e commit 53a4f6e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/Scripts/pico-8.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ function music(n, fade_len, channel_mask)
fade_len = fade_len or 1000
channel_mask = channel_mask or 1

if n == -1 and musicPlayer ~= nil and musicPlayer:isPlaying() then
musicPlayer:stop()
end

if data.music[n] ~= nil then
if musicPlayer == nil then
musicPlayer = playdate.sound.fileplayer.new(data.music[n])
Expand Down

0 comments on commit 53a4f6e

Please sign in to comment.