keystroke recorder

clean-up: #51

today a very simple piece of code that takes whatever you're typing in a document and posts it back 2 seconds later. see it as a demonstration. the list is treated as a fifo buffer.
note: only works in supercollider versions with Document support (not 3.6, but 3.4, 3.5, 3.7)

(
var delay= 2; //post 2 seconds later
var l= List.new;

//--record in list l
Document.current.keyDownAction= {|doc, key|
        l.addFirst(
                (key: key, time: Main.elapsedTime)
        );
};

//--playback of list l
Routine({
        inf.do{
                var now= Main.elapsedTime;
                if(l.size>0 and:{now-delay>l.last.time}, {
                        l.pop.postln;
                });
                0.01.wait;
        };
}).play;
)