Previous page - Next page

EyeCon and the OSC protocol - Control a Macromedia Director application

Using the OSC-Active-X Control to send data from Eyecon to Macromedia Director (on Windows only)

Recently i wrote an Active-X control which allows you to receive OSC information in different programming environments like for example Macromedia Director. Active-X controls are acting as plugins into Windows, in this case enabling you to receive OSC data. Many programs allow you to access and use Active-X controls, this tutorial is about setting up communication between Eyecon and Director.

How to prepare for the use of the OSC-Active-X control

Download the OSC-ActiveX.zip to your computer and unpack it into a directory of your choice. The actual control is called OSCXControl.ocx You have to register that Control element in windows. That is easily done by double-clicking and executing the REG.BAT file. From now on, the OSC active-x control will be available on your Windows system.

Inserting the OSC-Active-X control in your Director application

On the 'Insert' menu of Macromedia Director you will find the 'Control' sub-menu which contains the selection for Active-X. (Windows only). It opens a dialog window which lists all the installed Active-X controls. You might be surprised, how many there are. You are looking for the 'OSCX Element'. Once you select it, it becomes a member of your control palette and can be put on the timeline as any other control.

Properties, Methods and Events:

An Active-X control is represented by it's properties, methods and events. Properties are settings you can check and change. In the case of the OSC Active-X, the most relevant property is the port number. It has to be the same setting you are using in Eyecon. Eyecon and the OSC Active-X use port 7000 as a default. Methods are function calls made to the control. In our case the most important methods are 'Open' and 'Close', which will start and stop the OSC function. A good place to call OPen and Close are the startmovie and endmovie scripts of your Director program. Have a look at the sample program i provide.

An event is an externally triggered moment, where you want your program to respond to. In case of the OSC control it would be the moment a message is received. You have to define an event handler in your program, which defines, how the message is treated. The name of the receiver event is OnOSCInput

Receiving a message

Once your OSCInput event is triggered, the OSC message is stored in an internal buffer until you release it. That allows you to access all the elements of the message as long as you want. Remember, each OSC-message has at least one address field. It might also have one or more numeric or string parameters. They are delivered as 'Variant' data types which gives you flexibility in the interpretation of the data.

In case you only want to transmit the on/off state of a touchline, you probably just use the address field to distinguish the lines and states. Create a touchline, select your Host/Ip settings, enable the OSC transmission and type some identification string in the On and Off fields. In this example the addressfield of the OSC-message would be LineOn when you just hit a touchline, LineOff, once you release the touchline. The 'value' field is left empty, which means, there are no numeric parameters appended. In this example the message is sent to 'localhost', which is the same computer which you are running Eyecon on.

 

 

How does it look in Director

 

 

The OSC control is represented by a little box which is showing the port it's set up for. There is also a little red indicator line. Whenever it is moving, there was a OSC message received. It helps you debug your application. After you tested your application you will probably want to make the OSC control invisible. Just set it's property 'visible' to false.

In the OSC-Director sample which can be downloaded here, there is a bunch of touchlines set up to allow you playing on a virtual piano. Director is used to visualize the keys you have hit, whereas Eyecon plays the sound.