Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Pike Module Reference:

module version 1, prepared 2012-02-04

  MODULE Public
Modules
Sound

  MODULE Public.Sound
Modules
Midi

  MODULE Public.Sound.Midi
Classes
Control
Device

  CLASS Public.Sound.Midi.Device
Methods
close()
close()
create()
create()
get_ID()
get_ID()
get_interface()
get_interface()
get_name()
get_name()
get_status()
get_status()
get_version()
get_version()
is_data1()
is_data1()
is_data1()
is_data1()
is_data2()
is_data2()
is_input()
is_input()
is_open()
is_open()
is_output()
is_output()
message()
message()
open()
open()
read()
read()
set_ID()
set_ID()

Method create

void Public.Sound.Midi.Device()->create(int ID)

Description

Create a MIDI object for communication. You have to provide a device ID. ID numbers start from zero and go up until the maximum available. (Which can be checked with a control object, using the count_devices() function.)

Note

Each port is another device!


Method set_ID

void Public.Sound.Midi.Device()->set_ID(int ID)

Description

Access another device with this object.


Method get_ID

int Public.Sound.Midi.Device()->get_ID()

Description

Retrieve the ID of the MIDI device this object addresses.


Method get_version

int Public.Sound.Midi.Device()->get_version()

Description

Not really needed in most circumstanses. It gives you the version number of the PortMidi library.


Method get_interface

string Public.Sound.Midi.Device()->get_interface()

Description

This gives you the type of interface that goes with the device, like ALSA or Jack.


Method get_name

string Public.Sound.Midi.Device()->get_name()

Description

This gives you the descriptive name of this interface.


Method is_input

int Public.Sound.Midi.Device()->is_input()

Description

See if this device is an input or output.


Method is_output

int Public.Sound.Midi.Device()->is_output()

Description

See if this device is an input or output.


Method is_open

int Public.Sound.Midi.Device()->is_open()

Description

See if this device is opened, which is needed before you can use it.


Method open

int Public.Sound.Midi.Device()->open()

Description

Open the device. The return value will be null or an error id.


Method message

int Public.Sound.Midi.Device()->message(int status, int data1, int data2)

Description

Directly output a MIDI message.

Parameter status

The status byte, like 0x90 for a note-on event. Consult a MIDI manual for more information.

Parameter data1
Parameter data2

The two parts of the midi message


Method read

int Public.Sound.Midi.Device()->read()

Description

Call this function to see if there is MIDI input waiting to be parsed. Returns 1 if a new message is waiting or 0 zero when the MIDI buffer was empty. A negative number signals an error.

Note

Use the functions get_status(), get_data1() and get_data2() to get the actual information contained in the message.


Method get_status

int Public.Sound.Midi.Device()->get_status()

Description

Retreive the status byte from the last read message.


Method is_data1

int Public.Sound.Midi.Device()->is_data1()

Description

Retreive the first data byte from the last read message.


Method is_data2

int Public.Sound.Midi.Device()->is_data2()

Description

Retreive the second data byte from the last read message.


Method is_data1

int Public.Sound.Midi.Device()->is_data1()

Description

Retreive the first data byte from the last read message.


Method close

int Public.Sound.Midi.Device()->close()

Description

Close this device. Returns zero or an error code.


Method create

void Public.Sound.Midi.Device()->create(int ID)

Description

Create a MIDI object for communication. You have to provide a device ID. ID numbers start from zero and go up until the maximum available. (Which can be checked with a control object, using the count_devices() function.)

Note

Each port is another device!


Method set_ID

void Public.Sound.Midi.Device()->set_ID(int ID)

Description

Access another device with this object.


Method get_ID

int Public.Sound.Midi.Device()->get_ID()

Description

Retrieve the ID of the MIDI device this object addresses.


Method get_version

int Public.Sound.Midi.Device()->get_version()

Description

Not really needed in most circumstanses. It gives you the version number of the PortMidi library.


Method get_interface

string Public.Sound.Midi.Device()->get_interface()

Description

This gives you the type of interface that goes with the device, like ALSA or Jack.


Method get_name

string Public.Sound.Midi.Device()->get_name()

Description

This gives you the descriptive name of this interface.


Method is_input

int Public.Sound.Midi.Device()->is_input()

Description

See if this device is an input or output.


Method is_output

int Public.Sound.Midi.Device()->is_output()

Description

See if this device is an input or output.


Method is_open

int Public.Sound.Midi.Device()->is_open()

Description

See if this device is opened, which is needed before you can use it.


Method open

int Public.Sound.Midi.Device()->open()

Description

Open the device. The return value will be null or an error id.


Method message

int Public.Sound.Midi.Device()->message(int status, int data1, int data2)

Description

Directly output a MIDI message.

Parameter status

The status byte, like 0x90 for a note-on event. Consult a MIDI manual for more information.

Parameter data1
Parameter data2

The two parts of the midi message


Method read

int Public.Sound.Midi.Device()->read()

Description

Call this function to see if there is MIDI input waiting to be parsed. Returns 1 if a new message is waiting or 0 zero when the MIDI buffer was empty. A negative number signals an error.

Note

Use the functions get_status(), get_data1() and get_data2() to get the actual information contained in the message.


Method get_status

int Public.Sound.Midi.Device()->get_status()

Description

Retreive the status byte from the last read message.


Method is_data1

int Public.Sound.Midi.Device()->is_data1()

Description

Retreive the first data byte from the last read message.


Method is_data2

int Public.Sound.Midi.Device()->is_data2()

Description

Retreive the second data byte from the last read message.


Method is_data1

int Public.Sound.Midi.Device()->is_data1()

Description

Retreive the first data byte from the last read message.


Method close

int Public.Sound.Midi.Device()->close()

Description

Close this device. Returns zero or an error code.

  CLASS Public.Sound.Midi.Control
Methods
count_devices()
count_devices()
get_default_input_device_id()
get_default_input_device_id()
get_default_output_device_id()
get_default_output_device_id()
get_error_text()
get_error_text()
terminate()
terminate()

Method count_devices

int Public.Sound.Midi.Control()->count_devices()

Description

Query the number of available devices.


Method get_default_input_device_id

int Public.Sound.Midi.Control()->get_default_input_device_id()

Description

Get the ID of the default input device.


Method get_default_output_device_id

int Public.Sound.Midi.Control()->get_default_output_device_id()

Description

Get the ID of the default output device.


Method get_error_text

string Public.Sound.Midi.Control()->get_error_text(int error)

Description

Convert an errorcode to a textual explanation.


Method terminate

void Public.Sound.Midi.Control()->terminate()

Description

Close all MIDI connections. Call this when your program ends or when you want to initialize all over again.


Method count_devices

int Public.Sound.Midi.Control()->count_devices()

Description

Query the number of available devices.


Method get_default_input_device_id

int Public.Sound.Midi.Control()->get_default_input_device_id()

Description

Get the ID of the default input device.


Method get_default_output_device_id

int Public.Sound.Midi.Control()->get_default_output_device_id()

Description

Get the ID of the default output device.


Method get_error_text

string Public.Sound.Midi.Control()->get_error_text(int error)

Description

Convert an errorcode to a textual explanation.


Method terminate

void Public.Sound.Midi.Control()->terminate()

Description

Close all MIDI connections. Call this when your program ends or when you want to initialize all over again.

gotpike.org | Copyright © 2004 - 2011 | Pike is a trademark of Department of Computer and Information Science, Linköping University