Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cd Player tracks

Posted on 1998-04-04
4
Medium Priority
?
214 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 880 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

Technology Partners: 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Integration Management Part 2
Suggested Courses

926 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