Solved

*.wav file NOT playing in TMediaPlayer

Posted on 2004-04-28
6
1,385 Views
Last Modified: 2008-01-16
In my Delphi 7 app, I download a *.wav file from the internet by creating a file stream and writing the file to that.  All works well.  I can then open the file in "Windows Media Player 8.00.00.4487" and it plays just fine.

However, If I attempt to play the file in the Delphi TMediaPlayer (which is what I need to do), I get an error every time that says: "raised exception class EMCIDeviceError with message 'No wave device is installed that can play files in the current format.  To install a wave device, go to Control Panel, click Printers and Other Hardware, and then click Add Hardware.'.

Well, if the Windows Media Player can play it, why can't Delphi's TMediaPlayer?  I would assume that both players have access to the same codecs, do they not?

Can someone tell me how I might remedy this problem in such a way that the application can be released to the masses?

Thanks,
Derrick
0
Comment
Question by:dbetts
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10942990

   forget the Mediaplayer  there is an API
function called PlaySound which will play the wave for you directly ANd
allow you to play it from memory rather than disk

 if you choose to...
                               
Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10943016
PlaySound( 'filename.wav', 0, snd_Async);

Shane
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 125 total points
ID: 10943041
oh yeah, make sure if you use PlaySound, you add MMSystem to your uses clause...


If would try it to see if it plays that wav file... if it does than try testing it again with TMedia Player



    Media.DeviceType := dtWaveAudio;
    Media.FileName := <wav file>;  {include path if necessary}
    Media.Open;
    Media.Play;

Shane
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:dbetts
ID: 10944031
Thanks Shane.

The problem was with the DeviceType.  I has it set to Auto and apparently the *.wav file didn't have proper header info to tell the TMediaPlayer what type it was.

I changed that, but now I cannot hear the wav file.  I have tried it with the PlaySound function you suggested and the TMediaPlayer.  Neither produces the sound.

I no longer have any troubles opening the file, I just can't hear it.

If I open the file in Windows Media Player, I can hear it just fine.

Any ideas?

Derrick
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10944062
maybe ints a volume issue now... with in delphi... try setting the volumn by code...

Shane
0
 

Author Comment

by:dbetts
ID: 10945275
Thanks.

As it turns out it was a problem with the *.wav files that were being created.  Delphi couldn't play them, but Windows Media PLayer could.

We have notified the vendor and it is being resolved.

Thanks Shane,
Derrick
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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