?
Solved

Delphi4 CD Audio?

Posted on 1998-11-08
9
Medium Priority
?
416 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
[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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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 80 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
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