/*	Bars.h	

	Includes for Bars&Pipes Tools

	© 1989 Blue Ribbon Bakery
*/

/*	The Event structure. */

struct Event {
    struct Event *next;			/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    unsigned char status;		/* MIDI status. */
    unsigned char byte1;		/* First byte of data. */
    unsigned char byte2;		/* Second byte of data. */
    long data;				/* Data storage. */
    struct Tool *tool;			/* Tool that processes this next. */
};

/*	Different Event types.  The type field determines what
	Event is mapped onto the Event structure.
*/

#define EVENT_PADEDIT	0x40		/* Not a real time event. */
#define EVENT_PLAYONLY	0x80		/* Discard event when recording. */
#define EVENT_VOICE	1		/* Performance event */
#define EVENT_SYSX	2		/* System exclusive event. */
#define EVENT_LYRIC	3		/* Lyric string. */
#define EVENT_TIMESIG	4		/* Time signature change event. */
#define EVENT_KEY	5		/* Key change event. */
#define EVENT_CHORD	6		/* Chord change event. */
#define EVENT_RHYTHM	7		/* Rhythm template event. */
#define EVENT_DYNAMICS	8		/* Dynamics event. */


/*	MIDI Status types. */

#define MIDI_NOTEOFF	0x80		/* MIDI Note Off Event. */
#define MIDI_NOTEON	0x90		/* MIDI Note On Event. */
#define MIDI_PTOUCH	0xA0		/* MIDI Poly After-Touch Event. */
#define MIDI_CCHANGE	0xB0		/* MIDI Control Change Event. */
#define MIDI_PCHANGE	0xC0		/* MIDI Program Change Event. */
#define MIDI_MTOUCH	0xD0		/* MIDI Mono After-Touch Event. */
#define MIDI_PBEND	0xE0		/* MIDI Pitch Bend Event. */

/*	For making a queue of Events: */

struct EventList {
    struct Event *first;		/* First in list. */
    struct Event *point;		/* Current position in list. */
};

/*	The NoteEvent structure maps on an Event structure. */

struct NoteEvent {
    struct NoteEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    unsigned char status;		/* MIDI status. */
    unsigned char value;		/* Note value. */
    unsigned char velocity;		/* Note velocity. */
    unsigned short duration;		/* The duration of this event. */
    short data;				/* Data storage. */
    struct Tool *tool;			/* Tool that processes this next. */
};

/*	Bars&Pipes dynamic string structure.  */

struct String {
    unsigned short length;		/* The length of the string that follows. */
    char string[1];			/* This is actually a variable length array. */
};

/*	StringEvents are used for storing Lyrics.  */

struct StringEvent {
    struct StringEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    char pad;
    short length;			/* Display length. */
    struct String *string;		/* Pointer to string. */
    struct Tool *tool;			/* Tool that processes this next. */
};

/*	The Master Chord list is made up of Chord structures: */

struct Chord {
    struct Chord *next;			/* Next in list. */
    struct String *name;		/* Chord name. */
    unsigned long pattern;		/* Bit pattern of chord. */
    unsigned short id;			/* Chord identifier. */
    char count;				/* Number of notes in chord. */
};

/*	ChordEvents represent Chords in the Song Parameters.  These
	map onto the Event structure. 
*/

struct ChordEvent {
    struct ChordEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    unsigned char root;			/* Root note. */
    char flats;				/* Chord root is a flat. */
    char pad;
    unsigned long chordid;		/* Chord id. */
    struct Chord *chord;		/* Chord. */
};

/*	KeyEvents represent Key and Scale/Mode in the Song 
	Parameters.  These map onto the Event structure. 
	Notice that the scales are defined with the Chord
	structure.
*/

struct KeyEvent {
    struct KeyEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    unsigned char root;			/* Root note. */
    char flats;				/* Display the key with flats. */
    char pad;
    unsigned long scaleid;		/* Scale id. */
    struct Chord *scale;		/* Pointer to Scale definition. */
};

/*	The Time Signature Event also maps onto the Event structure. */

struct TimeSigEvent {
    struct TimeSigEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    unsigned char beatcount;		/* Number of beats per measure. */
    unsigned char beat;			/* What note gets beat. */
    char pad;
    unsigned short clocks;    		/* Clocks per beat. */
    unsigned short measures;   		/* Measures till next. */
    unsigned long totalclocks;		/* Clocks till next. */
};

/*	But we need a special list (other than EventList)
	for the Time Signature list.
*/

