Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which track

Status
Not open for further replies.

Detective

Programmer
Mar 8, 2002
15
NL
Which property of a TMediaPlayer indicates
which track of the CD is playing?
 
Look at Position to figure out where you are on the disc. (But see also TimeFormat for gotchas with this.) Then roll through the TrackPosition array, from 0 to Tracks-1 (I think), looking for the track with the highest TrackPosition that is less than the current Position. That's the track you're in.

If you want to keep your code simple, you can assume that values in the TrackPosition array are in increasing order; but I don't know if that's always true. Or:
Code:
for i := 0 to Tracks - 1 do
    if (Position > TrackPosition[i]) and (Position < TrackPosition[i] + TrackLength[i]) then
        ShowMessage('We''re in track ' + IntToStr(i));
-- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top