Add session timer in the post window
This commit is contained in:
@ -70,20 +70,25 @@ Boot {
|
||||
|
||||
*installServerTreeBehavior {
|
||||
CmdPeriod.add({
|
||||
BuboUtils.fancyPrint("\nBubo SuperCollider Session\nTempo: % | Peers: %\nCPU: % | Peak: %\n".format(
|
||||
this.clock.tempo * 60, this.clock.numPeers, Server.default.avgCPU.round(2), Server.default.peakCPU.round(2)), 40);
|
||||
BuboUtils.fancyPrint("\nBubo SuperCollider Session\nTempo: % | Peers: %\nCPU: % | Peak: %\n".format(
|
||||
this.clock.tempo * 60,
|
||||
this.clock.numPeers,
|
||||
Server.default.avgCPU.round(2),
|
||||
Server.default.peakCPU.round(2)),
|
||||
40
|
||||
);
|
||||
|
||||
// This Routine prints the current server state
|
||||
Tdef(\log, {
|
||||
loop {
|
||||
"TP: %/% CPU: %".format(
|
||||
TempoClock.default.bar,
|
||||
TempoClock.default.beats,
|
||||
Server.default.avgCPU
|
||||
).postln;
|
||||
1.0.wait;
|
||||
}
|
||||
}).play;
|
||||
Tdef(\log, {
|
||||
loop {
|
||||
"[TIME: %] | [TP: %/%] | [CPU: % ]".format(
|
||||
BuboUtils.timer(),
|
||||
TempoClock.default.bar, TempoClock.default.beats,
|
||||
Server.default.avgCPU.asInteger
|
||||
).postln;
|
||||
1.0.wait;
|
||||
}
|
||||
}).play;
|
||||
|
||||
}, Server.default);
|
||||
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
BuboUtils {
|
||||
|
||||
*timer {
|
||||
var time = Main.elapsedTime;
|
||||
var hours = (time / 3600).asInteger;
|
||||
var minutes = ((time % 3600) / 60).asInteger;
|
||||
var secs = (time % 60).asInteger;
|
||||
^("%:%:%".format(hours, minutes, secs))
|
||||
}
|
||||
|
||||
*banner {
|
||||
var banner = "┳┓ ┓ ┳┓ ┓ ┳┓\n"
|
||||
"┣┫┓┏┣┓┏┓┣┫┓┏┣┓┏┓ ┣┫┏┓┏┓╋\n"
|
||||
|
||||
@ -190,3 +190,24 @@ m = MIDIOut.newByName("MIDI", "Bus 1");
|
||||
});
|
||||
~apply.play;
|
||||
)
|
||||
|
||||
Main.elapsedTime
|
||||
|
||||
(
|
||||
d.formatTime = {
|
||||
arg seconds = 0;
|
||||
var hours = seconds / 3600;
|
||||
var minutes = (seconds % 3600) / 60;
|
||||
var secs = (seconds % 60);
|
||||
hours = hours.asString.padLeft(2, $0);
|
||||
minutes = minutes.asString.padLeft(2, $0);
|
||||
secs = secs.asString.padLeft(2, $0);
|
||||
^hours ++ ":" ++ minutes ++ ":" ++ secs
|
||||
};
|
||||
)
|
||||
|
||||
d.formatTime
|
||||
|
||||
d.formatTime(20).postln;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user