Cd Player tracks

How do you manipulate the tracks in Delphi when writing a cd player. An example of what I want to do is the Edit Play List feature in the microsoft cd player that comes with Windows
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If seeking a track or specific time is what you seek here is my answer which I have given previously:

      With the following you can seek to any (Trac, Minute, Second)
      But besure to add the MMSystem to you USES clause:

      procedure SeekToTrack(M : TMediaPlayer; Trac, Minute, Second: Byte);
       with M do
       if DeviceType = dtCDAudio then
         // we set the time to Track Minute Second Frame Format
         TimeFormat := tfTMSF;
         // This macro makes up a position from vars Frame is 0
         // for CDs
         Position := mci_Make_TMSF(Trac, Minute, Second,0);

Also by using TimeFormat of media player you can do other kind of seeks.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
spatAuthor Commented:
What I really want to do is show how many tracks are on the cd and the amount of time each one is.
Ok friend,

I do not know more direct way of doing this (this is simple also) but here is the code:
(always bear in mind that the properties such as Position and Length of the media player is in TimeFormat units.

//we declare this for easy manipulation since all return codes are in longints
  THMSRec = record
    Hours: byte;
    Minutes: byte;
    Seconds: byte;
    NotUsed: byte;

// getting number of tracks (simple is not it)
  T := MediaPlayer1.Tracks;
// getting the track length
procedure GetTrackLength(M : TMediaPlayer;Track : Integer; var H,M,S:Integer);
  TheLength: LongInt;
  TimeFormat := tfHMS; //be sure to set to information we require
  TheLength := M.TrackLength[Track];
  with THMSRec(TheLength) do
    H :=  Hours;
    M := Minutes;
    S := Seconds;

Bye, Igor
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.