Solved

Cd Player tracks

Posted on 1998-04-04
4
208 Views
Last Modified: 2010-04-06
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
0
Comment
Question by:spat
  • 2
4 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1361281
0
 
LVL 5

Accepted Solution

by:
inter earned 220 total points
ID: 1361282
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);
      begin
       with M do
       if DeviceType = dtCDAudio then
       begin
         // 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);
       end;
      end;

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

Sincerely,
Igor

0
 

Author Comment

by:spat
ID: 1361283
What I really want to do is show how many tracks are on the cd and the amount of time each one is.
0
 
LVL 5

Expert Comment

by:inter
ID: 1361284
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
type
  THMSRec = record
    Hours: byte;
    Minutes: byte;
    Seconds: byte;
    NotUsed: byte;
  end;

// 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);
var
  TheLength: LongInt;
begin
  TimeFormat := tfHMS; //be sure to set to information we require
  TheLength := M.TrackLength[Track];
  with THMSRec(TheLength) do
  begin
    H :=  Hours;
    M := Minutes;
    S := Seconds;
  end;
end;

Bye, Igor
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question