2 scope { arg numChannels, index = 0, bufsize = 4096, zoom = 1, rate = \audio;
3 numChannels = (numChannels ? 2).min(16);
6 if(scopeWindow.isNil) {
7 scopeWindow = Stethoscope(this, numChannels, index, bufsize, zoom, rate, nil,
8 this.options.numBuffers);
9 // prevent buffer conflicts by using reserved bufnum
10 scopeWindow.window.onClose = scopeWindow.window.onClose.addFunc({ scopeWindow = nil });
11 ServerTree.add(this, this);
13 scopeWindow.setProperties(numChannels, index, bufsize, zoom, rate);
15 scopeWindow.window.front;
21 GUI.current.freqScopeView.tryPerform('server_', this);
22 // FIXME: Can not change server in SwingOSC GUI.
28 scope { arg bufsize = 4096, zoom;
29 ^server.scope(numChannels, index, bufsize, zoom, rate);
35 scope { arg numChannels, outbus = 0, fadeTime = 0.05, bufsize = 4096, zoom;
36 var synth, synthDef, bytes, synthMsg, outUGen, server;
38 server = GUI.stethoscope.defaultServer;
39 if(server.serverRunning.not) {
40 (server.name.asString ++ " server not running!").postln;
44 synthDef = this.asSynthDef(name: SystemSynthDefs.generateTempName, fadeTime:fadeTime);
45 outUGen = synthDef.children.detect { |ugen| ugen.class === Out };
47 numChannels = numChannels ?? { if(outUGen.notNil) { (outUGen.inputs.size - 1) } { 1 } };
48 synth = Synth.basicNew(synthDef.name, server);
49 bytes = synthDef.asBytes;
50 synthMsg = synth.newMsg(server, [\i_out, outbus, \out, outbus], \addToHead);
51 server.sendMsg("/d_recv", bytes, synthMsg);
52 server.scope(numChannels, outbus, bufsize, zoom, outUGen.rate);
57 var server = if (GUI.id === \swing)
58 { GUI.freqScopeView.audioServer } { GUI.freqScopeView.server };