PiPo
Plug In Plug Out / Plugin Interface for Processing Objects
PiPoGraph Class Reference
Inheritance diagram for PiPoGraph:
PiPo

Public Member Functions

 PiPoGraph (PiPo::Parent *parent, PiPoModuleFactory *moduleFactory=NULL)
 
void clear ()
 
bool create (std::string graphStr)
 
PiPogetPiPo ()
 
void setParent (PiPo::Parent *parent) override
 Sets PiPo parent. More...
 
PiPogetReceiver (unsigned int index=0) override
 Gets a PiPo modules receiver (call only by the PiPo host) More...
 
void setReceiver (PiPo *receiver, bool add=false) override
 Sets a PiPo modules receiver (call only by the PiPo host) More...
 
int reset () override
 Resets processing (optional) More...
 
int segment (double time, bool start) override
 Signals segment start or end. More...
 
int finalize (double inputEnd) override
 Finalizes processing (optinal) More...
 
int streamAttributes (bool hasTimeTags, double rate, double offset, unsigned int width, unsigned int height, const char **labels, bool hasVarSize, double domain, unsigned int maxFrames) override
 Configures a PiPo module according to the input stream attributes and propagate output stream attributes. More...
 
int frames (double time, double weight, PiPoValue *values, unsigned int size, unsigned int num) override
 Processes a single frame or a block of frames. More...
 
- Public Member Functions inherited from PiPo
 PiPo (Parent *parent, PiPo *receiver=NULL)
 
 PiPo (const PiPo &other)
 
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...
 
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...
 

Additional Inherited Members

- Public Types inherited from PiPo
enum  Type {
  Undefined, Bool, Enum, Int,
  Float, Double, String
}
 
enum  Enumerate
 
- Static Public Member Functions inherited from PiPo
static float getVersion ()
 
- Protected Attributes inherited from PiPo
Parentparent
 
std::vector< PiPo * > receivers
 
std::vector< Attr * > attrs
 

Member Function Documentation

◆ finalize()

int PiPoGraph::finalize ( double  inputEnd)
inlineoverridevirtual

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 from PiPo.

◆ frames()

int PiPoGraph::frames ( double  time,
double  weight,
PiPoValue *  values,
unsigned int  size,
unsigned int  num 
)
inlineoverridevirtual

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

Implements PiPo.

◆ getReceiver()

PiPo* PiPoGraph::getReceiver ( unsigned int  index = 0)
inlineoverridevirtual

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

Returns
receiver PiPo module receiving this module's output stream

Reimplemented from PiPo.

◆ reset()

int PiPoGraph::reset ( void  )
inlineoverridevirtual

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 from PiPo.

◆ segment()

int PiPoGraph::segment ( double  time,
bool  start 
)
inlineoverridevirtual

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 from PiPo.

◆ setParent()

void PiPoGraph::setParent ( PiPo::Parent parent)
inlineoverridevirtual

Sets PiPo parent.

Parameters
parentPiPo parent

Reimplemented from PiPo.

◆ setReceiver()

void PiPoGraph::setReceiver ( PiPo receiver,
bool  add = false 
)
inlineoverridevirtual

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 from PiPo.

◆ streamAttributes()

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

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

Implements PiPo.