Solved

Cd Player tracks

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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