2 scope { arg numChannels, index = 0, bufsize = 4096, zoom = 1, rate = \audio;
3 numChannels = (numChannels ? 2).min(16);
6 if(scopeWindow.isNil) {
7 if ((GUI.id == \qt) and: (this.isLocal)) {
8 scopeWindow = \QStethoscope2.asClass.new(this, numChannels, index, bufsize, zoom, rate);
10 scopeWindow = Stethoscope(this, numChannels, index, bufsize, zoom, rate, nil,
11 this.options.numBuffers);
12 // prevent buffer conflicts by using reserved bufnum
14 scopeWindow.window.onClose = scopeWindow.window.onClose.addFunc({ scopeWindow = nil });
15 ServerTree.add(this, this);
17 scopeWindow.setProperties(numChannels, index, bufsize, zoom, rate);
19 scopeWindow.window.front;
30 scope { arg bufsize = 4096, zoom;
31 ^server.scope(numChannels, index, bufsize, zoom, rate);
37 scope { arg numChannels, outbus = 0, fadeTime = 0.05, bufsize = 4096, zoom;
38 var synth, synthDef, bytes, synthMsg, outUGen, server;
41 server = Server.default;
43 server = GUI.stethoscope.defaultServer;
44 if(server.serverRunning.not) {
45 (server.name.asString ++ " server not running!").postln;
49 synthDef = this.asSynthDef(name: SystemSynthDefs.generateTempName, fadeTime:fadeTime);
50 outUGen = synthDef.children.detect { |ugen| ugen.class === Out };
52 numChannels = numChannels ?? { if(outUGen.notNil) { (outUGen.inputs.size - 1) } { 1 } };
53 synth = Synth.basicNew(synthDef.name, server);
54 bytes = synthDef.asBytes;
55 synthMsg = synth.newMsg(server, [\i_out, outbus, \out, outbus], \addToHead);
56 server.sendMsg("/d_recv", bytes, synthMsg);
57 server.scope(numChannels, outbus, bufsize, zoom, outUGen.rate);
62 var server = if (GUI.id == \qt) { Server.default } { GUI.stethoscope.defaultServer };