struct TimeSigList {
    struct TimeSigEvent *first;		/* First in list. */
    struct TimeSigEvent *point;		/* Current position in list. */
    unsigned short measure;		/* Current measure. */
    unsigned short beat;		/* Current beat. */
    unsigned short clock;		/* Current clock. */
};

/*	Each Rhythm template points to a name and list of notes. */

struct Rhythm {
    struct Rhythm *next;		/* Next in list of templates. */
    struct String *name;		/* Name of this rhythm. */
    struct NoteEvent *notes;		/* List of notes. */
    long length;			/* Loop length. */
    short id;				/* Identifier. */
};

/*	Rhythm Events map onto the Event structure. */

struct RhythmEvent {
    struct RhythmEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    char pad;				/* Empty. */
    unsigned short rhythmid;		/* Id of rhythm clip. */
    struct Rhythm *rhythm;		/* Rhythm. */
    struct NoteEvent *point;		/* Current position in rhythm. */
};

/*	Dynamics Events map onto the Event structure.  */

struct DynamicsEvent {
    struct DynamicsEvent *next;		/* The next event in the list. */
    long time;				/* When this event occurs. */
    char type;				/* What type of event. */
    unsigned char value;		/* Dynamic value. */
};

/*	The Clip structure.  Clips are used to store sequences and
	Song Parameters as well as move them around.
*/

struct Clip {
    struct Clip *next;			/* List of clips. */
    struct EventList events;		/* Event list. */
    struct EventList chords;		/* List of bass chords. */
    struct EventList keys;		/* List of keys. */
    struct EventList lyrics;		/* List of lyrics. */
    struct EventList rhythm;		/* List of rhythm templates. */
    struct EventList dynamics;		/* List of dynamic changes. */
    struct TimeSigList timesig;		/* List of time signatures. */
    struct String *name;		/* Name of this clip. */
    struct String *notes;		/* Notes for this clip. */
    long begin;				/* Time this begins. */
    long end;				/* Time this ends. */
    unsigned char highnote;		/* Highest note, for display. */
    unsigned char lownote;		/* Lowest note, for display. */
    char locked;			/* Locked during record. */
};

/*	The Tool structure.  Nest this within your own Tool structure. */

struct Tool {
    struct Tool *next;			/* Next tool used by this track. */
    struct Tool *branch;		/* Tool on other track. */
    struct Tool *parent;		/* Parent tool (for macros.) */
    struct ToolMaster *toolmaster;	/* Pointer to actual tool. */
    struct Clip *clip;			/* Clip to be worked on. */
    struct String *name;		/* Name of this tool. */
    struct Window *window;		/* Edit window. */
    struct Track *track;		/* Track that owns this tool. */
    long toolid;			/* Tool ID. */
    unsigned short left,top;		/* Position of edit window. */
    unsigned short width,height;	/* Size of edit window. */
    unsigned short x,y;			/* Position in pipe display. */
    unsigned short xindex;		/* How far down list this is. */
    unsigned short yindex;		/* How far down track list this is. */
    short branchindex;			/* How far away branch tool is. */
    unsigned short id;			/* ID for file io. */
    char intool;			/* True if inlist, false if outlist. */
    char inedit;			/* Flag to indicate editing now. */
    char touched;			/* This tool has been edited. */
    char selected;			/* Icon selected in graph. */
    long tooltype;			/* Sequence? Input? Branch? */
					/* More tool unique stuff here... */
};

/*	Tool touched flags. */

#define TOUCH_EDIT		1	/* Tool has been edited. */
#define TOUCH_INIT		2	/* Tool has been initialised. */

/*	Tool type flags. */

#define TOOL_SEQUENCE		1	/* This is actually the track. */
#define TOOL_INPUT		2	/* This is an input tool. */
#define TOOL_OUTPUT		4	/* This is an output tool. */
#define TOOL_NORMAL		8	/* This is a normal tool. */
#define TOOL_ONTIME		0x10	/* This tool doesn't accept early events. */
#define TOOL_BRANCHIN		0x20	/* This tool merges two inputs. */
#define TOOL_BRANCHOUT		0x40	/* This tool has two outputs. */
#define TOOL_MACRO		0x80	/* This tool is a macro tool. */
#define TOOL_MACROOUT		0x100	/* This is the output of macro. */
#define TOOL_MACROBRANCH	0x200	/* This is the branch output of macro. */
#define TOOL_MACROIN		0x400	/* This is the input of macro. */
#define TOOL_GROUPIN		0x800	/* This tool part of group input. */
#define TOOL_SEED		0x1000	/* This tool needs to be triggered. */

