Solved

Delphi4 CD Audio?

Posted on 1998-11-08
9
404 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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