Class: Envelope

Envelope()

new Envelope()

The Envelope class makes a rectangular space in which instances of the EnvelopeNode can be created, edited, and deleted.

Methods

draw(newX)

Draws the instance of the Envelope class. This includes the outer rectangle, the lines between each envelope node, and the nodes themselves.

Parameters:
Name Type Description
newX Number

An altered value of the envelope's x-location (useful if the screen has been resized I think).

load(str)

Load an envelope from an input string specifying the type of musical dimension.

Parameters:
Name Type Description
str string

The string specifying the type of musical dimension.

onclick(str, _grid, _sonic)

onclick method for Envelope class

Parameters:
Name Type Description
str string

The type of node to be created

_grid object

The grid object

_sonic object

The sonic object

push_sorted(time, value)

Push a time/value pair onto this envelope's data, maintaining sorted order.

Parameters:
Name Type Description
time number

The time of the pair to add.

value number

The value of the pair to add.

toggle_active()

Toggle the active status of this envelope.

touch_check(touchType, str, _grid, _sonic)

Touch check method for Envelope class

Parameters:
Name Type Description
touchType string

touch type ('touchStarted', 'touchMoved', 'touchEnded')

str string

string parameter

_grid Object

grid object

_sonic Object

sonic object

Envelope(_sketch, _name, _yVal, _active, _x, _y, _width, _height, _nodeDiameter)

new Envelope(_sketch, _name, _yVal, _active, _x, _y, _width, _height, _nodeDiameter)

Constructor for making a new instance of the Envelope class.

Parameters:
Name Type Description
_sketch Object

The p5 sketch in which one or more instances of the Envelope class will exist.

_name String

Unused at present, but a potentially useful label for distinguishing between multiple envelopes.

_yVal Number

In [0, 1], giving the initial/default value of nodes inside the envelope.

_active Boolean

Unused at present, but potentially useful for switching between envelopes that are applied to different channels or staff numbers.

_x Number

x-location of top-left corner of the envelope in pixels.

_y Number

y-location of top-left corner of the envelope in pixels.

_width Number

Width of the envelope in pixels.

_height Number

Height of the envelope in pixels.

_nodeDiameter Number

Diameter of the nodes appearing inside the envelope.

Methods

draw(newX)

Draws the instance of the Envelope class. This includes the outer rectangle, the lines between each envelope node, and the nodes themselves.

Parameters:
Name Type Description
newX Number

An altered value of the envelope's x-location (useful if the screen has been resized I think).

load(str)

Load an envelope from an input string specifying the type of musical dimension.

Parameters:
Name Type Description
str string

The string specifying the type of musical dimension.

onclick(str, _grid, _sonic)

onclick method for Envelope class

Parameters:
Name Type Description
str string

The type of node to be created

_grid object

The grid object

_sonic object

The sonic object

push_sorted(time, value)

Push a time/value pair onto this envelope's data, maintaining sorted order.

Parameters:
Name Type Description
time number

The time of the pair to add.

value number

The value of the pair to add.

toggle_active()

Toggle the active status of this envelope.

touch_check(touchType, str, _grid, _sonic)

Touch check method for Envelope class

Parameters:
Name Type Description
touchType string

touch type ('touchStarted', 'touchMoved', 'touchEnded')

str string

string parameter

_grid Object

grid object

_sonic Object

sonic object