/*	The ToolMaster structure defines the routines, images, name, and
	size that describe your Tool.
*/

struct ToolMaster {
    struct ToolMaster *next;		/* Next tool in this list. */
    long toolid;			/* Tool ID. */
    struct Image *image;		/* Icon for this tool. */
    struct Image *upimage;		/* Icon for branching up. */
    short x,y;				/* Position in toolbox for display. */
    char name[100];			/* Tool name. */
    char filename[100];			/* Where it is stored on disk. */
    struct Tool *(*createtool)();	/* Routine to allocate a new tool. */
    void (*edittool)();			/* Routine to edit tool parameters. */
    struct Event *(*processevent)();	/* Routine to process an event. */
    void (*processclip)();		/* Routine to process an entire clip. */
    void (*deletetool)();		/* Routine to delete a tool. */
    void (*removetool)();		/* Routine to close down. */
    long (*savesize)();			/* Returns size prior to save. */
    long (*savetool)();			/* Routine to save to disk. */
    struct Tool *(*loadtool)();		/* Routine to load from disk. */
    long (*expanda)();			/* Future routine? */
    long (*expandb)();			/* Future routine? */
    long (*expandc)();			/* Future routine? */
    long segment;			/* This tool's segment list. */
    long altsegment;			/* Alternate segment list. */
    struct Track *intrack;		/* Input track for this tool. */
    short toolsize;			/* Tool size for loading and saving. */
    char inedit;			/* Flag to indicate editing now. */
    char selected;			/* Icon selected in graph. */
    long tooltype;			/* Type of tool. */
};

/*	The Track structure.  These are arranged in a linked list.  Each
	holds a Clip for the sequence, a Clip for cutting, a Clip for
	the undo buffer, the Tool list that defines the PipeLine, and
	a lot of variables that are for display purposes only.
*/

struct Track {
    struct Track *next;			/* Next Track in the list. */
    struct Edit *edit;
    struct Clip clip;			/* A clip that defines the sequence. */
    struct Clip cut;			/* A clip for global editing. */
    struct Clip undo;			/* A clip for undo command. */
    struct EventList record;
    struct Tool *toollist;		/* List of tools. */
    struct Tool tool;			/* Sequence tool. */
    struct Tool *point;
    unsigned char channelin;		/* MIDI Channel coming in. */
    unsigned char channelout;		/* MIDI Channel going out. */
    unsigned char mode;			/* Mute | Through | Record. */
    unsigned char selected;		/* Track is highlighted. */
    long group;				/* Group bits. */
    unsigned long marks[20];
    short markindex;
    short height;
    short nameleft;
    short namewidth;
    short nameindent;
    short channelinleft;
    short toolsinleft;
    short toolsinwidth;
    short toolsinindent;
    short playrecordleft;
    short sequenceleft;
    short sequencewidth;
    long sequenceindent;
    short muteleft;
    short toolsoutleft;
    short toolsoutwidth;
    short toolsoutindent;
    short toolsouttotalwidth;
    short channeloutleft;
};

/*	Track mode bits. */

#define TRACK_MUTE	1		/* Discard all notes. */
#define TRACK_THROUGH	2		/* Pass notes through. */
#define TRACK_RECORD	4		/* Record mode on. */
#define TRACK_SOLOMUTE	8		/* Track was muted for solo. */
#define TRACK_INEDIT	16		/* Currently editing this track. */
#define TRACK_REALTIME	32		/* This is a real-time track. */

/*	The Accessory structure.  Each Accessory has one of these, 
	very similar to the ToolMaster structure.
*/

struct Accessory {
    struct Accessory *next;		/* Next accessory in this list. */
    long id;				/* Accessory ID. */
    struct Image *image;		/* Icon for this accessory. */
    struct Image *onimage;		/* Icon for when selected. */
    char name[100];			/* Name. */
    char filename[100];			/* Where it is stored on disk. */
    struct Window *window;
    unsigned short left,top;		/* Position of edit window. */
    unsigned short width,height;	/* Size of edit window. */
    unsigned short x,y;			/* Position in access box. */
    long (*remove)();
    long (*edit)();			/* Routine to edit accessory. */
    long (*open)();			/* Routine to open window. */
    long (*close)();			/* Routine to close window. */
    long (*size)();			/* Routine to size for save. */
    long (*save)();			/* Save routine. */
    long (*load)();			/* Load routine. */
    long (*install)();			/* Install environment. */
    long (*clear)();			/* Clear environment. */
    long (*expandc)();			/* Future routine? */
    long segment;			/* This accessory's segment list. */
    long altsegment;
    char selected;			/* Icon selected flag. */
};

