Hallo, derek holzer hat gesagt: // derek holzer wrote:
I still can't understand how to create abstractions for nqpoly and get it to call them, but at least your version looks a bit cleaner ;-)
Can you explain in simple steps how to use this patch?
Did you check out the old documentation from the CVS in abstractions/nqpoly/nqpoly4 ? There are some simple examples. Basically using nqpoly4 is easy: Only two arguments are required: The number of instances to create of an abstraction and the name of that abstraction. Additonally four more arguments may be passed, which will be creation arguments of your abstraction.
The abstraction you use must have two inlets and one outlet. The right inlet is used as a [loadbang] replacement: It will receive a bang after creation of the instance. You can ignore it if you want.
You can ignore the left inlet as well: It will receive messages you send to the first inlet of nqpoly4, but it is "voice managed". That is an incoming message will only be used by one instance, which will then eat this message and not send it along to other instances. Receiving anyhting in inlet0 will also close that instance's inlet, so no further messages are accepted until you send a bang through the outlet, which will open the inlet again.
So assuming we have an abstraction delay1000.pd:
[inlet] [inlet]
|
[del 1000]
|
| [print $0-BANG]
|
[outlet]
Then you create [nqpoly4 10 del1000]. This will create 10 instances of [delay1000]. If you send a bang into this [nqpoly4 10 del1000], you will get one message printed like: "1002-BANG: bang". If you sent another one earlier than one second you will get a different message, e.g.: "1003-BANG: bang", because the 1002-instance still is closed and another instance will respond.
As the delay will send a bang to the outlet after 1 second, all instances will open itself at some point. Then you will get e.g. the first "1002-BANG: bang" again.
The abstractions also will be called with arguments: First arg is the instance index number, second is the total number of instances (10 in the example) and then come the additional up to four arguments, that were passed to nqpoly4. (Additional args are useful for audio objects: just pass $0 as first arg, then put a [throw~ $3-dsp] into your abstraction and use a [catch~ $0-dsp] in the parent.)
See attached example for arguments in use.
So using [print $1-BANG] instead of [print $0-BANG] will make delay1000 print:
0-BANG: bang 1-BANG: bang 2-BANG: bang ...
Also, if I wanted dynamic voice handling (i.e. voices shut off when not in use to save CPU), does nqpoly handle this by itself or would I need to build a [switch~] into the abstraction?
nqpoly4 doesn't do anything specific to audio, so you would need to put a switch into your abstraction yourself. But you could use the voice allocation algorithm implemented to switch the switch.
Frank Barknecht _ ______footils.org_ __goto10.org__