BasicMIDISocket:
Filter:
Classes (extension) | External Control > MIDI

BasicMIDISocket
ExtensionExtension

Generic note-on/off responder
Location: NOT INSTALLED!

Description

BasicMIDISocket installs a pair of functions to respond to note-on and -off messages. The functions receive the note number and velocity as arguments.

Channel information is not passed in, on the assumption that you're filtering the messages by device and channel according to the specification given in ddwMIDI Guide: Identifying MIDI channels. If you need a function to respond to incoming note messages from multiple devices or channels, and the function needs to be aware of the message's source, use MIDIFunc or MIDIdef instead.

Class Methods

.new

Create a new instance. Arguments are:

chan
The messages' source. See ddwMIDI Guide: Identifying MIDI channels.
onfunc
The function to handle note-on messages. The function's arguments should be |note_num, velocity|.
offfunc
The function to handle note-off messages. Same arguments as onfunc.

Note that the argument names shown by SCIde's method completion pop-up are different. This is because *new is inherited from AbstractMIDISocket, which provides a generic argument template.

Returns:

A BasicMIDISocket instance.

Inherited class methods

Instance Methods

.onPlayer

Returns:

The note-on function.

.offPlayer

Returns:

The note-off function.

.noteOn

This method is called in response to note-on messages. In normal use, you do not need to call this method. You may call it directly for testing or debugging.

Arguments:

note

The MIDI note number (0-127).

vel

Velocity (0-127).

.noteOff

This method is called in response to note-off messages. In normal use, you do not need to call this method. You may call it directly for testing or debugging.

Arguments:

note

The MIDI note number (0-127).

vel

Velocity (0-127).

.free

Remove the socket completely from the ddwMIDI hierarchy.

.parent

Returns:

The socket's parent MIDIChannel object. From this, you can get information about the device and channel from which the socket is receiving messages.

.enable

Move the socket to the parent MIDIChannel's list of enabled sockets. The socket will then respond to incoming messages.

.disable

Move the socket to the parent MIDIChannel's list of disabled sockets. The socket will not respond to incoming messages, but it remains intact so that you can reenable it at any time.

.clear

Subclasses may implement clear to keep the socket registered in the hierarchy, but become inactive.

.active

Returns:

Boolean: true if the socket's destination exists and is active; false otherwise.

Inherited instance methods

Examples