Solved

Delphi4 CD Audio?

Posted on 1998-11-08
9
403 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
TVirtualStringTree  search using TEdit 7 106
my delphi exe application have  problem with windows explorer ! 12 80
code issue 8 100
Strange behavior when a form is closed 6 51
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…
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…
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…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

17 Experts available now in Live!

Get 1:1 Help Now