[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix manual visualiser picker

Kasper (Oct 2, 2025, 11:46 PM +0200) 5bc4b3bf 70cba330

+11 -10
+11 -10
src/lib/visualizer/Visualizer.svelte
··· 127 127 let next_vis = visualisers[1] 128 128 129 129 let current_shader_index = 0 130 - let is_transitioning = false 130 + let next_shader_index: number | null = null 131 131 let auto_transition_timeout: ReturnType<typeof setTimeout> | undefined 132 132 133 133 const visualizer = start_visualizer(audio_context, media_element_source, (info) => { ··· 141 141 let pending_transition: number | null = null 142 142 143 143 async function transition_to_shader(new_shader_index: number, duration = 2000) { 144 - if (is_transitioning) { 144 + if (next_shader_index !== null) { 145 145 pending_transition = new_shader_index 146 146 return 147 147 } ··· 151 151 return console.error('Missing canvas') 152 152 } 153 153 154 - is_transitioning = true 154 + next_shader_index = new_shader_index 155 155 clearTimeout(auto_transition_timeout) 156 156 157 157 // Start transition visualizer ··· 203 203 next_vis.toy?.pause() // Keep the instance for later use 204 204 205 205 current_shader_index = new_shader_index 206 - is_transitioning = false 206 + next_shader_index = null 207 207 208 208 schedule_auto_transition() 209 209 ··· 217 217 function schedule_auto_transition() { 218 218 clearTimeout(auto_transition_timeout) 219 219 auto_transition_timeout = setTimeout(() => { 220 - if (!is_transitioning) { 220 + if (next_shader_index === null) { 221 221 const next_index = (current_shader_index + 1) % shaders.length 222 222 transition_to_shader(next_index) 223 223 } ··· 237 237 } 238 238 239 239 function schedule_resize(vis: Vis) { 240 - if (!is_transitioning && !vis.is_main) { 240 + if (next_shader_index === null && !vis.is_main) { 241 241 vis.should_resize = true 242 242 return 243 243 } ··· 274 274 }} 275 275 onkeydown={(e) => { 276 276 if (check_modifiers(e, {})) { 277 + let shader_index = next_shader_index ?? current_shader_index 277 278 if (e.key === 'ArrowLeft') { 278 - transition_to_shader((current_shader_index - 1 + shaders.length) % shaders.length, 500) 279 + transition_to_shader((shader_index - 1 + shaders.length) % shaders.length, 500) 279 280 } else if (e.key === 'ArrowRight') { 280 - transition_to_shader((current_shader_index + 1) % shaders.length, 500) 281 - } else if (/^[0-9]$/.test(e.key)) { 282 - transition_to_shader(Math.min(current_shader_index + 1, shaders.length - 1), 500) 281 + transition_to_shader((shader_index + 1) % shaders.length, 500) 282 + } else if (/^[1-9]$/.test(e.key)) { 283 + transition_to_shader(Math.min(parseInt(e.key) - 1, shaders.length - 1), 500) 283 284 } else { 284 285 show_player_temporarily() 285 286 }