FluidWaveform 'lineWidth' argument now also affects feature lines

nix
Ted Moore 4 years ago
parent 65a88ef92d
commit 845ef8449c

@ -128,18 +128,20 @@ FluidWaveformIndicesLayer : FluidViewer {
} }
FluidWaveformFeaturesLayer : FluidViewer { FluidWaveformFeaturesLayer : FluidViewer {
var featuresBuffer, colors, stackFeatures, normalizeFeaturesIndependently; var featuresBuffer, colors, stackFeatures, normalizeFeaturesIndependently, lineWidth;
*new { *new {
arg featuresBuffer, colors, stackFeatures = false, normalizeFeaturesIndependently = true; arg featuresBuffer, colors, stackFeatures = false, normalizeFeaturesIndependently = true, lineWidth = 1;
^super.new.init(featuresBuffer,colors,stackFeatures,normalizeFeaturesIndependently); ^super.new.init(featuresBuffer,colors,stackFeatures,normalizeFeaturesIndependently,lineWidth);
} }
init { init {
arg featuresBuffer_, colors_, stackFeatures_ = false, normalizeFeaturesIndependently_ = true; arg featuresBuffer_, colors_, stackFeatures_ = false, normalizeFeaturesIndependently_ = true, lineWidth_ = 1;
featuresBuffer = featuresBuffer_; featuresBuffer = featuresBuffer_;
normalizeFeaturesIndependently = normalizeFeaturesIndependently_; normalizeFeaturesIndependently = normalizeFeaturesIndependently_;
stackFeatures = stackFeatures_; stackFeatures = stackFeatures_;
lineWidth = lineWidth_;
colors = colors_ ?? {this.createCatColors}; colors = colors_ ?? {this.createCatColors};
// we'll index into it to draw, so just in case the user passed just one color, this will ensure it can be "indexed" into // we'll index into it to draw, so just in case the user passed just one color, this will ensure it can be "indexed" into
@ -188,6 +190,7 @@ FluidWaveformFeaturesLayer : FluidViewer {
UserView(win,bounds) UserView(win,bounds)
.drawFunc_({ .drawFunc_({
Pen.width_(lineWidth);
Pen.moveTo(Point(0,channel[0])); Pen.moveTo(Point(0,channel[0]));
channel[1..].do{ channel[1..].do{
arg val, i; arg val, i;
@ -347,7 +350,7 @@ FluidWaveform : FluidViewer {
}); });
if(feature_buf.notNil,{ if(feature_buf.notNil,{
this.addFeaturesLayer(feature_buf,this.createCatColors,stackFeatures,normalizeFeaturesIndependently); this.addFeaturesLayer(feature_buf,this.createCatColors,stackFeatures,normalizeFeaturesIndependently,lineWidth);
feature_buf.server.sync; feature_buf.server.sync;
plotImmediately = true; plotImmediately = true;
}); });
@ -395,8 +398,8 @@ FluidWaveform : FluidViewer {
} }
addFeaturesLayer { addFeaturesLayer {
arg featuresBuffer, colors, stackFeatures = false, normalizeFeaturesIndependently = true; arg featuresBuffer, colors, stackFeatures = false, normalizeFeaturesIndependently = true, lineWidth = 1;
var l = FluidWaveformFeaturesLayer(featuresBuffer,colors,stackFeatures,normalizeFeaturesIndependently); var l = FluidWaveformFeaturesLayer(featuresBuffer,colors,stackFeatures,normalizeFeaturesIndependently,lineWidth);
// l.postln; // l.postln;
layers.add(l); layers.add(l);

Loading…
Cancel
Save