Solved

*.wav file NOT playing in TMediaPlayer

Posted on 2004-04-28
6
1,378 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

20 Experts available now in Live!

Get 1:1 Help Now