Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lucasdg

Wave Resources in VC

This topic is 6651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am just delving into the mysteries of resources and I need help with playing a .wav file using PlaySound or sndPlaySound from a resource. At the moment, I have a "WAVE" resource with the ID of EXIT_WAV (101). This is what I''m doing: PlaySound(EXIT_WAV, hinstance, SND_RESOURCE | SND_SYNC); i''ve also tried: PlaySound(MAKEINTRESOURCE(EXIT_WAV), hinstance, SND_RESOURCE | SND_SYNC); and numerous other things but I can''t get it to do. I''ve also looked through MSDN and the help gave me no plausable solution except for quite a nice function but it wouldn''t compile because it refers to hinstance, which is in WinMain. I would appreciate someone taking me through it all as I can''t find a solution. btw, I have no problem with PlaySound from a file. Thankyou, Lucas

Share this post


Link to post
Share on other sites
Advertisement
I don''t have the books handy to help you out much, but off the top of my head here are a few tidbits.

1. Be careful about this issue - some areas of the documentation use the three letter "WAV" resource and some use the four letter "WAVE". I cannot remember which version is used correctly by which functions, etc, but I do remember reading from either the "Visual C++ Programmers Guide" or "Inside DirectX" that the DEFAULT letter code given by either VC 5 or VC6 is the WRONG ONE, and will want to change it after creating the resource.

2. Look in the include directories or the DirectX SDK for two files, "Wave.h" and "Wave.c" they proved very helpfull with dealing with WAV files (not resources, but I''m not sure right now if they cover that too).

I just reread that you had no problem with file playback, so I''m thinking your trouble is either related to area #1 (WAV vs. WAVE) or it might be related to the area you attempted to solve with MAKEINTRESOURCE ... once again, without my code I cannot remember the nasty details of resource access, but on Tuesday (if you are still having trouble I can look at my source code).

Good Luck.

Share this post


Link to post
Share on other sites
Thanks for the quick reply.

I have looked through WAVE.C but I didn''t find anything useful...they were basically the same as PlaySound.

I am using VC6 and that calls wavs "WAVE" (in the inverted commas) and treats it as binary. I have given it the ID of EXIT_WAV and I assume that is its ''name'' but I am not too sure.
What''s this default letter code you speak of? I have no idea how to change what ''it'' is.

I would appreciate if you could repost the source code you spoke about. Also, if you have the time I would be interested in how to attach menus to windows because I can create them but I can''t get them up and running

Thanx for your time.
Lucas

Share this post


Link to post
Share on other sites
Xai: I''m still having trouble so I would very much appreciate the source or some additional help.

Thnakyou.
Lucas

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!