Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: more aggressively debounce tape playback #1759

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions lua/lib/fileselect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,18 @@ end

local function start()
if fs.previewing_timeout_counter ~= nil then return end
timeout()
stop()
fs.previewing = fs.pos
audio.tape_play_open(fs.getdir() .. fs.file)
audio.tape_play_start()
fs.redraw()
fs.previewing_timeout_counter = clock.run(function()
if fs.previewing then
stop()
clock.sleep(0.5)
end
fs.previewing = fs.pos
audio.tape_play_open(fs.getdir() .. fs.file)
audio.tape_play_start()
fs.redraw()
clock.sleep(1)
fs.previewing_timeout_counter = nil
end)
end

fs.key = function(n, z)
Expand Down Expand Up @@ -195,7 +201,11 @@ fs.key = function(n, z)
end
end
elseif z == 0 and fs.done == true then
fs.exit()
clock.run(function()
stop()
clock.sleep(0.5)
fs.exit()
end)
end
end

Expand Down