# NPxdef

## a shortcut for a Pdef controlling a node proxy to crossfade

Inherits from:: Object : AbstractFunction : Pattern : PatternProxy : TaskProxy : EventPatternProxy : Pdef

NPxdef creates a shortcut for creating a Pdef that controls a NodeProxy. Instead of sending arguments directly to the server, this uses the 'npxset' event type, which uses the xset method of the NodeProxy.
After you have created an NPxdef, you can also access it by using Pdef and the symbol of the nodeproxy's variable name (at least in proxyspace).
Since the actual lookup is done in the Pdef's dictionary, you can easily interchange NPdef and NPxdef with one another, to change the event type.
See also NPdef which is similar but does not crossfade.

### Creation / Class Methods

*initClass
  This adds the event type 'npxset' to the list of possible events.
*new(proxy,src)
  Create an instance of NPxdef, or access an old one, if one with the same name already exists.
  proxy
    The nodeproxy, which you want to control with this pattern stream.
  src
    The pattern (Pbind or so). This pattern is chained to ( type: 'npxset', id: 'proxy')

### The event type 'npxset'

The event type 'npxset' is used to set arguments of a NodeProxy. The key id should be used to indicate which NodeProxy is going to be controlled. It automatically checks which arguments are relevant to the NodeProxy and only sets these, using the method xset of NodeProxy.

### Example 1

    s.boot;
    p = ProxySpace.push(s);

    ~sine = { |freq=300| SinOsc.ar( freq, 0, 0.3 )};
    ~sine.play;
    ~sine.fadeTime = 3;

    NPxdef( ~sine, Pbind( \freq, Pseq( (3..10)*100, inf), \dur, 5));
    Pdef(\sine).play;
    Pdef(\sine).stop;
    ~sine.stop;
    p.free;

This helpfile was created with the class HelpFile2