SuperCollider CLASSES

HIDElementProto

Prototype HID element to match with HIDFunc
Inherits from: Object

Description

Human input devices can be used as controllers for making music. This class can be used in conjunction with HIDFunc or HIDdef to match incoming messages with a particular HID device.

HIDElementProto has all the variables that specify an HID element. The more of these variables you specify, the more need to be matched when filtering the incoming HID data.

Class Methods

*new

Create a new instance of HIDElementProto.

*newType (uName, pName)

Create a new instance of HIDElementProto based on usage id and usage page id of the element.

Arguments:

uName

Name of the usage ID to match

pName

Name of the usage page to match

Returns:

an HIDElementProto

*newTypeID (uID, pID)

Create a new instance of HIDElementProto based on usage id and usage page id of the element.

Arguments:

uID

Usage ID to match

pID

Usage page ID to match

Returns:

an HIDElementProto

*newFromDict (dict)

Create a new instance of HIDElementProto based on an IdentityDictionary with a set of parameters to match.

Arguments:

dict

An IdentityDictionary with a set of parameters to match. The keys in the dictionary should be one of the instance variables of HIDElementProto.

Returns:

an HIDElementProto

Inherited class methods

Instance Methods

Instance variables that can be used to match a device

-id

-id = argid

The element index that should be matched. This index may vary between operating systems (see also HIDElement).

-usageName

-usageName = argup

The usage name of the element to match (see also HIDElement).

-pageName

-pageName = argup

The usage page name of the element to match (see also HIDElement).

-usage

-usage = argu

The usage index of the element to match (see also HIDElement).

-usagePage

-usagePage = argup

The usage page index of the element to match (see also HIDElement).

-usageMin

-usageMin = argup

The minimum usage index of the element to match (see also HIDElement).

-usageMax

-usageMax = argup

The maximum usage index of the element to match (see also HIDElement).

-type

-type = argio

The type of the element to match (see also HIDElement).

-typeSpec

-typeSpec = argup

The typeSpec of the element to match (see also HIDElement).

-ioType

-ioType = argio

The IO type of the element to match - input (1), output (2) or feature (3) (see also HIDElement).

-iotypeName

-iotypeName = argup

The IO type of the element to match - \input, \output or \feature (see also HIDElement).

Methods to match

-matches (ele)

Match the argument with the template.

Arguments:

ele

An instance of HIDElement

Returns:

a Boolean indicating whether the incoming HID matches the template

-shouldMatch

The variables that should be matched when filtering

Returns:

a Set with variable names.

Methods to add matching parameters

-addTypeMatch (uName, pName)

Add a match for usage name and usage page name of the element.

Arguments:

uName

The usage name to match

pName

The page name to match

-addTypeIDMatch (uID, pID)

Add a match for usage id and usage page id of the element.

Arguments:

uID

The usage id to match

pID

The usage page id to match

-addDictionaryMatch (dict)

Add an IdentityDictionary with a set of parameters to match. The keys in the dictionary should be one of the instance variables of HIDElementProto.

Arguments:

dict

An IdentityDictionary with a set of parameters to match.

Inherited instance methods

Examples

// create an prototype element with usageName \X
c = HIDElementProto.new.usageName_( \X );
a = HIDFunc.proto( { |...args| args.postln; }, c );
a.free;