Classes (extension) | Modality | OSC

# OSCMon : Object
Extension

A Monitor for OSC traffic
Source: OSCMon.sc
See also: Modality, MKtl, OSCFunc, OSCdef

## Description

OSCMon monitors captures incoming OSC messages, keeping recent ones around for analyis and display. It can show the message sizes, relative arrival times for multiple sources.o = OSCMon.new; // make one o.enable; // turn it on o.show; // show them on gui, no po o.watchStatus = true; s.boot; o.trace; // post messages // show status messages from server too o.watchStatus = false; o.list.size; o.anaDict.nicknames.as(Event); o.addresses; ( n = NetAddr.localAddr; Tdef(\test, { loop { (exprand(0.03, 0.3) * 3).wait; n.sendMsg([\test, \yo, \mama].choose, *{ 10.rand }.dup(rrand(3, 10))); }; }); Tdef(\test).play; ) o.anaDict[\nicknames]; o.anaDict[\messagesByAddr]; o.anaDict[\msgNamesByAddr]; o.timeWindow = 25; o.trace(false); // no posting o.postInfo; // and post current state o.disable; o.enable; o.anaDict[\nicknames]; o.anaDict[\messagesByAddr]; o.anaDict[\msgNamesByAddr]; o.addNickname(\manta, NetAddr("127.0.0.1", 8000)); o.anaDict[\messagesByAddr][\homeclient]; // make a local net address to send/receive messages to monitor; ( n = NetAddr.localAddr; Tdef(\test, { loop { (exprand(0.03, 0.3) * 3).wait; n.sendMsg([\test, \yo, \mama].choose, *{ 10.rand }.dup(rrand(3, 10))); }; }); Tdef(\test).play; ) // addresses and msgNames are kept o.addresses; o.msgNames; o.list.keep(10).postln; // TBD: statistics on who sent how much // which messages are most frequent // add nicknames for known addresses // post all messages by source // post all messages by name and/or source o.free;

## Class Methods

### OSCMon.colors

some colors to use in the visualisation

### OSCMon.new(bufsize: 100, timeWindow: 60, action)

make a new OSCMon

#### Arguments:

bufsize | with a buffersize of how many messages to keep,
timeWindow | a length of time within which to keep messages
action | and an action to do when a new message comes in

### Inherited class methods

## Instance Methods

### .bufsize

### .bufsize = value

the maximum number of messages to store

### .timeWindow

### .timeWindow = value

the maximum time window in which to store messages

### .listenFunc

internal: the function with which OSCMon listen to osc traffic.

### .list

the list of recorded message entries

### .addresses

the addresses from which messages have been sent

### .msgNames

the msgNames monitored

### .anaDict

a dict containing various analyses of the osc data

### .postInfo

post info on current recorded messages

### .enable

### .disable

enable and disable listening

### .enabled

get flag whether oscmon is listening

### .verbose

### .verbose = value

get or set flag whether to post info on incoming traffic

### .trace(flag: true)

set verbose flag, default flag is true

### .watchStatus

### .watchStatus = value

get and set flag whether to record server status messages

### .action

### .action = value

a custom action to perform on all incoming messages

### .addNickname(name, addr)

#### Arguments:

name |
addr | add a nickname for an incoming address

### .removeNickname(name)

#### Arguments:

name | remove a nickname

### .free

free the resources of this oscmon

### .refreshAddrsAndNames

refresh analysis of present addresses and names

### .addAddr(addr)

### .removeAddr(addr)

#### Arguments:

addr | add/remove an address to/from addrNames

### .addMsgName(name)

### .removeMsgName(name)

add or remove a messageName from msgNames

### .postMessagesFrom(index)

post all messages from address at index

### .show(name, bounds)

make a named display window for the oscmon

### .w

### .u

its display window and userview

### .refresh

refresh display

### .clearMsgNames

### .clearAddrs

clear msgNames or addresses

### .trackMsgs

### .trackMsgs = value

### .trackAddrs

### .trackAddrs = value

get and set flags whether to track msgNames and addresses

### Inherited instance methods

helpfile source: /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/Modality-toolkit/Modality/HelpSource/Classes/OSCMon.schelp
link::Classes/OSCMon::