Part 3 of the Scrempler cleanup.

Noticing a pattern here how I use the SWDataNetwork class, and wondering whether I should abstract this into a basic class for using these kinds of processing chains for instruments.

`
ScremplerWrist {
classvar <>acceleroSpec;
classvar <>motionSpec;</p>

var <network;

var <meannode;
var <stddevnode;

*initSpecs{
acceleroSpec = [ 0.46, 0.54 ].asSpec;
motionSpec = [ 0.0001, 0.15, \exponential ].asSpec;
}

*new{
^super.new.init;
}

init{
network = SWDataNetwork.new;
this.addHooks;
[ [1,\accelero],[2,\mean], [3,\stddev] ].do{ |it|
network.addExpected( it[0], it[1], 3 );
};
}

addHooks{
network.addHook( 1, {
network.nodes[1].action = MFunc.new;
network.nodes[1].createBus(Server.default);
meannode = MeanNode.new( 2, network, network.nodes[1].bus, Server.default );
meannode.set( \length, 500 );
fork{ 0.2.wait; meannode.start; };
stddevnode = StdDevNode.new( 3, network, network.nodes[1].bus, Server.default );
stddevnode.set( \length, 250 );
fork{ 0.2.wait; stddevnode.start; };
});
network.addHook( 2, {
network.nodes[2].action = MFunc.new;
});
network.addHook( 3, {
network.nodes[3].action = MFunc.new;
});
}

setData{ |data|
network.setData( 1, data );
}

directUni{
^acceleroSpec.unmap( network.nodes[1].data );
}

meanUni{
^acceleroSpec.unmap( network.nodes[2].data );
}

stdUni{
^motionSpec.unmap( network.nodes[3].data );
}

addAction{ |node,label,action|
network.nodes[ node ].action.addFirst( label, action );
}

removeAction{ |node, label|
network.nodes[ node ].action.removeAt( label );
}

enableAction{ |node, label|
network.nodes[ node ].action.enable( label );
}

disableAction{ |node, label|
network.nodes[ node ].action.disable( label );
}
}
` and in the instrument code: `
ScremplerWrist.initSpecs;
~wrists = 2.collect{ ScremplerWrist.new };

OSCdef( \scremplerwrist, { |msg|
if ( msg[1] == 1 ){
// msg.postln;
~wrists[0].setData( msg.copyRange( 6, 8 ); );
};
if ( msg[1] == 2 ){
// msg.postln;
~wrists[1].setData( msg.copyRange( 6, 8 ); );
};
}, "/minibee/data", NetAddr.new( "127.0.0.1", nil ) );

(
~wrists[0].addAction( 2, \grainmod, { |data|
var mapData = ~wrists[0].meanUni;
~players[0].grainfilter.setUni( \freqmod, mapData.at( 1 ) );
~players[0].grainer.setUni( \position, mapData.at( 2 ) );
~players[0].grainer.setUni( \ratemod, mapData.at( 1 ) );
~players[0].grainer.setUni( \pan, mapData.at( 0 ) );
});

~wrists[0].addAction( 3, \grainmod, { |data|
var mapData = ~wrists[0].stdUni;
~players[0].grainfilter.setUni( \rql, 1-mapData.at( 2 ) );
~players[0].grainfilter.setUni( \amp, 1-mapData.at( 2 ) );
~players[0].grainfilter.setUni( \rqh, 1-mapData.at( 0 ) );
~players[0].grainer.setUni( \dur, mapData.at( 0 ) );
~players[0].grainer.setUni( \dens, mapData.at( 1 ) );
});

~wrists[1].addAction( 2, \grainmod, { |data|
var mapData = ~wrists[1].meanUni;
~players[1].grainfilter.setUni( \freqmod, mapData.at( 1 ) );
~players[1].grainer.setUni( \position, mapData.at( 2 ) );
~players[1].grainer.setUni( \ratemod, mapData.at( 1 ) );
~players[1].grainer.setUni( \pan, mapData.at( 0 ) );
});

~wrists[1].addAction( 3, \grainmod, { |data|
var mapData = ~wrists[1].stdUni;
~players[1].grainfilter.setUni( \rql, 1-mapData.at( 2 ) );
~players[1].grainfilter.setUni( \amp, 1-mapData.at( 2 ) );
~players[1].grainfilter.setUni( \rqh, 1-mapData.at( 0 ) );
~players[1].grainer.setUni( \dur, mapData.at( 0 ) );
~players[1].grainer.setUni( \dens, mapData.at( 1 ) );
});

);
`