Solved

CD Trackbar Fast Forward

Posted on 1998-09-04
4
261 Views
Last Modified: 2010-05-18
Hello,
How would i use a track bar to fast forward through a cd track. I would like to have a trackbar and when you move it it fast forwards porportionaly through the cd track.
Thanks  
0
Comment
Question by:spat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1338662
Hi,
First place a TMediaPlayer on a form and adjust its setting(I am sure you have already done this). Then all we have to do is to be able to SEEK to a specified position. In this we should set our positioning system. i.e. we may measure the media as minutes, tracks, seconds etc...Here is a procedure for seeking specified track, minute,second(add MMSystem to your 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;

This is a very general routine as you see...Just before playing we should measure the tracks and setup our trackbar accordingly as follows(you should set up and open MediaPlayer1 as properly before)

..
medialplayer1.TimeFormat := tfTMSF;
trackbar1.min := 0;
trackbar1.max := mci_TMSF_Track(mediaplayer1.endpos); //extract number of tracks
.
Now in trackbar1change method do the following:

procedure TForm1.trackbar1change(sender:tobject);
begin
  mediaplayer1.pause;
  seektotrack(mediaplayer1,trackbar1.position,0,0); //seek to begining of the track
  mediaplayer1.play;
end;

Regards, Igor
end;
0
 

Author Comment

by:spat
ID: 1338663
Hello again,
I could only get your code to seek from track to track. What i want it to do is to seek through the contents of an already playing track (going trom 2:45 to 2:50) using the track bar.
Thanks  
0
 
LVL 5

Accepted Solution

by:
inter earned 200 total points
ID: 1338664
Hi,
It is also easy man watch the following:

The media players tracklength array gives the length of tracks in specified units. So after seeking to a specified track as above we can setup our trackbar as follows:

// say you have your trackno in TrackNo
medialplayer1.TimeFormat := tfTMSF;
trackbar1.min := 0;
// express trackbar scale as seconds
with mediaplayer1 do
  trackbar1.max := mci_TMSF_Minute(tracklength(TrackNo))*60+ mci_TMSF_Second(tracklength(TrackNo));
//now we setup our track bar on the second basis

NOW IN THE TRACKBAR CHANGE CODE

 mediaplayer1.pause;
//seek to given TrackNo and minute second
 seektotrack(mediaplayer1,TrackNo,trackbar1.position div 60,trackbar.position mod 60,0);
 mediaplayer1.play;

Regards, Igor
0
 

Author Comment

by:spat
ID: 1338665
thank you this helped alot
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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