#ifndef _KBTRACK_H_
#define _KBTRACK_H_

#include "kbId.h"
#include "ifFactory.h"
#include "kbMain.h"
#include "ifTrack.h"
#include "kbPart.h"

/**
 * A kooBase song can consist of several tracks, where each track may consist of several parts and 
 * each part finally consists of a bunch of notes (in future: as well as other midi-events).
 * The KbMain object is connected to the first track, the other tracks are added in a chain,
 * i.e. each track has a pointer next, that points to the next track and can be set via sNext() and
 * obtained via gNext().\\
 * The presentation is attached via the interface (as in KbMain and KbPart), which can be obtained
 * gInterface.
 * @see KbMain::gTrack
 * @see IfTrack
 * @see QtTrack
 * @see TxTrack
 * @short   The kooBase Track class
 * @author  Jan Wuerthner
 * @version 0.95
 */
class KbTrack : public KbId
{
 private:
  IfTrack * ifTrack;
  KbMain  * main;
  KbTrack * next;
  KbPart  * part;
  bool toggle[3];
  char name[201];
  int program;
  int channel;
  int output;
  int volume;
  int delay;
 public:
  
  /**
   * Constructor to create a track.
   * @param kbMain to remember the main object.
   * @param i this optional parameter may set the midi channel, when constructing a track.
   */
  KbTrack( KbMain * kbMain, int i=0 );
  
  ~KbTrack();

  /**
   * @return the next track in the chain.
   * @see #sNext
   */
  KbTrack * gNext();

  /**
   * sets the next track in the chain.
   * @param tr the track supposed to follow this track.
   * @see #gNext
   */
  void sNext( KbTrack * tr );

  /** 
   * @return the main object.
   * @see KbMain
   */
  KbMain * gMain();

  /**
   * calculates a track's order number within the chain.
   * @return the order number of the track within the chain. (This is calculated each time trackNum() is called!)
   */
  int trackNum();

  /** 
   * @return the interface to the presentation.
   * @see IfTrack
   */
  IfTrack * gInterface();

  /**
   * returns the first part
   */
  KbPart * gPart();

  /**
   * sets the first part
   */
  void sPart(KbPart * p);

  /**
   * @return the current midi program.
   * @see #sProgram
   */
  int gProgram();

  /**
   * @return the current midi channel.
   * @see #sChannel
   */
  int gChannel();

  /**
   * @return the current output device.
   * @see #sOutput
   */
  int gOutput();

  /**
   * @return the current relative volume.
   * @see #sVolume
   */
  int gVolume();

  /**
   * @return the current delay.
   * @see #sDelay
   */
  int gDelay();

  /**
   * Each track has (currently three) toggle buttons: mute, type and lock
   * For mute and lock the states TRUE and FALSE mean on and off respectively. For type
   * TRUE means MIDI-Track and FALSE means Audio-Track (which is not implemented yet).
   * @version 24.12.98
   * @param n describes the toggle button: 0=mute, 1=type, 2=lock.
   * @return the state of the tracks n'th toggle button.
   * @see #sToggle
   */
  bool gToggle(int n);

  /**
   * @param n the midi program, the track will be set to.
   * @see #gProgram
   */
  void sProgram(int n);

  /**
   * @param n the midi channel, the track will be set to.
   * @see #gChannel
   */
  void sChannel(int n);

  /**
   * @param n the output device, the track's midi events will be sent to.
   * @see #gOutput
   */
  void sOutput(int n);

  /**
   * @param n the relative volume, the track will be set to.
   * @see #gVolume
   */
  void sVolume(int n);

  /**
   * @param n the delay, the track will be set to.
   * @see #gDelay
   */
  void sDelay(int n);

  /**
   * @param i the track's toggle button (0=mute, 1=type, 2=lock).
   * @param n the track's i'th toggle button's state.
   * @see #gToggle
   */
  void sToggle(int i,bool n);

  /**
   * adds a part to the track.
   */
  KbPart * addPart(int left, int right);

  /**
   * returns the tracks name
   */
  char * gName();

  /**
   * sets the tracks name
   */
  void sName(char * n);

};

#endif

Documentation generated by wuerthne@clouseau on Sat Feb 20 16:41:13 MST 1999