Solved

Edit Play List

Posted on 1998-09-22
8
146 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
 
LVL 5

Expert Comment

by:ronit051397
ID: 1340595
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 2

Accepted Solution

by:
333 earned 80 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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…

831 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