You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9 KiB
Plaintext

TITLE:: FluidBufSelect
summary:: Cherry pick values from a buffer
categories:: Libraries>FluidCorpusManipulation
related:: Classes/FluidBufSelectEvery
DESCRIPTION::
Pick sets of values from a buffer, described in terms of a list of frame indices and channel numbers.
CLASSMETHODS::
private::new1
METHOD:: process, processBlocking
Run the process on the given sever, and perfrom code::action:: when done
ARGUMENT:: server
The link::Classes/Server:: on which to run
ARGUMENT:: source
The link::Classes/Buffer:: to select values from
ARGUMENT:: destination
The link::Classes/Buffer:: to write the selected data to
ARGUMENT:: indices
A 0-based list of frame indices to recover. Default is [-1], meaning all frames
ARGUMENT:: channels
A 0-based list of channel numbers to recover. Default is [-1], meaning all frames
ARGUMENT:: freeWhenDone
Free the server instance when processing complete. Default true
ARGUMENT:: action
Runs when processing is complete
EXAMPLES::
code::
//send a known collection where the value of each frame in each channel is encoded
//chan
b = Buffer.sendCollection(s,30.collect{|x| x.mod(6) + (x.div(6) * 0.1)},6)
//check the ranges (thus showing a plotter error...)
b.plot(separately: true).plotMode_(\points)
//you can also check the collection itself if in doubt
b.getToFloatArray(action: {|x|x.round(0.1).postln;});
//let's make a destination buffer
c = Buffer(s);
//using default values, we copy everything:
FluidBufSelect.process(s,b,c,action: {c.query});
c.getToFloatArray(action: {|x|x.round(0.1).postln;});
//more powerful copying, resizing the destination accordingly
FluidBufSelect.process(s,b,c, indices: [1,3], channels: [2,4], action: {c.query});
c.getToFloatArray(action: {|x|x.round(0.1).postln;});
//observe the order can be anything, and -1 (default) passes everything in that dimension
FluidBufSelect.process(s,b,c, indices: [ -1 ] , channels: [3, 1, 4], action: {c.query});
c.getToFloatArray(action: {|x|x.round(0.1).postln;});
::