Unit Cd

Classes

TCDForm -

Functions

CDDetails - Setup CD Details on Form
CDNotReadyTimer - When the CD is not ready - i.
CDOfflineTimer - When the CD is Offline - i.
CDPausedTimer - When the CD is Paused
CDPlayingTimer - When the CD is Playing
CDStoppedTimer - When the CD is Stopped
DisablePlayer - Deactivate all controls etc.
EditCD - Edit a CDDetail Record
EnablePlayer - Activate all controls etc.
FindCD - Find CD in CDDATA.
GetEndPosition - Return the end position for a particular track
GetPlayerStatus - Get the status of the CD Player, or leave it unchanged if unknown mpNotReady,mpStopped,mpPlaying,mpRecording, mpSeeking,mpPaused,mpOpen
GetPositions - Get all the current positions of the CD Player
GotoPosition - Goto a specified position
GotoTrack - Goto a specified Track Number
MakeCDKey - Create a Key to Identify a CD (Hopefully uniquely)
MilliToTime - Convert the milliseconds time to minutes:seconds string
PositionDisplay - Update the timer display with the currently selected time
preparefornewCD - Prepare for a new CD
SetButtons - Enable/Disable CDPlayer Buttons
SetFormCaption -
SetTimer - To prevent the disk drive whirring that happens when the CD is attempted to be open and there is no CD in, the timer event is slown down unless the CD is playing
SetTimerTrack - Only alter the buttons if the new setting is different - this stops flickering
SetupNewCD - Slightly better way
SetVolumeScroller -
TurnOffLEDs - Set all the LEDs to Off 0's
TurnOnLEDs - Set all the LEDs to On 0's
UpdateTracklist - Move the currently displayed track
WriteCD - Write CD
ZeroFill - Really crap routine - but hell who cares?

Types

CDDetail
CDStates
PlayModes
TimerModes
TrackDetail

Constants

AllowedInstances
CDDEVICE
MAXTRACKS

Variables

CDForm
CDKey
CDPosition
CDRemaining
CurRemaining
CurrentCD
CurrentTrack
Disptype
downcnt
EndPosition
GlobalCD
LastFound
LastPlayerStatus
LoopTrack
MyAppName
MyClassName
MyPopup
NumFound
OnTop
PlayerStatus
PlayMode
stepgap
TimerMode
TrackPosition


Functions


procedure CDDetails(var ACD: CDDetail;s: integer);

Setup CD Details on Form

procedure CDNotReadyTimer;

When the CD is not ready - i.e. Tray Open

procedure CDOfflineTimer;

When the CD is Offline - i.e. Not yet opened

procedure CDPausedTimer;

When the CD is Paused

procedure CDPlayingTimer;

When the CD is Playing

procedure CDStoppedTimer;

When the CD is Stopped

procedure DisablePlayer;

Deactivate all controls etc..

procedure EditCD(var EdCD: CDDetail;key: string);

Edit a CDDetail Record

procedure EnablePlayer;

Activate all controls etc..

procedure FindCD(key: string;var ACD: CDDetail);

Find CD in CDDATA.INI file

function GetEndPosition(tracknum: integer): longint;

Return the end position for a particular track

function GetPlayerStatus: CDStates;

Get the status of the CD Player, or leave it unchanged if unknown mpNotReady,mpStopped,mpPlaying,mpRecording, mpSeeking,mpPaused,mpOpen

procedure GetPositions;

Get all the current positions of the CD Player

procedure GotoPosition(pos: longint);

Goto a specified position

procedure GotoTrack(tracknum: integer);

Goto a specified Track Number

procedure MakeCDKey(var ACD: CDDetail;var key: string);

Create a Key to Identify a CD (Hopefully uniquely)

function MilliToTime(t: LongInt): string;

Convert the milliseconds time to minutes:seconds string

procedure PositionDisplay;

Update the timer display with the currently selected time

procedure preparefornewCD;

Prepare for a new CD

procedure SetButtons(CDMode: CDStates);

Enable/Disable CDPlayer Buttons

procedure SetFormCaption(s: string);


procedure SetTimer(t: CDStates);

To prevent the disk drive whirring that happens when the CD is attempted to be open and there is no CD in, the timer event is slown down unless the CD is playing

procedure SetTimerTrack(tim:integer;tck: integer);

Only alter the buttons if the new setting is different - this stops flickering

procedure SetupNewCD;

Slightly better way

procedure SetVolumeScroller;


procedure TurnOffLEDs;

Set all the LEDs to Off 0's

procedure TurnOnLEDs;

Set all the LEDs to On 0's

procedure UpdateTracklist(l: integer);

Move the currently displayed track

procedure WriteCD(key: string;var ACD: CDDetail);

Write CD

function ZeroFill(size: integer;s: string): string;

Really crap routine - but hell who cares?

Types


CDDetail = record
CDTitle : string[80];
Artist : string[80];
TotalTracks : integer;
CDLength : longint;
TrackDetail : array[1..MAXTRACKS] of TrackDetail
end;

CDStates=(cdOffline,cdPlaying,cdStopped,cdNotReady,cdPaused);

PlayModes=(plTrackOnce,plTrackRepeat,plCDOnce,plCDRepeat);

TimerModes=(tmTrackGone,tmTrackLeft,tmCDGone,tmCDLeft);

TrackDetail = record
TrackTitle : string[80];
TrackStart : longint;
TrackLength : longint
end;

Constants

AllowedInstances = 0

CDDEVICE = 2

MAXTRACKS = 99


Variables

CDForm : TCDForm

CDKey : string

CDPosition : longint

CDRemaining : longint

CurRemaining : longint

CurrentCD : CDDetail

CurrentTrack : integer

Disptype : integer

downcnt : integer

EndPosition : longint

GlobalCD : CDDetail

LastFound : HWND

LastPlayerStatus : CDStates

LoopTrack : integer

MyAppName : array[0..255] of Char

MyClassName : array[0..255] of Char

MyPopup : HWND

NumFound : Integer

OnTop : Integer

PlayerStatus : CDStates

PlayMode : PlayModes

stepgap : integer

TimerMode : TimerModes

TrackPosition : longint