184 lines
4.3 KiB
Text
184 lines
4.3 KiB
Text
|
#lang scribble/manual
|
||
|
@(require (for-label racket))
|
||
|
|
||
|
@title{ProxyMixerOld}
|
||
|
mix control for a proxyspace@section{categories}
|
||
|
Libraries>JITLib>GUI
|
||
|
@section{related}
|
||
|
Classes/ProxySpace, Classes/NodeProxyEditor
|
||
|
|
||
|
@section{description}
|
||
|
|
||
|
|
||
|
@section{warning}
|
||
|
|
||
|
ProxyMixer has been updated - some little adaptations to existing uses may be needed. If you like, you can also replace "ProxyMixer" with "ProxyMixerOld" to keep using the old style of ProxyMixer.
|
||
|
::
|
||
|
|
||
|
ProxyMixer provides controls for handling and editing the node proxies in a proxyspace and their monitors (cross-platform graphics).
|
||
|
|
||
|
Overview: link::Overviews/JITLib::
|
||
|
|
||
|
@section{ClassMethods}
|
||
|
|
||
|
|
||
|
@section{private}
|
||
|
initClass
|
||
|
|
||
|
@section{subsection}
|
||
|
Creation
|
||
|
|
||
|
@section{method}
|
||
|
new
|
||
|
|
||
|
@section{argument}
|
||
|
proxyspace
|
||
|
a link::Classes/ProxySpace::
|
||
|
|
||
|
@section{argument}
|
||
|
nProxies
|
||
|
the maximum number of proxies you plan to use
|
||
|
|
||
|
@section{argument}
|
||
|
title
|
||
|
window title
|
||
|
|
||
|
@section{argument}
|
||
|
where
|
||
|
window bounds
|
||
|
|
||
|
@section{Examples}
|
||
|
|
||
|
|
||
|
|
||
|
@racketblock[
|
||
|
p = ProxySpace.push(s.boot, \p);
|
||
|
m = ProxyMixer(p, 8, \p, Rect(20, 500, 0,0));
|
||
|
|
||
|
m = ProxyMixer(p, 8)
|
||
|
|
||
|
// the top left menu sets which proxies will be shown.
|
||
|
|
||
|
// existingProxies: even an empty proxy is shown
|
||
|
~test.ar;
|
||
|
|
||
|
( // activeProxies: proxy appears when it is alive
|
||
|
~test = { |freq=250, intv=19, timescale=1, curve=0, loopnode=0|
|
||
|
var env = EnvGen.kr(
|
||
|
Env({ 1.0.rand2 }!11, {1.0.rand}!10, curve, releaseNode: 9, loopNode: loopnode),
|
||
|
timeScale: timescale);
|
||
|
var pitch = (env * [1, 0.33, -1] * intv).midiratio * freq;
|
||
|
Splay.ar(Formant.ar(pitch, pitch.scramble * 2, pitch.scramble)) * 0.1;
|
||
|
};
|
||
|
)
|
||
|
~test.lag(\freq, 4);
|
||
|
|
||
|
// playingProxies : only those that really play are shown.
|
||
|
~test.playN(vol: 1);
|
||
|
|
||
|
// switch back to active proxies...
|
||
|
|
||
|
// the reduce button removes all proxies that are not playing
|
||
|
// and that are not used as sources in other proxies:
|
||
|
~otto = { |dens=12| Dust.ar(dens) };
|
||
|
|
||
|
~otto.clear; // remove it
|
||
|
p.reduce;
|
||
|
|
||
|
// doc and docc post the current proxyspace as code
|
||
|
p.document;
|
||
|
|
||
|
// openEdit opens the editor zone, see below;
|
||
|
m.openEditZone(1);
|
||
|
|
||
|
// R opens a Record utility, see below.
|
||
|
|
||
|
// the line of controls for one proxy and its monitor is
|
||
|
// a ProxyMonitorGui, so for full details see ProxyMonitorGui.help.
|
||
|
|
||
|
// it displays current volume,
|
||
|
~test.vol_(0.05);
|
||
|
~test.vol_(0.1);
|
||
|
|
||
|
// proxy name; play/stop/end control:
|
||
|
~test.playN; // playN as is
|
||
|
~test.stop; // stop
|
||
|
~test.end; // option-click on stop : end the monitor and the proxy itself.
|
||
|
~test.playN(vol: 0); // option-click on play : start playing with volume zero.
|
||
|
|
||
|
~test.vol_(0.1);
|
||
|
|
||
|
s.scope(8);
|
||
|
~test.playN(4); // set proxy's first output channel:
|
||
|
~test.playN(0);
|
||
|
|
||
|
// the "-=" / "-<" button supports multichannel monitoring,
|
||
|
// see ProxyMonitorGui.help
|
||
|
|
||
|
// paus/rsum toggles pause and resume:
|
||
|
~test.pause;
|
||
|
~test.resume;
|
||
|
|
||
|
// send button resends the proxy,
|
||
|
// option-click on send rebuilds the proxy
|
||
|
// (e.g. for lookup in client-site state)
|
||
|
~test.send;
|
||
|
~test.send;
|
||
|
~test.send;
|
||
|
~test.rebuild;
|
||
|
~test.rebuild;
|
||
|
~test.rebuild;
|
||
|
|
||
|
|
||
|
// the ed button sends this proxy to the editor - see below
|
||
|
|
||
|
// kr proxies show up in the middle
|
||
|
~lfo = { SinOsc.kr(2) };
|
||
|
~lfnoyz0 = { |lofreq, mul=1, add| LFDNoise0.kr(lofreq, mul, add) };
|
||
|
|
||
|
// the editor zone is a NodeProxyEditor
|
||
|
// open it and set some params
|
||
|
m.openEditZone(1);
|
||
|
m.editor.proxy_(~test);
|
||
|
~test.set(\freq, exprand(80, 1250)); // set ~tests parameters
|
||
|
~test.set(\intv, 1.0.linrand);
|
||
|
|
||
|
// if you declare global specs for the range of a parameter,
|
||
|
// they can be used in the editor:
|
||
|
Spec.add(\intv, [0, 36, \lin]);
|
||
|
Spec.add(\timescale, [0.001, 10, \exp]);
|
||
|
Spec.add(\loopnode, [0, 7, \lin, 1]);
|
||
|
Spec.add(\curve, [-10, 10]);
|
||
|
|
||
|
m.editor.proxy_(~test);
|
||
|
|
||
|
// you can map a kr proxy to a control param;
|
||
|
~test.map(\intv, ~lfnoyz0);
|
||
|
~test.unmap(\intv);
|
||
|
// this also works by dragging the kr proxy name
|
||
|
// the field left of the param name.
|
||
|
|
||
|
|
||
|
// some more tests :
|
||
|
// if there are too many ar proxies, a scroller appears
|
||
|
( // test too many
|
||
|
10.do { |i| p[("test" ++ i).asSymbol] = {
|
||
|
Pan2.ar(Ringz.ar(Impulse.ar(exprand(0.5, 4)), exprand(300, 3000), 0.02), 1.0.rand2, 0.2) };
|
||
|
};
|
||
|
)
|
||
|
|
||
|
10.do { |i| p[("test" ++ i).asSymbol].playN(vol: linrand(1.0), fadeTime: exprand(0.01, 5)) };
|
||
|
|
||
|
// and the same for kr proxies
|
||
|
10.do { |i| p[("kr" ++ i).asSymbol] = { LFNoise0.kr(exprand(5, 50)) }; };
|
||
|
|
||
|
p.krProxyNames.do { |key| p.removeAt(key) };
|
||
|
|
||
|
p.reduce(method: \clear);
|
||
|
|
||
|
p.clean;
|
||
|
::
|
||
|
]
|
||
|
|
||
|
|