5 var synthDescLibListView;
14 var updateSynthDefData;
20 hvBold12 = Font.sansSerif( 12 ).boldVariant;
21 fntMono = Font.monospace( 10 );
23 w = gui.window.new("SynthDef browser", Rect(128, (gui.window.screenBounds.height - 638).clip(0, 320),
25 w.view.decorator = FlowLayout(w.view.bounds);
27 w.view.decorator.shift(220);
31 item = this[synthDescListView.item.asSymbol];
33 synth = Synth(item.name);
36 SystemClock.sched(3, {
44 btn = gui.button.new(w, 48 @ 20);
45 btn.states = [["test"]];
48 btn = gui.button.new(w, 48 @ 20);
49 btn.states = [["window"]];
52 item = this[synthDescListView.item.asSymbol];
54 GUI.use( gui, { item.makeWindow });
58 w.view.decorator.nextLine;
59 gui.staticText.new(w, Rect(0,0,220,24)).string_("SynthDescLibs").font_(hvBold12);
60 gui.staticText.new(w, Rect(0,0,220,24)).string_("SynthDefs").font_(hvBold12);
61 gui.staticText.new(w, Rect(0,0,220,24)).string_("UGens").font_(hvBold12);
62 w.view.decorator.nextLine;
64 synthDescLibListView = gui.listView.new(w, Rect(0,0, 220, 320)).focus;
65 synthDescListView = gui.listView.new(w, Rect(0,0, 220, 320));
66 synthDescListView.beginDragAction_({arg v;
67 v.items[v.value].asSymbol;
69 ugensListView = gui.listView.new(w, Rect(0,0, 220, 320));
71 w.view.decorator.nextLine;
72 gui.staticText.new(w, Rect(0,0,240,24)).string_("SynthDef Controls")
73 .font_(hvBold12).align_(\center);
74 gui.staticText.new(w, Rect(0,0,200,24)).string_("SynthDef Inputs")
75 .font_(hvBold12).align_(\center);
76 gui.staticText.new(w, Rect(0,0,200,24)).string_("SynthDef Outputs")
77 .font_(hvBold12).align_(\center);
78 w.view.decorator.nextLine;
80 controlsListView = gui.listView.new(w, Rect(0,0, 240, 160));
81 inputsListView = gui.listView.new(w, Rect(0,0, 200, 160));
82 outputsListView = gui.listView.new(w, Rect(0,0, 200, 160));
83 controlsListView.resize = 4;
84 inputsListView.resize = 4;
85 outputsListView.resize = 4;
88 [controlsListView, inputsListView, outputsListView].do {
89 |listview| listview.selectionMode = \none
92 // this is a trick to not show hilighting.
93 controlsListView.hiliteColor = Color.clear;
94 inputsListView.hiliteColor = Color.clear;
95 outputsListView.hiliteColor = Color.clear;
96 controlsListView.selectedStringColor = Color.black;
97 inputsListView.selectedStringColor = Color.black;
98 outputsListView.selectedStringColor = Color.black;
101 controlsListView.font = fntMono;
102 inputsListView.font = fntMono;
103 outputsListView.font = fntMono;
105 w.view.decorator.nextLine;
107 synthDescLibListView.items_(SynthDescLib.all.keys.asArray.sort)
108 .value_(synthDescLibListView.items.indexOf(name) ? 0);
109 synthDescLibListView.action = {
110 synthDescListView.value = 0;
111 updateSynthDefs.value;
114 synthDescListView.items = [];
115 synthDescListView.action = {
116 updateSynthDefData.value;
118 synthDescListView.enterKeyAction = testFn;
123 libName = synthDescLibListView.item;
124 synthDescLib = SynthDescLib.all[libName];
125 synthDescList = synthDescLib.synthDescs.values.sort {|a,b| a.name <= b.name };
126 synthDescListView.items = synthDescList.collect {|desc| desc.name.asString };
128 updateSynthDefData.value;
131 updateSynthDefData = {
134 synthDesc = synthDescList[synthDescListView.value];
136 if (synthDesc.isNil) {
137 ugensListView.items = [];
138 inputsListView.items = [];
139 outputsListView.items = [];
140 controlsListView.items = [];
142 ugensListView.items = synthDesc.def.children.collect { |x, i|
143 i.asString.copy.extend(7, $ ) ++ x.class.name.asString;
146 inputsListView.items = synthDesc.inputs.collect { |x|
148 string = x.rate.asString.copy;
149 string = string.extend(9, $ ) ++ " " ++ x.startingChannel;
150 string = string.extend(19, $ ) ++ " " ++ x.numberOfChannels;
152 outputsListView.items = synthDesc.outputs.collect { |x|
154 string = x.rate.asString.copy;
155 string = string.extend(9, $ ) ++ " " ++ x.startingChannel;
156 string = string.extend(19, $ ) ++ " " ++ x.numberOfChannels;
158 controlsListView.items = synthDesc.controls.reject {|a|
162 string = if (x.name.notNil) { x.name.asString.copy; }{ "" };
164 string = string.extend(12, $ ) ++ " " ++ x.rate;
167 if (x.defaultValue.notNil) {
168 if (x.defaultValue.isArray) {
169 string = string.extend(22, $ ) ++ " " ++ x.defaultValue.collect(_.asStringPrec(6));
171 string = string.extend(22, $ ) ++ " " ++ x.defaultValue.asStringPrec(6);
178 updateSynthDefs.value;