[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1414
  • Last Modified:

*.wav file NOT playing in TMediaPlayer

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
dbetts
Asked:
dbetts
  • 4
  • 2
1 Solution
 
shaneholmesCommented:

   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
 
shaneholmesCommented:
PlaySound( 'filename.wav', 0, snd_Async);

Shane
0
 
shaneholmesCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dbettsAuthor Commented:
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
 
shaneholmesCommented:
maybe ints a volume issue now... with in delphi... try setting the volumn by code...

Shane
0
 
dbettsAuthor Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now