PiPo
Plug In Plug Out / Plugin Interface for Processing Objects
PiPo Class Referenceabstract
Inheritance diagram for PiPo:
PiPoBands PiPoBayesFilter PiPoBiquad PiPoChop PiPoConst PiPoDct PiPoDelta PiPoFft PiPoFiniteDif PiPoGate PiPoGraph PiPoIdentity PiPoLpc PiPoMedian PiPoMoments PiPoMvavrg PiPoOnseg PiPoOut PiPoParallel PiPoPeaks PiPoScale PiPoSelect PiPoSequence PiPoSlice PiPoSum

Classes

class  Atom
 
class  Attr
 
class  AttrArray
 
class  EnumAttr
 
class  Parent
 

Public Types

enum  Type {
  Undefined, Bool, Enum, Int,
  Float, Double, String
}
 
enum  Enumerate
 

Public Member Functions

 PiPo (Parent *parent, PiPo *receiver=NULL)
 
 PiPo (const PiPo &other)
 
virtual void setParent (Parent *parent)
 Sets PiPo parent. More...
 
int propagateStreamAttributes (bool hasTimeTags, double rate, double offset, unsigned int width, unsigned int height, const char **labels, bool hasVarSize, double domain, unsigned int maxFrames)
 Propagates a module's output stream attributes to its receiver. More...
 
int propagateReset (void)
 Propagates the reset control event. More...
 
int propagateFrames (double time, double weight, PiPoValue *values, unsigned int size, unsigned int num)
 Propagates a module's output frames to its receiver. More...
 
int propagateFinalize (double inputEnd)
 Propagates the finalize control event. More...
 
virtual PiPogetReceiver (unsigned int index=0)
 Gets a PiPo modules receiver (call only by the PiPo host) More...
 
virtual void setReceiver (PiPo *receiver, bool add=false)
 Sets a PiPo modules receiver (call only by the PiPo host) More...
 
virtual int streamAttributes (bool hasTimeTags, double rate, double offset, unsigned int width, unsigned int height, const char **labels, bool hasVarSize, double domain, unsigned int maxFrames)=0
 Configures a PiPo module according to the input stream attributes and propagate output stream attributes. More...
 
virtual int reset (void)
 Resets processing (optional) More...
 
virtual int frames (double time, double weight, PiPoValue *values, unsigned int size, unsigned int num)=0
 Processes a single frame or a block of frames. More...
 
virtual int segment (double time, bool start)
 Signals segment start or end. More...
 
virtual int finalize (double inputEnd)
 Finalizes processing (optinal) More...
 
void streamAttributesChanged (Attr *attr)
 
void signalError (std::string errorMsg)
 
void signalWarning (std::string errorMsg)
 
void addAttr (PiPo *pipo, const char *name, const char *descr, Attr *attr, bool clear=false)
 att attribute
 
AttrgetAttr (unsigned int index)
 Gets PiPo attribute by index. More...
 
AttrgetAttr (const char *name)
 Gets PiPo attribute by name. More...
 
AttrgetAttr (const char *piponame, const char *name)
 Gets PiPo attribute by qualified name. More...
 
bool setAttr (unsigned int index, int value, bool silently=false)
 
bool setAttr (unsigned int index, int *values, unsigned int numValues, bool silently=false)
 
bool setAttr (unsigned int index, double val, bool silently=false)
 
bool setAttr (unsigned int index, double *values, unsigned int numValues, bool silently=false)
 
unsigned int getNumAttrs (void)
 Gets number of attributes. More...
 
void cloneAttrs (PiPo *other)
 Copies current parent and attributes values. More...
 
void cloneAttr (PiPo::Attr *attr)
 Copies current value(s) of given attribute. More...
 

Static Public Member Functions

static float getVersion ()
 

Protected Attributes

Parentparent
 
std::vector< PiPo * > receivers
 
std::vector< Attr * > attrs
 

Member Function Documentation

◆ cloneAttr()

void PiPo::cloneAttr ( PiPo::Attr attr)
inline

Copies current value(s) of given attribute.

Parameters
attrattribute to clone from

◆ cloneAttrs()

void PiPo::cloneAttrs ( PiPo other)
inline

Copies current parent and attributes values.

Parameters
otherPiPo to clone

◆ finalize()

virtual int PiPo::finalize ( double  inputEnd)
inlinevirtual

Finalizes processing (optinal)

PiPo module: Any implementation of this method requires a propagateFinalize() method call and returns its return value.

PiPo host: A terminating receiver module provided by a PiPo host usally simply returns 0.

Parameters
inputEndend time of the finalized input stream
Returns
0 for ok or a negative error code (to be specified), -1 for an unspecified error

