Solved

Cd Player tracks

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 161
Virtuailstring tree compare node issue 14 125
Tvertscrollbox like a whatsapp layout delete messages 1 23
MS Access from Delphi 31 59
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…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

808 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