JucK Doc

From CSWiki
Revision as of 17:49, 22 May 2006 by Ylee (talk | contribs) (I. Introduction)

Jump to: navigation, search

JucK

I. Introduction

  • JucK is a swing-based GUI creator for ChucK.
  • Currently supported GUI elements:
    • Slider
    • Checkbox
    • Radiobutton
    • Dropdown menu
    • Textfield
    • Two-Dimensional Checkbox
    • Two-Dimensional Grid
  • Planned Features
    • ChucK libraries to parse JucK messages

II. System Requirements

  • ChucK System Requirements
  • Java 1.4 or higher
    • Compilation: javac Juck.java
    • Execution: java Juck <file.jk>

III. Tutorial

Writing a JucK File

  • A .jk file has several required entries. In order:
    • [Name of the GUI to be created]
    • [Target of OSC message] [Port to send OSC messages out of]
    • [Layout]
      • panels: [number of rows] [number of columns]
      • manual: [width] [height]
    • elements (see IV. GUI Elements for specific parameters)


  • Example 1: testpanel.jk
MidiSlider
localhost 6449
panels
1 1
slider Frequency 0 127 0 5 false vertical
    • This is a very simple GUI with only one element, a slider. The overall window is labelled "MidiSlider", as indicated by the first line. It sends OSC messages to localhost through port 6449. The layout is panels, and the next line defines the number of rows and columns to be created (in this case there is only one element, so only one row and one column is necessary). The next line contains the only element of the GUI - a slider with labele "Frequency" that ranges from 0 - 127; initialized to 0, ticks marked every 5 units; does NOT have to snap to ticks (false) ; oriented vertically.


  • Example 2: testmanual.jk
MidiSlider
localhost 6449
manual
400 100
slider Frequency 0 127 0 3 true horizontal 5 5  290 40 
    • Everything here is identical, except for the layout. Because manual layout is specified, the following line does not contain the number of rows and columns; rather, it defines the width and height of the overall window (can be resized). In this case, the line for the slider (and any element) must contain an additional two parameters at the end for JucK to decide where to place the slider in the window. In this case, the parameters (5, 5) dictate that the LEFTmost border of the slider be placed 5 units away from the LEFT border of the overall window, and that the TOPmost border of the slider be placed 5 units away from the TOP border of the overall window. A few other parameters have been changed as well: the ticks are marked every 3 units; the slider DOES have to snap to ticks (true); and the orientation is horizontal. In addition, I have specified a preferred size for the slider (width: 290, height: 40). These two final parameters are optional, and also work in the panels layout.

Writing a ChucK File

  • Code that must appear in a .ck file in order to receive messages from a .jk file (this will become much clearer with an example):
    • create OSC receiver
    • set port for receiver to receive from
    • have the receiver start listening
    • create an address for the receiver; store in a new variable
    • loop: pass time until an event occurs; process the event
  • Example 1: test.ck
OscRecv recv;
6449 => recv.port;
recv.listen();
//“Frequency” is the name of the slider we are listening for; “i”
indicates that we are expecting a //message of type int. Call this event
listener “e1”./
recv.event("Frequency, i") @=> OscEvent e1;

IV. GUI Elements

==