Reimplemented in PiPoGraph, PiPoOnseg, PiPoParallel, PiPoGate, PiPoSequence, PiPoChop, and PiPoConst.

◆ frames()

virtual int PiPo::frames ( double  time,
double  weight,
PiPoValue *  values,
unsigned int  size,
unsigned int  num 
)
pure virtual

Processes a single frame or a block of frames.

PiPo module: An implementation of this method may call propagateFrames(), typically like this:

return this->propagateFrames(time, weight, values, size, num);

PiPo host: A terminating receiver module provided by a PiPo host handles the received frames and usally returns 0.

Parameters
timetime-tag for a single frame or a block of frames
weightweight associated to frame or block
valuesinterleaved frames values, row by row (interleaving channels or columns), frame by frame TODO: should be const!!!
sizetotal size of each of all frames (size = number of elements = width * height = number of channels for audio)
numnumber of frames (number of samples for audio input)
Returns
0 for ok or a negative error code (to be specified), -1 for an unspecified error

Implemented in PiPoGraph, PiPoFiniteDif, PiPoFft, PiPoParallel, PiPoBiquad, PiPoScale, PiPoSelect, PiPoBands, PiPoOnseg, PiPoSequence, PiPoMedian, PiPoMvavrg, PiPoGate, PiPoSlice, PiPoDelta, PiPoPeaks, PiPoChop, PiPoLpc, PiPoOut, PiPoDct, PiPoBayesFilter, PiPoMoments, PiPoSum, PiPoConst, and PiPoIdentity.

◆ getAttr() [1/3]

Attr* PiPo::getAttr ( unsigned int  index)
inline

Gets PiPo attribute by index.

Parameters
indexattribute index
Returns
reference to PiPo attribute (NULL for invalid attribute index)

◆ getAttr() [2/3]

Attr* PiPo::getAttr ( const char *  name)
inline

Gets PiPo attribute by name.

Parameters
nameattribute name
Returns
reference to PiPo attribute (NULL for invalid attribute name)

◆ getAttr() [3/3]

Attr* PiPo::getAttr ( const char *  piponame,
const char *  name 
)
inline

Gets PiPo attribute by qualified name.

Parameters
piponamepipo module name in pipo chain
nameattribute name
Returns
reference to PiPo attribute (NULL for invalid attribute name)

◆ getNumAttrs()

unsigned int PiPo::getNumAttrs ( void  )
inline

Gets number of attributes.

Returns
number of attributes

◆ getReceiver()

virtual PiPo* PiPo::getReceiver ( unsigned int  index = 0)
inlinevirtual

Gets a PiPo modules receiver (call only by the PiPo host)

Returns
receiver PiPo module receiving this module's output stream

Reimplemented in PiPoGraph.

◆ getVersion()

static float PiPo::getVersion ( )
inlinestatic

get version of SDK as a major.minor float (so that host can check if a pipo was compiled with correct version of PiPo.h)

◆ propagateFinalize()

int PiPo::propagateFinalize ( double  inputEnd)
inline

Propagates the finalize control event.

This method is called in the finalize() method of a PiPo module.

Returns
used as return value of the calling method

◆ propagateFrames()

int PiPo::propagateFrames ( double  time,
double  weight,
PiPoValue *  values,
unsigned int  size,
unsigned int  num 
)
inline

Propagates a module's output frames to its receiver.

This method is called in the frames() method of a PiPo module.

Parameters
timetime-tag for a single frame or a block of frames
weightweight for this frame (currently unused)
valuesinterleaved frames values, row by row (interleaving channels or columns), frame by frame
sizetotal size of each frame (number of values = width * height)
numnumber of frames
Returns
used as return value of the calling method

◆ propagateReset()

int PiPo::propagateReset ( void  )
inline

Propagates the reset control event.

This method is called in the reset() method of a PiPo module.

Returns
used as return value of the calling method

◆ propagateStreamAttributes()

int PiPo::propagateStreamAttributes ( bool  hasTimeTags,
double  rate,
double  offset,
unsigned int  width,
unsigned int  height,
const char **  labels,
bool  hasVarSize,
double  domain,
unsigned int  maxFrames 
)
inline

Propagates a module's output stream attributes to its receiver.

This method is called in the streamAttributes() method of a PiPo module.

Parameters
hasTimeTagsa boolean representing whether the elements of the stream are time-tagged
ratethe frame rate (highest average rate for time-tagged streams)
offsetthe lag of the output stream relative to the input
widththe frame width (also number of channels or data matrix columns)
heightthe frame height (or number of matrix rows)
labelsoptional labels for the frames' channels or columns
hasVarSizea boolean representing whether the frames have a variable height (respecting the given frame height as maximum)
domainextent of a frame in the given domain (e.g. duration or frequency range)
maxFramesmaximum number of frames in a block exchanged between two modules
Returns
used as return value of the calling method

