klesun-productions / klesun-productions.github.io

MIDI song editor in a web page + soundfont player... and 100500 other misc web apps on my server
https://klesun.github.io/
10 stars 4 forks source link

When switching tab playback is messed #6

Closed klesun closed 8 years ago

klesun commented 9 years ago

Because Chrome has one setTimeout() per second limitation. Probably try workers? http://stackoverflow.com/questions/5927284/how-can-i-make-setinterval-also-work-when-a-tab-is-inactive-in-chrome/5927432#12522580

klesun commented 9 years ago

I've got a solution! Just slow down tempo... maybe 8x - so that smallest possible interval was 1 second... nda. Maybe better slow down 12x (or 6x... 1/4/3 * 6 = 1/2 = 2 seconds) so triplets were good too

klesun commented 8 years ago

The last solution is lame primarily because firefox, for example, does not handle timeouts of inactive tabs at all. What probably will be good - stop playback when tab looses the focus and continue when focus returns.

klesun commented 8 years ago

probably one day i'll do an optional checkbox for workers instead of setTimeout

klesun commented 8 years ago

c4f3477c6c84e9bb9c1139790ea0a173a966bf3e