Lixie-Labs / Emotiscope

Let your eyes enjoy the music too ✨ Extremely low-latency audio processing lets LEDs perfectly synchronize to your music's notation and tempo.
GNU General Public License v3.0
27 stars 5 forks source link

Needle UI should self-close after inactivity if the command to close it was never received #84

Closed connornishijima closed 2 months ago

connornishijima commented 2 months ago

If no commands have been received in 10 seconds, but the Needle UI (indicator seen on Emotiscope when you adjust the Brightness slider) is still open, this means Emotiscope missed the "slider_touch_end" command from the app, potentially due to a client-side refresh. The UI should force itself closed after inactivity to maintain things.

if ( UI is open ){
    if ( last command received >= 10 seconds ago ){
        force close the UI
    }
}

However, a trade off with this solution is that users who are intentionally holding the slider down for more than 10 seconds (for whatever reason) will see the UI desync from them and force close itself. Oh well. Better than having it get stuck. Also, the web app should send a "close the UI" packet or two upon loading anyways, also to help with potential desync.

Normally, the Needle UI waits for the "slider_touch_end" command to arrive to close itself, so that the UI will remain open even when you aren't moving the slider, as long as your thumb is still on it. That's something that was impossible on Sensory Bridge: knowing if the knobs were not only being turned, but still being touched if they weren't in motion.