2 summary:: An envelope editor view
3 categories:: GUI>Kits>Cocoa
4 related:: Classes/EnvelopeView
7 An editable Envelope view.
9 subsection:: Some Important Issues Regarding SCEnvelopeEdit
11 The breakpoints are color coded as follows:
14 ## red || sustain node
25 An instance of link::Classes/Rect::, or a link::Classes/Point:: indicating code::width@height::.
27 The envelope. An instance of link::Classes/Env::.
28 argument:: pointsPerSegment
29 The resolution in points per segment. Default value is 10.
31 method:: paletteExample
35 subsection:: Subclassing and Internal Methods
37 The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
44 If the link::Classes/Env:: object is modified directly, this needs to be called to update the GUI.
47 Changes maximum level shown in editor.
49 An instance of link::Classes/Float::.
52 Changes minimum level shown in editor.
54 An instance of link::Classes/Float::.
57 Changes minimum time (sec) shown in editor. Negative times are okay because link::Classes/Env:: uses inter-node durations.
59 An instance of link::Classes/Float::. Seconds.
62 Changes maximum time (sec) shown in editor.
64 An instance of link::Classes/Float::. Seconds.
67 subsection:: Subclassing and Internal Methods
69 The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
71 method:: defaultMouseDownAction
75 argument:: buttonNumber
82 method:: addBreakPoint
89 method:: pointsPerSegment
91 method:: initSCEnvelopeEdit
100 method:: updateSegment
110 e = Env([1, 2], [10]);
111 w = Window("Env Editor", Rect(200, 200, 300, 200));
112 v = SCEnvelopeEdit(w, w.view.bounds.moveBy(20, 20).resizeBy(-40, -40), e, 20).resize_(5);
124 v.maxLevel_(2); // to give more headroom
125 v.maxTime_(2); // to increase release point
126 v.minTime_(-1); // to increase attack time
128 e.curves_('sin'); // env object is changed
129 v.refresh; // must refresh editor
138 e = Env([0, 1, 0.7, 0.9, 0], [0.03, 0.03, 0.03, 0.03], 'sin');
139 f = Env([0, 1, 0.7, 0.9, 0], [0.03, 0.03, 0.03, 0.03], 'sin');
140 w = Window("Shards", Rect(100, 100, 500, 400));
141 v = SCEnvelopeEdit(w, w.view.bounds.resizeBy(-20, -200), e, 10).resize_(2);
142 StaticText(w, v.bounds).string_(" amplitude").resize_(2);
143 x = SCEnvelopeEdit(w, v.bounds.moveBy(0, 200), f, 10).resize_(2);
144 StaticText(w, x.bounds).string_(" frequency").resize_(2);
149 SynthDef("sineBlip", {
150 arg freq = 440, vol = 0.1, la0, la1, la2, la3, la4, ta0, ta1, ta2, ta3, crva,
151 lf0, lf1, lf2, lf3, lf4, tf0, tf1, tf2, tf3, crvf;
152 var signal, fenv, aenv;
153 fenv = EnvGen.ar(Env([lf0, lf1, lf2, lf3, lf4], [tf0, tf1, tf2, tf3], crvf));
154 aenv = EnvGen.ar(Env([la0, la1, la2, la3, la4], [ta0, ta1, ta2, ta3], crva), doneAction: 2);
155 signal = SinOsc.ar([freq, freq*2] * fenv) * aenv * vol;
156 Out.ar(0, signal.dup);
171 x.env.curves)).flatten;
172 s.sendBundle(s.latency, [\s_new, "sineBlip", -1, 1, 1, \freq, exprand(4e3,11e3)] ++ par);