?
Solved

Edit Play List

Posted on 1998-09-22
8
Medium Priority
?
168 Views
Last Modified: 2010-04-06
How could I make the cd play the tracks in the order i tell it to. When one track is done playing, it should go on to the next track in a string of number or something
0
Comment
Question by:spat
8 Comments
 

Expert Comment

by:9pep
ID: 1340593
I really don't know.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1340594
HeLlO yOu TwO! jUsT wOnDeRiNg WhY aRe YoU pLaYiNg TrIcKs On EaCh OtHeR???

ReGaRdS,
ViKtOr IvAnOv
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Accepted Solution

by:
333 earned 160 total points
ID: 1340596
Hi,
I did it this way:
Let's say MP is TMediaPlayer, NowPlaying is track number, EndPosition is end position of track, track list is in ListBox1 (track list is just tracks numbers, i.e 01,02,03), CurTrack is track list's index, CDTimer is TTimer (interval=100).
.
{Set positions and track number for first track in a ListBox1}
CurTrack:=0;
NowPlaying:=strtoint(ListBox1.Items[CurTrack]);
MP.Position:=MP.TrackPosition[NowPlaying];
EndPosition:=MP.TrackPosition[NowPlaying]+MP.TrackLength[NowPlaying];
.
procedure TForm1.CDTimerTimer(Sender: TObject);
begin
  if MP.Position>=EndPosition then begin
    CDTimer.Enabled:=false;
    if MP.Mode=mpPlaying then MP.Pause;
    inc(CurTrack);
    NowPlaying:=strtoint(ListBox1.Items[CurTrack]);
    MP.Position:=MP.TrackPosition[NowPlaying];
    EndPosition:=MP.TrackPosition[NowPlaying]+MP.TrackLength[NowPlaying];
    if MP.Mode=mpPaused then MP.Resume;
    CDTimer.Enabled:=true;
  end;
end;

A.
0
 

Author Comment

by:spat
ID: 1340597
I almost got your code to work but it play about the first second and then stops.
what do think i should do?
0
 
LVL 2

Expert Comment

by:333
ID: 1340598
Set MP.TimeFormat to tfMilliseconds.
0
 

Author Comment

by:spat
ID: 1340599
it seems to work now but when you change tracks, it stops and you have to press play again.
0
 
LVL 2

Expert Comment

by:333
ID: 1340600
The problem is with this line:

if MP.Mode=mpPaused then MP.Resume;

The point is, that when you call MP.Pause, MP.Mode sets to mpStopped, not mpPaused.
You must add some variable (i.e PlayPressed:boolean), that indicates that Play button was pressed by user. Set PlayPressed to true, when user presses Play button. Set PlayPressed to false, when user presses Stop button. Then change the line to

if (MP.Mode=mpStopped) and PlayPressed then MP.Resume;

A.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
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…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

757 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