Solved

Cd Player tracks

Posted on 1998-04-04
4
204 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now