Home Reference Source Test
import Message from 'osc-js/src/message.js'
public class | source

Message

An OSC message consists of an OSC Address Pattern followed by an OSC Type Tag String followed by zero or more OSC Arguments

Test:

Constructor Summary

Public Constructor
public

constructor(args: array | string, args: ...*)

Create a Message instance

Member Summary

Public Members
public
public

args: array

public
Private Members
private

Method Summary

Public Methods
public

add(item: *)

Add an OSC Atomic Data Type to the list of elements

public

Interpret the Message as packed binary data

public

unpack(dataView: DataView, initialOffset: number): number

Unpack binary data to read a Message

Public Constructors

public constructor(args: array | string, args: ...*) source

Create a Message instance

Params:

NameTypeAttributeDescription
args array | string

Address

args ...*

OSC Atomic Data Types

Example:

const message = new Message(['test', 'path'], 50, 100.52, 'test')
const message = new Message('/test/path', 51.2)

Public Members

public address: string source

public args: array source

public types: string source

Private Members

private offset: number source

Public Methods

public add(item: *) source

Add an OSC Atomic Data Type to the list of elements

Params:

NameTypeAttributeDescription
item *

Test:

public pack(): Uint8Array source

Interpret the Message as packed binary data

Return:

Uint8Array

Packed binary data

Test:

public unpack(dataView: DataView, initialOffset: number): number source

Unpack binary data to read a Message

Params:

NameTypeAttributeDescription
dataView DataView

The DataView holding the binary representation of a Message

initialOffset number
  • optional
  • default: 0

Offset of DataView before unpacking

Return:

number

Offset after unpacking

Test: