/*
   These are the developer files for AlgoMusic

   Last change: 24-May-97


   General stuff:

   When accessing the AlgoMusicMsgPort structure, make sure that the
structure is valid, meaning that you should do a Forbid() first, then
use FindPort() to get the pointer, read all necessary stuff and then
Permit() (make sure you the stuff Forbid()/Permit() is as short as
possible). This whole thing is necessary AlgoMusic might change some
of the values while you are snooping in it.


  Example:

  const struct AlgoMusicMsgPort *p;   /* No changes allowed! */
  struct AlgoMusicMsgPort myport;
  BOOL portvalid=FALSE;

  Forbid();
  if(p=(struct AlgoMusicMsgPort *)FindPort(ALGOMUSICPORTNAME))
    {
    myport=*p;        /* Copy whole port structure */
    portvalid=TRUE;
    }
  Permit();

  if(portvalid)
    {
    ...      /* Use myport only here, not p! */
    }

*/


/* The name of AlgoMusic's global port */

#define ALGOMUSICPORTNAME (STRPTR)"AlgoMusic.port"


/*

    struct AlgoMusicMsgPort


    Contains vital information about the song currently being
    played. Information can be obtained by doing a FindPort()
    and reading data out of the AlgoMusicMsgPort structure
    returned.


    Example:

    Have a look at Example.c!

*/

struct AlgoMusicMsgPort
  {
  struct MsgPort ExecMsgPort;   /* Standard Message Port */

  /* AlgoMusic specific stuff */

  char SongName[256];           /* Name of the current song */
  ULONG RandomInit;             /* Song serie's randominit  */
  ULONG SongNr;                 /* Number of the song (1,...) */
  ULONG BPM;                    /* Current BPM */
  LONG FineTune;                /* Current FineTune */
  ULONG TotalSteps;             /* 64 steps = 1 pattern */
  ULONG CurrentStep;            /* 0 .. TotalSteps-1 
                                   If song is finished, it will be TotalSteps */
  USHORT Progress;              /* Playing progress in percent:
                                   CurrentStep*100/TotalSteps */
  USHORT State;                 /* See states below */

  /* Of course this will be longer in the future! */
  };

/* States */

#define STATE_UNKNOWN   0   /* Unknown state. Should not occur! */
#define STATE_RENDERING 1   /* Song is being created */
#define STATE_PLAYING   2   /* Song is being played */
#define STATE_STOPPED   3   /* Playing has been stopped via STOP */
