Last active
February 29, 2024 12:26
-
-
Save scztt/536ecc746d4afbfc4094d7e99f7e1c71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ Bus { | |
debugScope { | |
| title, names | | |
var w, ms, listArray, size=380, sliderLoc=0, routine, bus, | |
min=1000.0, max=(-1000.0), minBox, maxBox, val=0, valBox, synth, m, n, bottom, | |
playSynthFunction, cmdPeriodFunction, layout; | |
cmdPeriodFunction = {}; | |
title = title ? "bus %".format( index ); | |
m = 0.0; n=0.0; | |
w = Window( title, scroll:true); | |
w.view.hasHorizontalScroller = false; | |
w.view.layout = layout = VLayout(); | |
listArray = Array.fill(200,0.0) ! numChannels; | |
ms = Array.newClear( numChannels ); | |
maxBox = Array.newClear( numChannels ); | |
minBox = Array.newClear( numChannels ); | |
valBox = Array.newClear( numChannels ); | |
min = 0 ! numChannels; | |
max = 0 ! numChannels; | |
numChannels.do({ | |
| i | | |
var comp, overlay; | |
comp = View() | |
.fixedHeight_(120) | |
.background_(Color.grey); | |
overlay = StaticText(bounds:350@50) | |
.font_( Font("M+ 1c", 34) ) | |
.stringColor_( Color.grey(0.8, 0.2) ) | |
.string_( " " ++ names.notNil.if({ names[i] }, { i + index }) ); | |
ms[i] = MultiSliderView(bounds:400@120) | |
.value_(listArray[i]) | |
.elasticMode_(true) | |
.editable_(false) | |
.background_(Color.clear) | |
.xOffset_(2) | |
.drawLines_(true) | |
.thumbSize_(1) | |
.drawRects_(false); | |
maxBox[i] = DragSink() | |
.fixedSize_(100@24) | |
.font_( Font("M+ 1c", 12) ) | |
.mouseDownAction_({ |obj| max[i]=(-99999999) }) | |
.string_(" " + 0.asString); | |
valBox[i] = DragSink() | |
.fixedSize_(100@24) | |
.font_( Font("M+ 1c", 12) ) | |
.string_(" " + 0.asString) | |
.stringColor_(Color.green); | |
minBox[i] = DragSink() | |
.fixedSize_(100@24) | |
.font_( Font("M+ 1c", 12) ) | |
.mouseDownAction_({ |obj| min[i]=(9999999) }) | |
.string_(" " + 0.asString); | |
comp.layout_(HLayout( | |
StackLayout(overlay, ms[i]).mode_(\stackAll), | |
VLayout( | |
maxBox[i], valBox[i], minBox[i] | |
) | |
)); | |
w.view.layout.add(comp); | |
}); | |
routine = SkipJack({ | |
var vals = this.getnSynchronous(this.numChannels).asArray; | |
vals.do({ | |
| val, i | | |
var aMin, aMax; | |
if( val > max[i], {max[i] = val}); | |
if( val < min[i], {min[i] = val}); | |
minBox[i].string_( " " + min[i].asString[0..7] ); | |
maxBox[i].string_( " " + max[i].asString[0..7] ); | |
valBox[i].string_(" " + val.asString[0..7] ); | |
listArray[i] = listArray[i].copyRange(1, 198) ++ [val]; | |
ms[i].value_( (listArray[i]-min[i])/(max[i]-min[i]) ); | |
}) | |
}, | |
dt: 1/30, | |
name: "debugScope", | |
clock: AppClock | |
); | |
routine.start; | |
CmdPeriod.add(cmdPeriodFunction); | |
w.onClose = { | |
routine.stop; | |
synth.free; | |
CmdPeriod.remove(cmdPeriodFunction); | |
}; | |
w.front; | |
} | |
} | |
+NodeProxy { | |
debugScope { | |
this.bus.debugScope(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made a few little changes to improve layout management: