//====START_GENERATED_PROLOG======================================
//
//
//   COMPONENT_NAME: odother
//
//   CLASSES: none
//
//   ORIGINS: 27
//
//
//   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//
//   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//   OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//
// @(#) 1.4 nt/src/samples/cdplayer/cdcntrl.h, odcdplayerpart, od96nt, odnt9712d 11/5/96 17:10:40 [ 3/21/97 17:32:45 ]

/*-------------------------------------------------------------------+
|                            CDCntrl.h                               |
| ================================================================== |
|                                                                    |
| Description:  CD Control class definition...                       |
|                                                                    |
|               Member functions:                                    |
|                       o  cdLoad ()   - Load the CD                 |
|                       o  cdPlay ()   - Begin playing               |
|                       o  cdPause ()  - Pause                       |
|                       o  cdResume () - Resume playing              |
|                       o  cdStop ()   - Stop playing                |
|                       o  cdEject ()  - Eject the CD                |
|                                                                    |
|               Data members:                                        |
|                                                                    |
|                   o  fDevice - Interface to CDROM device driver    |
|                                                                    |
|                   o  fAlbum  - CD Album information                |
|                                                                    |
|                   o  fTrack  - Current track                       |
|                   o  fTime   - Current offset within above track   |
|                                                                    |
| Author:       David Kuettel, Summer 1996                           |
|                                                                    |
+-------------------------------------------------------------------*/
#ifndef IBMSample_CDCONTROL
#define IBMSample_CDCONTROL

#include "CDDevice.h"

class CDAlbum;

class CDControl {
public:
	enum EStates { kNoDrive, kNoMedia, kStopped, kPlaying, kPaused };
	enum EModes  { kSequential, kSuffle, kProgram, 
				   kIntro10, kIntro20, kIntro30 };
	enum EOptions { kRepeat = 0x01 };

public:
	CDControl (HWND windowHandle);
	~CDControl ();

	LPSTR Status ();			// Current status...

	long GetTrack ();			// Current track...
	long GetMinute ();			// Current track...
	long GetSecond ();			// Current track...

	const char* GetAlbum ();		// Current album...
	const char* GetArtist ();		// Current artist...
	const char* GetSong ();			// Current song...

	long TrackLength ();			// Current track length...
	long GetNumTracks ();			// Total number of tracks

	/*
	 *  State transistion functions...
	 */
	void cdPoll ();  			// Poll for latest status...
	int cdLoad ();				// Load the CD
	int cdPlay ();				// Begin/resume playing
	int cdPause ();			        // Pause
	int cdStop ();				// Stop 
	int cdEject ();				// Eject the CD
	int cdReset ();				// An error occured, try and recover...

	/*
	 *  Misc functions...
	 */
	void ChangeTrack (long inc);		// Change (+/-) one track
	void SelectTrack (long track);		// Select a specific track
	void Repeat ();				// Toggle Repeat play
	void Intro ();				// Toggle Intro play

	EStates GetState () { return fState; }

private:
	void NextTrack (long& track);		// Go to next track...
	void PrevTrack (long& track);		// Go to previous track...

	enum { kTimeout = 1000 };

	EStates  fState;			// Current state
	EModes   fMode;
	long     fOptions;

	long fIndex;				// Index into list of songs...
	HWND hWnd;

	CDDevice device;			// CD Device interface...
	CDAlbum* fAlbum;
};
#endif /* IBMSample_CDCONTROL */