◆ reset()

virtual int PiPo::reset ( void  )
inlinevirtual

Resets processing (optional)

PiPo module: Any implementation of this method requires a propagateReset() method call and returns its return value.

PiPo host: A terminating receiver module provided by a PiPo host usally simply returns 0.

Returns
0 for ok or a negative error code (to be specified), -1 for an unspecified error

Reimplemented in PiPoGraph, PiPoFiniteDif, PiPoParallel, PiPoBiquad, PiPoOnseg, PiPoSequence, PiPoMedian, PiPoMvavrg, PiPoGate, PiPoSlice, PiPoDelta, PiPoPeaks, PiPoChop, PiPoBayesFilter, and PiPoConst.

◆ segment()

virtual int PiPo::segment ( double  time,
bool  start 
)
inlinevirtual

Signals segment start or end.

PiPo module: An implementation of this method calls propagateFrames() at the end of the segment.

In the case of two sucessive calls to segment(), the second call implitly ends the last segment.

If the module did not receive any frames - at all or since the last segment end -, the method should return 0 to the call segment(0.0, end) without calling propagateFrames(). This permits the host to check whether a module implements the segment method or not.

if(this->started)
{
// do what is to be done to finalize the segment description
this->propagateFrames(time, weight, values, size, num);
this->started = false;
}
if(start)
{
// do what is to be done to initialize the segment description
}
return 0;
Parameters
timetime of segment start of end
startflag, true for segment start, false for segment end
Returns
0 for ok or a negative error code (to be specified), -1 for an unspecified error

Reimplemented in PiPoGraph.

◆ setParent()

virtual void PiPo::setParent ( Parent parent)
inlinevirtual

Sets PiPo parent.

Parameters
parentPiPo parent

Reimplemented in PiPoGraph, PiPoParallel, and PiPoSequence.

◆ setReceiver()

virtual void PiPo::setReceiver ( PiPo receiver,
bool  add = false 
)
inlinevirtual

Sets a PiPo modules receiver (call only by the PiPo host)

Parameters
receiverPiPo module receiving this module's output stream
addreceiver (versus clear and set first)

Reimplemented in PiPoGraph, PiPoParallel, PiPoSequence, PiPoMfcc, and PiPoMel.

◆ signalError()

void PiPo::signalError ( std::string  errorMsg)
inline

signal error message to be output by the host

◆ signalWarning()

void PiPo::signalWarning ( std::string  errorMsg)
inline

signal warning message to be output by the host

◆ streamAttributes()

virtual int PiPo::streamAttributes ( bool  hasTimeTags,
double  rate,
double  offset,
unsigned int  width,
unsigned int  height,
const char **  labels,
bool  hasVarSize,
double  domain,
unsigned int  maxFrames 
)
pure virtual

Configures a PiPo module according to the input stream attributes and propagate output stream attributes.

PiPo module: Any implementation of this method requires a propagateStreamAttributes() method call and returns its return value, typically like this:

return this->propagateStreamAttributes(hasTimeTags, rate, offset, width, height, labels, hasVarSize, domain, maxFrames);

PiPo host: A terminating receiver module provided by a PiPo host handles the final output stream attributes and usally returns 0.

Parameters
hasTimeTagsa boolean representing whether the elements of the stream are time-tagged
ratethe frame rate (highest average rate for time-tagged streams, sample rate for audio input)
offsetthe lag of the output stream relative to the input
widththe frame width (number of channels for audio or data matrix columns)
heightthe frame height (or number of matrix rows, always 1 for audio)
labelsoptional labels for the frames' channels or columns (can be NULL)
hasVarSizea boolean representing whether the frames have a variable height (respecting the given frame height as maximum)
domainextent of a frame in the given domain (e.g. duration or frequency range)
maxFramesmaximum number of frames in a block exchanged between two modules (window size for audio)
Returns
0 for ok or a negative error code (to be specified), -1 for an unspecified error

Implemented in PiPoGraph, PiPoParallel, PiPoSequence, PiPoLpcFormants, PiPoBiquad, PiPoFft, PiPoScale, PiPoMedian, PiPoMvavrg, PiPoBands, PiPoOnseg, PiPoPeaks, PiPoOut, PiPoGate, PiPoFiniteDif, PiPoSlice, PiPoChop, PiPoSelect, PiPoBayesFilter, PiPoLpc, PiPoMoments, PiPoDct, PiPoDelta, PiPoSum, PiPoConst, and PiPoIdentity.

Member Data Documentation

◆ attrs

std::vector<Attr *> PiPo::attrs
protected

list of attributes

◆ receivers

std::vector<PiPo *> PiPo::receivers
protected

list of receivers