Tycho Target

TychoTarget Palette

Contents

The CGC TychoTarget is an experimental target that provides a way to create CGC control panels that use the functionality in Tycho. A universe that uses TychoTarget must provide a script that creates the control panel that the user sees. Currently, all the TychoTarget demos implement real-time audio processing demos, and will only work on Sun work-stations.

For information about the Sun Audio system, see the Sun Audio page.

TychoTarget setup

To use the TychoTarget, you will need to run cd $PTOLEMY/tycho; make tclexts. TychoTarget uses $PTOLEMY/tycho/obj.$PTARCH/tcl.mk and java.mk.

Using TychoTarget

To use TychoTarget, simply select TychoTarget from the Targets menu in your VEM window. By default, TychoTarget is set to compile the generated file, start a separate Tycho process, and load the generated system into Tycho. The generated file can also be compiled and loaded into a running Tycho "by hand" -- see below.

The key setting in the TychoTarget parameters window is the name of the TychoTarget script file -- this is a Tcl file that is sourced by the generated file after it has been loaded into Tycho, and is where the control panel that the user sees is created. The scripts for the TychoTarget demos are located in $TYCHO/typt/demo. By convention, the name of the script file is the name of the Ptolemy universe with suffix .tcl. For each script file, there is also an HTML help file with suffix .html.

Each star in your universe that can be controlled by TychoTarget in real-time must have a unique identifier. Currently, this is in the Edit Parameters window of the star as the starName state.

Output file format

TychoTarget generates a C file in a format that can be loaded into Tycho as a Tcl package. The Tcl package format is the standard one (see the book Tcl and the Tk Toolkit by John K. Ousterhout for details). Apart from the Tcl package interface, the generated file differs from that produced by the TclTkTarget in the following ways:

The Tcl package format consists of two functions: an initialization function called universe-name_Init(), which adds a new Tcl command ::tycho::universe-name to Tycho, and a Tcl interface function called (surprisingly enough..) tclinterface(). This function is included directly from the file $PTOLEMY/tycho/src/tycgc/tclif.c.

The Tcl command ::tycho::universe-name is used by the Tycho scheduler class to execute the universe. Its first argument controls what happens in the (generated) package:

What TychoTarget does

By default, running a TychoTarget universe will:

Running "by hand"

Starting a new Tycho propcess every time you run the universe is a little tedious. To compile a Tycho-Target generated file from within a running Tycho, simply open the file, and then select "Compile" from the File menu. To run a generated application from within a running Tycho, simply "open" the shared library: Tycho will load the package and source the user interface script.

Modifying stars for use with TychoTarget

Each star that has a state that can be controlled in real-time by Tycho needs a unique, user-settable identifier. Currently, those stars that support TychoTarget have a state called starName that the user can set from the Edit parameters window.

Each star that has a state that can be controlled in real-time must add code to the tychoSetup code-block. This code-block serves the same purpose as the tkSetup code-block used with the TclTkTarget -- we introduced a new codeblock because the interface functions to TychoTarget are different. Here is a sample code-block (from $PTOLEMY/src/domains/cgc/tcltk/stars/CGCTkStereoIn.pl:

codeblock (tychoSetup) {
    /* Call tycho to connect a control to the volume parameter */
    connectControl(
	moduleName,
	"$val(starName)",
	"volume",
        $starSymbol(setVolume));
}
The arguments are:
  1. The name of the universe. Tycho needs this to know which control panel will be controlling this parameter.
  2. The unique name of this star within this universe. Together with the next argument, this is used by Tycho to "connect" a user-interface control widget to the callback that modifies a state in real-time.
  3. The name of the star parameter being controlled. This does not have to be the same as the state that actually gets altered at run-time.
  4. The call-back that Tycho will call to change the parameter. This is in the standard Tcl call-back format, as for TclTkTarget. TychoTarget will usually use the same call-backs already provided by a star for TclTkTarget.

Currently, connectControl is the only interface function provided. It is intended for controls that provide input over a range, such as 0 to 100. It is implemented in the TyCGC support package. In future, other interface functions will be added for one-of-many selection, so that buttons can be added to custom interfaces.

Writing TychoTarget user interface scripts

Tycho contains support to make it easy to create custom user interfaces for TychoTarget universes. One good source of information, of course, is the existing demonstration files, in $TYCHO/typt/demo.

The documentation on the operation of the Tycho portion of TychoTarget is in the Tycho documentatation tree:

Bugs and caveats


Copyright © 1997, The Regents of the University of California. All rights reserved.
Last updated 04/25/97, comments to ptolemy@ptolemy.eecs.berkeley.edu.