/*	Transport Handler Commands: */

#define TC_START	1
#define TC_STOP		2
#define TC_POSITION	3
#define TC_RECORDON	4
#define TC_RECORDOFF	5
#define TC_PLAY		6
#define TC_TICK		7

/*	Display Bits (for functions->display command.) */

#define DRAW_NAMES		1
#define DRAW_CHANNELSIN		2
#define DRAW_TOOLSIN		4
#define DRAW_RECORD		8
#define DRAW_SEQUENCE		0x10
#define DRAW_MUTE		0x20
#define DRAW_TOOLSOUT		0x40
#define DRAW_CHANNELSOUT	0x80
#define DRAW_SCROLLS		0xFF
#define DRAW_LINES		0x100
#define DRAW_COMPUTE		0x200
#define DRAW_MARKERS		0x400
#define DRAW_CTOOLS		0x800
#define DRAW_SNAMES		0x1000
#define DRAW_STOOLSIN		0x2000
#define DRAW_SSEQUENCE		0x4000
#define DRAW_STOOLSOUT		0x8000
#define DRAW_CONTROLS		0x10000
#define DRAW_MENUS		0x20000
#define DRAW_VSCROLL		0x40000
#define DRAW_ALL		0xFFFFF
#define DRAW_TOOLS		0x100000
#define DRAW_LEDS		0x200000
#define DRAW_SELECTION		0x400000
#define DRAW_STRINGS		0x800000
#define DRAW_ALLNEW		0x1000000

/*	Functions: Global data and library routines,
	so all Tools can share these. 
*/

struct Functions {
    char lock;				/* Do not touch this structure! */
    char measureres;			/* Cuts resolve to measures. */
    char recording;			/* Set when recording. */
    char running;			/* Set when running. */
    char punchenabled;			/* Auto punch in and out enabled. */
    char loopenabled;			/* Loop mode turned on. */
    char clicking;			/* Click track on? */
    char seeclick;			/* Visual metronome. */
    char multiin;			/* Multiple inputs? */
    char clickchannel;			/* MIDI CLick channel. */
    char midiclock;			/* Sync to MIDI clocks. */
    char smpteclock;			/* Sync to SMPTE. */
    char sendmidiclock;			/* Send out MIDI clocks. */
    char smptetype;			/* Which SMPTE format. */
    char countdown;			/* Do count down. */
    char midiclick;			/* Use MIDI for click track. */
    char chop;
    unsigned long countlen;		/* Length of lead in. */
    long timenow;			/* Current time. */
    unsigned long markone;		/* Auto locate register. */
    unsigned long marktwo;		/* Auto locate register. */
    unsigned long punchin;		/* Punch in point. */
    unsigned long punchout;		/* Punch out point. */
    unsigned long loopin;		/* Loop in point. */
    unsigned long loopout;		/* Loop out point. */
    unsigned long cutin;		/* Cut in point. */
    unsigned long cutout;		/* Cut out point. */
    long starttime;			/* Where to play from. */
    long stoptime;			/* Marker to stop at. */
    unsigned long padcutin;		/* For non real time edits. */
    unsigned long padcutout;		/* For non real time edits. */
    unsigned long songlength;
    long startoffset;			/* Starting hi res clock offset. */
    unsigned short tempos[4];
    unsigned short tempo;		/* Current tempo. */
    unsigned short inittempo;		/* Initial tempo. */
    char songname[100];
    char author[100];
    short palette[8];			/* Colors. */
    char remotecontrol[128];		/* Table of remote controls. */
    long more[20];			/* Expansion space. */
    struct Track *tracklist;		/* Top track in list. */
    struct Clip masterclip;		/* Master key, chord, signature. */
    struct Clip masterundo;
    struct Clip mastercut;
    struct Edit *masteredit;    
    struct Tool *edittools[16];		/* 16 Tools to edit with. */
    unsigned short toolid;		/* Global tool id. */ 
    short groupid;			/* Currently selected group. */
    struct Chord *scalelist;		/* All scales. */
    struct Chord *chordlist;		/* All chords. */
    struct Rhythm *rhythmlist;		/* All rhythms. */
    long padd;
    struct Event *lista;		/* Leave this alone. */

