# XJADEO - Open Sound Control Interface

## Open Sound Control Interface

An alternative to the remote-control described in the section «Remote Control Interface» is to use Open-sound-control. The drawback with OSC however is that there is no feedback. It is a one-way method of communication. Furthermore OSC usually has more latency compared to POSIX real-time messages, although it is quite possible to play a video sending 'seek' commands. On the upside OSC offers a control interface that works via Network. It is easy to use and ubiquitous. There is support to transmit OSC messages for nearly every programming language and even some hardware controllers - be it arduino, iPhone or mixing-desks.

To enable xjadeo's OSC interface it needs to be started with the `-O `port`` option where `port` is the UDP port number xjadeo listens on for messages. e.g.

    xjadeo -O 7890

A simple example to control xjadeo using `oscsend` from liblo-tools looks like this:

    oscsend localhost 7890 /jadeo/load s '/tmp/test.avi'
    oscsend localhost 7890 /jadeo/quit

## OSC commands

Address Pattern | Type Tags | Description - notes in brackes are corresponding remote-ctl commands or commandline-options
--- | --- | ---
`/jadeo/quit` | `` | Terminate xjadeo.
`/jadeo/load` | `s` | Load a video file, replacing any previous one (load `filename`)
`/jadeo/seek` | `i` | Seek to given frame-number (seek ) - xjadeo needs to be disconnected from a sync-source
`/jadeo/cmd` | `s` | Call a remote control command
`/jadeo/fps` | `f` | Set the screen update frequency (-f, set fps)
`/jadeo/offset` | `i` | Set time-offset as frame-number (-o, set offset)
`/jadeo/offset` | `s` | Set time-offset as timecode (-o, set offset)
`/jadeo/osd/font` | `s` | Specify a TrueType Font file to be used for rendering On-Screen-Display text (osd font)
`/jadeo/osd/timecode` | `i` | If set to 1: render timecode on screen; set to 0 to disable (-i, osd smpte)
`/jadeo/osd/framenumber` | `i` | If set to 1: render frame-number on screen, set to 0 to disable (-i, osd frame)
`/jadeo/osd/box` | `i` | If set to 1: draw a black backround around OSD elements, set to 0 to disable (osd box, osd nobox)

Table 1. OSC Commands

Address Pattern | Type Tags | Description - notes in brackes are corresponding remote-ctl commands or commandline-options
--- | --- | ---
`/jadeo/jack/connect` | `` | Connect to JACK and sync to JACK-transport (jack connect)
`/jadeo/jack/disconnect` | `` | Stop synchronization with JACK-transport (jack disconnect)
The following commands are only available if MIDI is supported.
`/jadeo/midi/connect` | `s` | Get sync from MTC (MIDI Time Code). The parameter specifies the midi-port to connect to. (-m, -d, midi connect)
`/jadeo/midi/disconnect` | `` | Close the MIDI device (midi disconnect)
The following commands are only available if LTC is supported.
`/jadeo/ltc/connect` | `` | Synchronize to LTC from jack-audio port (ltc connect)
`/jadeo/ltc/disconnect` | `` | Close LTC/JACK client (ltc disconnect)

Table 2. OSC Commands to configure synchronization

Address Pattern | Type Tags | Description - notes in brackes are corresponding remote-ctl commands or commandline-options
--- | --- | ---
The following command is only available if "panorama mode" is enabled.
`/jadeo/art/pan` | `i` | Set the x-offset to the value given in pixels. 0 ≤ val ≤ movie-width
The following commands are only available if "timescale mode" is enabled.
`/jadeo/art/timescale` | `f` | Set time-multiplier; default value: 1.0
`/jadeo/art/timescale` | `fi` | Set both time-multiplier and offset. default: 1.0, 0
`/jadeo/art/loop` | `i` | Enable wrap-around/loop video. If set to 1, multiples of the movie-length are added/subtracted if the current time-stamp is outside the file duration.
`/jadeo/art/reverse` | `` | Trigger reverse. This action multiplies the current time-scale with -1.0 and sets a time-offset so that the currently displayed frame is retained.

Table 3. non-standard OSC Commands