PDA

View Full Version : CD-ROM unit problems



Allu
07-03-2007, 03:35 PM
I am building an Audio CD player in TP 7, and i am using an old Unit that i found on a website, it works OK but there is a little bug, it can't play the first track from the CD. I don't know what is the problem, tried everything but it will not play the first track :oops: can someone help me?

Here is the link to the Unit:

http://victim_of_bodom.t35.com/CDROM.PAS

and 2 examples:

uses CDROM;
Begin
cd_play(1,cd_track_length(1));
End. {playing the 1st track, NO sound, Nothing}



uses CDROM;
Begin
cd_play(2,cd_track_length(2));
End. {plays the 2nd track, works OK}

WILL
07-03-2007, 04:17 PM
First off, welcome to PGD! :)

That said... wow! TP7 huh? :scratch:

Curious, whats the platform your running this on?


Not being the type to suggest one's current tools of choice away, but... you might want to have a look at Free Pascal (http://www.freepascal.org/) as an alternative.

It's 'Turbo Pascal' compatible as far as language specifics go, but it also supports Windows, Linux and Mac OS X natively. And I believe that older versions support DOS if you have a specific need for it.

They even have a code repository for such units for things like CD-ROM playback. :)


You'll find that not many people (well noone anymore) use TP7 anymore as there are so many new compilers out there. Free Pascal, Delphi, Chrome, Lazarus, MIDletPascal, etc. Pascal has evolved. ;)

Allu
07-03-2007, 04:42 PM
I know, but this is a school project and i am limited to turbo pascal.
We use Free Pascal at school, but for this homework we are limited to Turbo Pascal 6 or 7 because our teacher is an "old-school programmer" :lol:

WILL
07-03-2007, 04:57 PM
Hmm... just a thought... have you tried using 0 as the first parameter?

Most arrays are 0-based. Meaning that the first element in that array is 0 not 1. So to cycle through it using a for loop you'd have to do the following:

for i := 0 to NumberOfItems - 1 do

How does this help you? Well it might be possible that the CD tracks are indexed in such a manner. So your first track would be 0 and your second is 1 and so on.