Solved

Delphi4 CD Audio?

Posted on 1998-11-08
9
400 Views
Last Modified: 2010-04-04
How can I get the MediaPlayer component to play CD's without device errors? I've done this in Delphi 2 with no problem and have set the component up in the same way. Is it a bug or am I missing something new in D4?
0
Comment
Question by:xpher
  • 4
  • 4
9 Comments
 
LVL 4

Expert Comment

by:BoRiS
ID: 1346131
xpher

Let us see the code you using, we can track it down form there...

Later
BoRiS
0
 
LVL 1

Author Comment

by:xpher
ID: 1346132
I'm not actually adding code. all I am doing is placing a MediaPlayer component on the form and using the object inspector to set DeviceType to CDAudio, AutoOpen to True.

In Delphi 2 this worked. In 4 I can only get it to work if I put something like Track01.cda in the Filename of the Object Inspector.

Regards
Chris.
0
 
LVL 2

Expert Comment

by:333
ID: 1346133
Hi,
I think there is a some bug in MPlayer unit. I have this problem also. When DeviceType is set to CDAudio and I try to open, exception is raised. The same code on Delphi3 & 2 works perfect. I try to copy Open procedure code from Delphi4 mplayer.pas into my program. When i try to execute only this procedure, the exception was raised. Then I copy Open procedure code from Delphi3 mplayer.pas. Everything was OK.
So I think problem is in one missing line:

if FElementName <> '' then {<-- this line is missing in D4}
 OpenParm.lpstrElementName := PChar(FElementName);

There is one line that was changed in D4:

if FElementName <> '' then FFlags := FFlags or mci_Open_Element; {<-- D3 line}
FFlags := FFlags or mci_Open_Element; {<-- D4 line}

So, FElementName is something like file name (i'm not sure). If you change this two lines in D4 mplayer.pas, everything should be ok. At least it works by me.

A.
0
 
LVL 1

Author Comment

by:xpher
ID: 1346134
333

I'm new to this so find things a bit difficult to follow. I think I found the right parts to change but it doesn't seem to make a difference. Am I supposed to recompile or some other such frightening action?

A little more assistance would be greatly appreciated.

Regards
Chris :)
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!

 
LVL 2

Expert Comment

by:333
ID: 1346135
xpher,
sure, you must recompile component.
I did it so:
1. Choose 'New Application' from menu.
2. Click 'Add to project' and choose mplayer.pas from Delphi's source directory.
3. Make changes in mplayer.pas and compile project.
4. Now, in source directory (where was mplayer.pas) should be file mplayer.dcu.
5. Close Delphi and copy file mplayer.dcu to \LIB. You can make a backup copy of old mplayer.dcu
6. That's all. Start Delphi.

A.
0
 
LVL 1

Author Comment

by:xpher
ID: 1346136
333

Perfect. It worked like a treat.
Do you want to send as answer so I can assign the points.

Regards
Chris :))
0
 
LVL 2

Accepted Solution

by:
333 earned 20 total points
ID: 1346137
Hi,
       I think there is a some bug in MPlayer unit. I have this problem also. When DeviceType is set to CDAudio and I try to open,
       exception is raised. The same code on Delphi3 & 2 works perfect. I try to copy Open procedure code from Delphi4
       mplayer.pas into my program. When i try to execute only this procedure, the exception was raised. Then I copy Open procedure
       code from Delphi3 mplayer.pas. Everything was OK.
       So I think problem is in one missing line:

       if FElementName <> '' then {<-- this line is missing in D4}
        OpenParm.lpstrElementName := PChar(FElementName);

       There is one line that was changed in D4:

       if FElementName <> '' then FFlags := FFlags or mci_Open_Element; {<-- D3 line}
       FFlags := FFlags or mci_Open_Element; {<-- D4 line}

       So, FElementName is something like file name (i'm not sure). If you change this two lines in D4 mplayer.pas, everything should
       be ok. At least it works by me.

       A.
:)
0
 
LVL 1

Author Comment

by:xpher
ID: 1346138
333

Many thanks.

I don't suppose you have had the problem of dispaying first frame of avi have you? I've foolowed instructions on this but it just flashes on and disappears.

Regards
Chris :)
0
 
LVL 2

Expert Comment

by:333
ID: 1346139
Sorry, but I never worked with avi, so i don't know.

A.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

708 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

18 Experts available now in Live!

Get 1:1 Help Now