Pdef(\fagi1).play;
Pdef(\fagi2).play;
Pdef(\fagi1).stop;
-Pdef(\fagi2).stop;
\ No newline at end of file
+Pdef(\fagi2).stop;
+
+// history
+
+(
+// create a short history
+h = History([
+ [0, \me, "1+2"],
+ [1, \me, "3+5"], [1.234, \you, "q = q ? ();"],
+ [3, \they, "\"The story\".speak"]
+]);
+// make a gui for it
+g = h.makeWin(0@20);
+// find or make a text window for code line display
+// (called 'doc' because that was a Document in pre-Qt times)
+g.findDoc;
+// post line at index 2 in h.lines in doc window
+g.postDoc(2);
+)
+
+h.document;
+
+// show how filtering works:
+
+g.filtering; // is filter on?
+g.filterOff; // shorthand for off
+g.filterOn; // and on
+
+// filtering looks for lines by author key(s)
+// and strings in the code lines:
+g.filters.postcs;
+
+g.setKeyFilter(\all);
+g.setKeyFilter(\me);
+g.setStrFilter("");
+g.setStrFilter("3");
+
+g.filters.postcs;
+
+// internal state cached in the HistoryGui:
+g.filteredIndices;
+g.filteredShorts;
+
+//
+
+History.clear.end; // if needed, clear History first
+History.start; // starts recording, opens log file
+
+// execute these lines one by one, as a little performance history
+1 + 2;
+p = ProxySpace.push(s.boot);
+~a = {Dust.ar([1,1] * 30 ) * 0.3 };
+~a.play;
+~a.end(3);
+
+History.started; // is it on now?
+
+// stops recording history and ends logging.
+History.end;
+History.started;
+
+History.document; // creates a document with current history
+History.showLogFolder; // opens the folder where logs are written.
+History.showLogFile; // opens the current log file as it was written.
+
+
+// make a gui window, to access code history lines at will,
+// e.g. for code reuse in performance, adaptation, sharing, etc:
+g = History.makeWin;
+// specify left-bottom position, and number of lines in textview
+g = History.makeWin(0@20, 5);
+
+// play back the recorded history line by line
+History.play(0);
+
+
+// history can even record and play back stops with CmdPeriod.
+// run these lines one at a time:
+History.clear.start;
+1 + 2;
+2 + 3;
+s.boot;
+(dur: inf).play;
+
+CmdPeriod.run; // or hit the Stop key command, Cmd-., or ctrl-.
+3 + 4; // continue recording into history
+4 + 5;
+History.end;
+
+// Replays history, including a CmdPeriod, and keeps replaying history.
+History.play;
\ No newline at end of file