Play wave files

Hello all,
How can I play some sounds without actually creating and using wave files in disk?
I tried to pack the wave files together with the EXE.  However, when I need to use them, I have to write the wave files to disk first and load them afterwards.
In other words, how can I play wave files without the involvement of the disk at all.

Thanks in advance.

PS. I can't use third-party components due to some reasons.
nytAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Mohammed NasmanConnect With a Mentor Software DeveloperCommented:
Hello

  Read this article, I think it will be useful for you

Inside the EXE
http://delphi.about.com/library/weekly/aa021301a.htm

Mohammed
0
 
TheNeilCommented:
Can you stream your WAV data into a TMemoryStream? You can then play them from there like this:

VAR
  wave : TMemoryStream;
...
  wave := TmemoryStream.Create;
...
  sndPlaySound(wave.Memory, snd_Memory + snd_Sync);
  wave.Free;

You'll need to get the data into the memorystream but the above code will play that no problem (just make sure you have mmSystem in your uses clause)

The Neil =:)
0
 
nytAuthor Commented:
Great...the webpage shows the way step by step.  I got it work easily.
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.