#ifndef LIBRARIES_CDDA_H
#define LIBRARIES_CDDA_H
/*
** $VER: cdda.h 1.0 (6.3.2002)
** Includes Release 1
**
** Cdda.library definitions
**
** (C) Copyright 2002 by Rüdiger Hanke
**     All Rights Reserved
*/

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

typedef APTR CDRIVEPTR;

/* Version stuff */
#define CDDA_VMIN			2		/* Never open it with a lower version number! */
#define CDDA_VCURRENT   2		/* Current version */

/* Representation of a time value in Minutes/Seconds/Frames format */
struct CDS_MSF
{
   UBYTE msf_Minutes;
   UBYTE msf_Seconds;
   UBYTE msf_Frames;
};

/* Structure holding a time value in either MSF or Frames format */
struct CDS_Time
{
   union
   {
      struct CDS_MSF tm_MSF;
      ULONG          tm_Frame;
   } tm_Format;
};

/* Track information */
struct CDS_TrackInfo
{
	UWORD					ti_StructSize;
   UWORD             ti_TrackNo;
	STRPTR				ti_Title;
   struct CDS_Time   ti_TrackStart;
   struct CDS_Time   ti_TrackLength;
};

/* Current playing position */
struct CDS_TrackPosition
{
	UWORD					tp_StructSize;
   UWORD             tp_TrackNo;
   UWORD             tp_Index;
	UWORD					tp_Pad;
   struct CDS_Time   tp_AbsTime;
   struct CDS_Time   tp_RelTime;
};

/* Event structures passed as parameters to event hooks */
struct CDS_Event
{
	LONG	ce_Code;
};

struct CDS_TimeEvent
{
	LONG						    cte_Code;
	struct CDS_TrackPosition cte_TrackPos;
};

struct CDS_TrackEvent
{
	LONG	ctre_Code;
	UWORD ctre_TrackNo;
};

#define CDTimeEvent(ev) ((struct CDS_TimeEvent*)ev)
#define CDTrackEvent(ev) ((struct CDS_TrackEvent*)ev)

/* Tags for CDDA_Play */
#define  CDPA_StartTrack         (TAG_USER+0)
#define  CDPA_StartMinute        (TAG_USER+1)
#define  CDPA_StartSecond        (TAG_USER+2)
#define  CDPA_StartFrame         (TAG_USER+3)
#define  CDPA_EndTrack           (TAG_USER+4)
#define  CDPA_EndMinute          (TAG_USER+5)
#define  CDPA_EndSecond          (TAG_USER+6)
#define  CDPA_EndFrame           (TAG_USER+7)
#define  CDPA_Loops              (TAG_USER+8)
#define  CDPA_EventHook          (TAG_USER+9)
#define  CDPA_EventMask          (TAG_USER+10)

/* Events */
#define	CDDA_EVENT_TIMEUPDATE	(1<<0)
#define	CDDA_EVENT_PAUSED 		(1<<1)
#define	CDDA_EVENT_RESUMED 		(1<<2)
#define	CDDA_EVENT_RESTART 		(1<<3)
#define	CDDA_EVENT_TRACK        (1<<4)
#define	CDDA_EVENT_STOPPED	   (1<<5)
#define	CDDA_EVENT_FINISHED		(1<<6)

/* Tags for CDDA_FindDrive */
#define  CDFA_VolumeName         (TAG_USER+0)	/* STRPTR */
#define  CDFA_Vendor             (TAG_USER+1)	/* STRPTR */
#define  CDFA_Device             (TAG_USER+2)	/* STRPTR */
#define  CDFA_Unit               (TAG_USER+3)	/* ULONG  */
#define  CDFA_CDID               (TAG_USER+4)	/* STRPTR */

/* Access types for CDDA_ObtainDrive */
#define  CDDA_SHARED_ACCESS      0

/* Attributes you can query with CDDA_GetAttr */
#define CDDA_Vendor      0    /* STRPTR */
#define CDDA_Model       1    /* STRPTR */
#define CDDA_Revision    2    /* STRPTR */
#define CDDA_Device      3    /* STRPTR */
#define CDDA_Unit        4    /* ULONG */
#define CDDA_Status      5    /* ULONG */
#define CDDA_DiscAvail   6    /* BOOL */
#define CDDA_Artist      7    /* STRPTR */
#define CDDA_DiscTitle   8    /* STRPTR */
#define CDDA_TrackCount  9    /* ULONG */
#define CDDA_TrackPos    10   /* CDS_TrackPosition * */
#define CDDA_TrackPosMSF 11   /* CDS_TrackPosition * */

/* Possible status values for CDDA_Status */
#define CDDA_Status_Unknown         0
#define CDDA_Status_Busy            1
#define CDDA_Status_Paused          2
#define CDDA_Status_Ready           3

/* Flags for CDDA_GetTrackInfo */
#define CDDA_GTI_MSFTimes           1

/* Requester types for CDDA_AllocRequest */
#define CDDA_DriveRequest  0
#define CDDA_TrackRequest  1

/* Requester tags for CDDA_DriveRequest */
#define CDDADR_InitialHeight     (TAG_USER+0)
#define CDDADR_InitialWidth      (TAG_USER+1)
#define CDDADR_InitialLeftEdge   (TAG_USER+2)
#define CDDADR_InitialTopEdge    (TAG_USER+3)
#define CDDADR_PubScreenName     (TAG_USER+4)
#define CDDADR_Screen            (TAG_USER+5)
#define CDDADR_SleepWindow       (TAG_USER+6)
#define CDDADR_Window            (TAG_USER+7)
#define CDDADR_NegativeText      (TAG_USER+8)
#define CDDADR_PositiveText      (TAG_USER+9)
#define CDDADR_TitleText         (TAG_USER+10)
#define CDDADR_InitialDrive      (TAG_USER+11)

/* Cdda.library-specific errors */
#define CDDA_Err_NoTOC           (1L)		/* Table of contents could not be read */
#define CDDA_Err_WrongParam      (2L)		/* Wrong parameters passed to function */
#define CDDA_Err_NoSuchTrack     (3L)		/* Illegal track number */
#define CDDA_Err_NotOwner        (4L)		/* You have to obtain the hardware first before calling this function */
#define CDDA_Err_IsBusy          (5L)		/* Drive is currently in use */
#define CDDA_Err_NotYouPlaying   (6L)		/* Tried to stop/pause/resume a playback which you did not initiate */

#endif 