    long smptetime;			/* Unused. */
    unsigned long frame;		/* Current frame. */
    unsigned long hirestime;		/* Hi res clock. */
    char version;
    long SysBase;			/* Exec library. */
    long DOSBase;			/* DOS library. */
    long IntuitionBase;
    long GfxBase;
    long LayersBase;
    long standardout;			/* Not used. */
    long padb;
    long padc;
    struct Screen *screen;		/* Screen we all exist in. */
    struct Window *window;		/* Main window. */
    struct ToolMaster *toolmasterlist;	/* All ToolMasters. */
    struct Accessory *accesslist;	/* All Accessories. */
    struct Tool *midiouttool;		/* Tool to send MIDI clocks. */
    long (*stealmidi)();		/* Steal serial interrupt. */
    long (*releasemidi)();		/* Release MIDI. */
    long pad[100];			/* Room for more. */

    long (*processsmpteclock)();	/* Process a SMPTE event. */
    long (*processmidiclock)();		/* Process a MIDI clock event .*/
    long (*processsysex)();	
    long (*processinputevent)();

    long (*clearenvironment)();		/* Clear the environment. */
    long (*installenvironment)();	/* Replace the environment. */
    long (*loadsong)();
    long (*savesong)();

    long (*installtransport)();		/* Install transport handler. */
    long (*removetransport)();		/* Remove transport handler. */
    long (*transportcommand)();		/* Send command to handlers. */

    long (*qevent)();			/* Put event in queue. */
    long (*allocevent)();		/* Allocate an event. */
    long (*fastallocevent)();		/* Allocate an event from interrupt. */
    long (*freeevent)();		/* Free an event. */
    long (*sorteventlist)();		/* Sort a list of events. */
    long (*freelist)();			/* Free a list of events. */
    long (*dupelist)();			/* Duplicate a list. */

    long (*allocstring)();		/* Allocate a string. */
    long (*freestring)();		/* Free a string. */
    long (*replacestring)();		/* Replace a string with another. */
    long (*dupestring)();		/* Duplicate a string. */
    long (*stringtext)();		/* Get string. */

    long (*clearclip)();		/* Clear a clip. */
    long (*dupeclip)();			/* Duplicate a clip. */
    long (*cutclip)();			/* Clip cut operation. */
    long (*copyclip)();			/* Clip copy operation. */
    long (*pasteclip)();		/* Clip paste operation. */
    long (*mixclip)();			/* Clip mix operation. */
    long (*loadclip)();			/* Load a clip from disk. */
    long (*saveclip)();			/* Save a clip. */
    long (*clipboard)();		/* Clipboard operation. */

    long (*createtrack)();		/* Create a track. */
    long (*deletetrack)();		/* Delete a track. */

    long (*myalloc)();			/* Internal allocation routine. */
    long (*myfree)();			/* Internal free routine. */

    long (*doscall)();			/* Make a DOS command. */
    long (*fastopen)();			/* Fast file open. */
    long (*fastwrite)();		/* Fast file write. */
    long (*fastread)();			/* Fast file read. */
    long (*fastclose)();		/* Fast file close. */

    long (*popupkey)();
    long (*popupnote)();
    long (*popupoctave)();
    long (*popupchord)();
    long (*popuprhythm)();
    long (*popupscale)();

    long (*measuretotime)();
    long (*timetomeasure)();
    long (*totalbeatstotime)();
    long (*timetototalbeats)();
    long (*lengthtostring)();
    long (*stringtolength)();
    long (*timetostring)();
    long (*stringtotime)();
    long (*frametostring)();
    long (*stringtoframe)();
    long (*notetostring)();
    long (*stringtonote)();

    long (*noteinkey)();		/* Check for note in key. */
    long (*noteinchord)();		/* Check for note in chord. */
    long (*noteinrhythm)();		/* Align note with rhythm. */
    long (*timetokey)();
    long (*timetochord)();
    long (*timetodynamics)();
    long (*nextrhythmbeat)();
    long (*scaletotwelve)();
    long (*twelvetoscale)();
    long (*random)();			/* Return random number. */

    long (*areyousure)();		/* Put up "are you sure?" requester. */
    long (*openwait)();			/* Open wait requester. */
    long (*closewait)();		/* Close wait requester. */

