• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 40,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

stackmat.js - use the Stackmat timer on the Web

tim

Member
Joined
Nov 22, 2006
Messages
1,692
Location
Karlsruhe, Germany
WCA
2007HABE01
YouTube
Visit Channel
Hey!

Since I make great use of mark2 for Cubemania, I'd like to give something back to the community:
I spent my entire Saturday hacking on a small library which provides access to the Stackmat timer from within JavaScript (no Flash or Java required!). This is done by using the HTML5 Web Audio API.

Supported browsers:
* Chrome (version > 21)

A quick demo: http://jsfiddle.net/q97Zc/

Github link: https://github.com/timhabermaas/stackmat.js

Be aware: It's still pre-alpha — in fact it doesn't even have a version number, yet. So, it's probably totally broken.

I'm not too happy with the public API. Maybe polling for updates instead of firing callbacks is more convenient? I'd like to hear some feedback! :)

Big thanks to:
- Florian W. for his documentation on the Stackmat protocol: http://hackvalue.de/hv_atmel_stackmat
- Walter for PPT. I peeked more than once into his stackmat code.
- Vino for his idea of using the Audio API in combination with a Stackmat timer.
- Thomas Müller for lending me his Stackmat timer. :)
 
Last edited:

jfly

Member
Joined
Aug 23, 2008
Messages
226
Location
California
WCA
2005FLEI01
YouTube
Visit Channel
Yeah, whoops. That probably shouldn't have gotten committed.

I think polling is more appropriate than callbacks for someone rendering the time. A properly written program will have its own rendering thread (using requestAnimationFrame if they're really on top of things).

It would be nice to be able to register callbacks for events like "timer started", "timer stopped", "timer reset", "hands changed", however.
 

CoderGuru

Member
Joined
Jun 5, 2021
Messages
168
Location
United Kingdom
Yep, I'm interested. I'll give it a shot next week since I'm quite busy right now.

In the meantime: What's this line for? Avoiding the browser's cache?

Could a working example be created? I've been trying to configure this, including trying the example and both don't work. Help would be appreciated.
 
Top