Solved

Edit Play List

Posted on 1998-09-22
8
140 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
Comment Utility
I really don't know.
0
 
LVL 10

Expert Comment

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

ReGaRdS,
ViKtOr IvAnOv
0
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
0
 
LVL 2

Accepted Solution

by:
333 earned 80 total points
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:spat
Comment Utility
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
Comment Utility
Set MP.TimeFormat to tfMilliseconds.
0
 

Author Comment

by:spat
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now