    long (*display)();			/* Display main window. */
    long (*ScrollingPopUpMenu)();
    long (*DragSlider)();
    long (*DrawSlider)();
/*	Inovatools 1 routines. */
    long (*Itoa)();
    long (*Atoi)();
    long (*RefreshGadget)();
    long (*GetGadget)();
    long (*GetStringInfo)();
    long (*SetStringInfo)();
    long (*GetStringInfoNumber)();
    long (*SetStringInfoNumber)();
    long (*GetPropInfo)();
    long (*SetPropInfo)();
    long (*GetSelectIntuiMessage)();
    long (*GetIntuiMessage)();
    long (*ClearIntuiMessages)();
    long (*GetMenu)();
    long (*GetMenuItem)();
    long (*CheckMenuItem)();
    long (*EnableMenuItem)();
    long (*EnableMenu)();
    long (*EnableGadget)();
    long (*SelectGadget)();
    long (*DupeNewWindow)();
    long (*DeleteNewWindow)();
    long (*DupeMenu)();
    long (*DeleteMenu)();
    long (*SendCloseWindow)();
    long (*List_Len)();
    long (*List_Position)();
    long (*List_Pred)();
    long (*List_Index)();
    long (*List_Cat)();
    long (*List_Insert)();
    long (*List_Remove)();
    long (*SetScrollBar)();
    long (*DrawList)();
    long (*ScrollList)();
    long (*SizeList)();
    long (*InitListInfo)();
    long (*RemoveListInfo)();
    long (*GetListItem)();
    long (*ClickList)();
    long (*InsertListItem)();
    long (*RemoveListItem)();
    long (*PopUpMenu)();
    long (*DragGadget)();
    long (*FileName)();
    long (*FlashyOpenWindow)();
    long (*FlashyCloseWindow)();
    long (*WhichWindow)();
    long (*DupeListInfo)();
    long (*DeleteListInfo)();
    long (*RealTimeScroll)();
};

/*	Environment structure, for loading and saving entire songs. */

struct Environment {
    char lock;				/* Do not touch this structure! */
    char measureres;			/* Cuts resolve to measures. */
    char recording;			/* Set when recording. */
    char running;			/* Set when running. */
    char punchenabled;			/* Auto punch in and out enabled. */
    char loopenabled;			/* Loop mode turned on. */
    char clicking;			/* Click track on? */
    char seeclick;			/* Visual metronome. */
    char multiin;			/* Multiple inputs? */
    char clickchannel;			/* MIDI CLick channel. */
    char midiclock;			/* Sync to MIDI clocks. */
    char smpteclock;			/* Sync to SMPTE. */
    char sendmidiclock;			/* Send out MIDI clocks. */
    char smptetype;			/* Which SMPTE format. */
    char countdown;			/* Do count down. */
    char midiclick;			/* Use MIDI for click. */
    char chop;
    unsigned long countlen;		/* Length of lead in. */
    unsigned long timenow;		/* Current time. */
    unsigned long markone;		/* Auto locate register. */
    unsigned long marktwo;		/* Auto locate register. */
    unsigned long punchin;		/* Punch in point. */
    unsigned long punchout;		/* Punch out point. */
    unsigned long loopin;		/* Loop in point. */
    unsigned long loopout;		/* Loop out point. */
    unsigned long cutin;		/* Cut in point. */
    unsigned long cutout;		/* Cut out point. */
    unsigned long starttime;		/* Where to play from. */
    unsigned long stoptime;		/* Marker to stop at. */
    unsigned long padcutin;		/* For non real time edits. */
    unsigned long padcutout;		/* For non real time edits. */
    unsigned long songlength;
    long startoffset;			/* Starting hi res clock offset. */
    unsigned short tempos[4];
    unsigned short tempo;		/* Current tempo. */
    unsigned short inittempo;		/* Initial tempo. */
    char songname[100];
    char author[100];
    short palette[8];			/* Colors. */
    char remotecontrol[128];		/* Table of remote controls. */
    long id;				/* Each has a unique id. */
    long more[19];			/* Expansion space. */
    struct Track *tracklist;		/* Top track in list. */
    struct Clip masterclip;		/* Master key, chord, signature. */
    struct Clip masterundo;
    struct Clip mastercut;
    struct Edit *masteredit;    
    struct Tool *edittools[16];		/* 16 Tools to edit with. */
    unsigned short toolid;		/* Global tool id. */ 
    short groupid;			/* Currently selected group. */
    struct Chord *scalelist;		/* All scales. */
    struct Chord *chordlist;		/* All chords. */
    struct Rhythm *rhythmlist;		/* All rhythms. */
    long padd;
    struct Event *lista;		/* Leave this alone. */
};

