[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

CD Trackbar Fast Forward

Posted on 1998-09-04
4
Medium Priority
?
265 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

649 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