[pdp stuff tom**20030428141041] { hunk ./TODO 4 -* running out of memory will likely crash pd. short story: don't, use pdp_control's memlimit if you need protection. +* running out of memory (using delay lines or loops) will likely crash pd. +short story: don't, use pdp_control's memlimit for limiting pdp's memory usage. adddir ./doc adddir ./doc/pdp.old addfile ./doc/pdp.old/devdoc.html hunk ./doc/pdp.old/devdoc.html 1 + + +
+There is not yet much developer information, partly because pdp is not that big. I believe it is + not too hard to figure out how it works, once you get started somewhere. This document is a minimalistic + attempt to provide that starting point. For full prototypes see the header files. I've factored most + of the code into separate modules, but the borders are fluid, and will probably be subject + to further change in the future. I suggest you have a look at the pdp_base base class, and some simple + modules: pdp_add, pdp_noise and pdp_gain for examples. + +
PDP is written as an extension for PD. One of the goals of pdp is to evolve to a separate library that can + be reused in other software. PD is a temporary host until PDP matures (or dies). Until that happens pdp will + probably stay tied fairly close to pd. Most of the + core functionality can be isolated from any pd bindings. There is one thing, however, that had a stamp on + the design of pdp: the fact that pd only supports unidirectional messaging. This creates the awkward concept + of a "passing packet" to eliminate excessive data copying. + +
In pd, the pdp messaging protocol is implemented as pd messages. The protocol is however 3 phase. + With a read only register phase, a read/write register phase and a process phase. This functionality + is part of the base class. + +
A packet is a class in pdp. The table below lists the supported methods. First argument is a packet id. + +
| pdp_packet_* + | |
|---|---|
| new | construct a raw packet (depreciated) + |
| new_* | construct packet of specific type/subtype/... + |
| mark_unused | release + |
| mark_passing | conditional release (release on first copy ro/rw) + |
| copy_ro | readonly (shared) copy + |
| copy_rw | private copy + |
| clone_rw | private copy (copies only meta data, not the content) + |
| header | get the raw header (t_pdp *) + |
| data | get the raw data (void *) + |
| pass_if_valid | send a packet to pd outlet, if it is valid + |
| replace_if_valid | delete packet and replace with new one, if new is valid + |
| copy_ro_or_drop | copy readonly, or don't copy if dest slot is full + send drop notify + |
| copy_rw_or_drop | same, but private copy + |
| get_description | retrieve type info + |
| convert_ro | same as copy_ro, but with an automatic conversion matching a type template + |
| convert_rw | same as convert_ro, but producing a private copy + |
The pool object methods. All the packets are stored in a central packet pool. + +
| pdp_pool_* + | |
|---|---|
| collect_garbage | manually free all unused resources in packet pool + |
The process queue object methods. PDP supports a separate processing thread. + +
| pdp_queue_* + | |
|---|---|
| add | add a process method + callback + |
| finish | wait until a specific task is done + |
| wait | wait until processing queue is done + |
The control methods. General pdp control messages. + +
| pdp_control_* + | |
|---|---|
| notify_drop | notify that a packet has been dropped + |
The type mediator methods. +
| pdp_type_* + | |
|---|---|
| description_match | check if two type templates match + |
| register_conversion | register a type conversion program + + + |
NOTE: it is advised to derive your module from the pdp base class defined in pdp_base.h + instead of communicating directly with the pdp core + + + +