[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] preliminary fix for Server:dumpOSC



Since there is currently no fix for the broken dumpOSC in sc server app, I've implemented an sclang version that seems to work fine. Any objections?

+	// currently broken
 	dumpOSC { arg code=1;
 		/*
 			0 - turn dumping OFF.
@@ -628,7 +630,15 @@
 		dumpMode = code;
 		this.sendMsg(\dumpOSC,code);
 	}
-
+*/
+	dumpOSC { arg code=1;
+		if(code > 0) {
+			addr = DumpNetAddr.newFrom(addr);
+		} {
+			addr = addr.saveAddr;
+		}
+	}
+


===================================================================
--- /Volumes/data/sc/SuperCollider3/build/SCClassLibrary/Common/Control/NetAddr.sc (revision 9638) +++ /Volumes/data/sc/SuperCollider3/build/SCClassLibrary/Common/Control/NetAddr.sc (working copy)
@@ -252,3 +252,51 @@
 		^res
 	}
 }
+
+DumpNetAddr : NetAddr {
+	var <>saveAddr;
+
+	*newFrom { arg addr;
+		^this.new(addr.hostname, addr.port).saveAddr_(addr);
+	}
+
+	sendRaw { arg rawArray;
+		this.dump(nil, rawArray);
+		super.sendRaw(rawArray);
+	}
+
+	sendMsg { arg ... args;
+		this.dump(nil, [args]);
+		super.sendMsg(*args);
+	}
+
+	sendBundle { arg time ... args;
+		this.dump(time, args);
+		super.sendBundle(time, *args);
+	}
+
+	dump { arg time, args;
+		var str, docStr, beats, beatsThisThread;
+ if(#['/status', '/quit'].includes(args.obtain(0).obtain(0).asSymbol))
+			{ ^this };
+		// should get the beats outside the { }.defer block
+		beats = SystemClock.seconds;
+		beatsThisThread = thisThread.clock.tryPerform(\beats);
+		defer {
+ str = "latency %\tSystemClock logical time %\n thisThread logical time %\n"
+				.format(time, beats, beatsThisThread);
+			args.do { |msg|
+				str = str ++ Char.tab;
+				msg = msg.collect { arg el;
+ if(el.isKindOf(RawArray) and: { el.size > 15 }) + { "data[%]".format(el.size) } { el };
+				};
+				str = str ++ msg.asCompileString ++ Char.nl;
+			};
+			str.postln;
+			str = str ++ Char.nl;
+		};
+	}
+
+}
+

--





.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/