🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Sound (.wav) in VC++

Started by
12 comments, last by tom76 22 years, 7 months ago
How does sound work in VC++? What I mean is I''m playing with the donuts3D game off the sdk and decided to change the sounds. I replaced the .wav file with another one, and that didn''t work. I then changed the filename completely (say bangbang.wav to blownup.wav) and changed it all in the code itself, no errors etc., but when I play the game THE ORIGINAL SOUND (bangbang.wav) STILL PLAYS!!!!!!!! Even though there isn''t any other file named blownup.wav on my computer!!! Does VC++ store .wav files in hex format and generates them that way? I''ve seen hex relating to sound in the resources folder. HELP!!! "I envy you, who has seen it all" "And I, young sir, envy you, who have yet to see it for the first time..." - Daniel Glenfield 1st October 2001
if (witisism == !witty) return to_hole
Advertisement
Try deleting all object files. Basicly, anything that isn''t the main project file (don''t know how this works in VC++), or a file with ".h" ".cpp" ".rc" etc. Also try doing a resource build or a full build (again, I am not exactly sure how this works in VC)

ANDREW RUSSELL STUDIOS
Looking for my webpage? Funny that... Me too!
Resist nes8bit :: Bow Down to Linux Communisum
If you want to remove all intermediate files, select Clean from under the Build menu.

VC can occasionally be a bit arsey when changing resources - occasionally it will not register any amendments and so not rebuild the resource data. In this case, just change one of the resource properties ( ideally the name ), then change it back to the original.

The easiest way to change resources is to delete the original, remembering the resource ordinal name ( IDR_WAV_BANG ). Then, import the new resource and give it the same ordinal resource ID as the original.
I''ll give that a try - thanks!!!!

"I envy you, who has seen it all"
"And I, young sir, envy you, who have yet to see it for the first time..."
- Daniel Glenfield
1st October 2001
if (witisism == !witty) return to_hole
THANK YOU!!!!!!!!!!!!!!!!! I hit REBUILD ALL and it worked it''s magic. Thank you so much

Daniel

"I envy you, who has seen it all"
"And I, young sir, envy you, who have yet to see it for the first time..."
- Daniel Glenfield
1st October 2001
if (witisism == !witty) return to_hole
So how do they get the sound to work in that example? I tried to do something similar (using the dsutil stuff) in a simple direct draw app, except it would just play a .wav file when you hit the enter key. Nothing works, the code builds fine but the app doesn''t play any sound. I haven''t found any other examples of using dsound in this type of app (the only other examples are dialog based MFC Apps). Hoping to find an example of this, as opposed to spending too much time reinventing something that''s been done before?

"A man can''t just sit around." ''Lawn Chair'' Larry Walters (1982)
"A man can't just sit around." 'Lawn Chair' Larry Walters (1982)
Hmmm...not sure if I fully understand. Donuts uses the PlaySound function, which you can insert all over the place (it''s easy enough).
If you''re trying to put sound in, make sure it''s in the right part of the code. Maybe at the start of a function.

If that''s not helpful ask again lol

"I envy you, who has seen it all"
"And I, young sir, envy you, who have yet to see it for the first time..."
- Daniel Glenfield
1st October 2001
if (witisism == !witty) return to_hole
tom76-The version of that demo I''ve got uses DirectSound and dsutil.h, dsutil.c. After reading your post I looked up something in a book and saw an App that used PlaySound(). Couldn''t believe it was that simple! Why would I bother with DirectSound?

"A man can''t just sit around." ''Lawn Chair'' Larry Walters (1982)
"A man can't just sit around." 'Lawn Chair' Larry Walters (1982)
Ah yes, now I see.

"A man can''t just sit around." ''Lawn Chair'' Larry Walters (1982)
"A man can't just sit around." 'Lawn Chair' Larry Walters (1982)
Glad I could help - Now I''m having trouble with getting sounds to play!!!
I copied the source code across to a brand new project, but the sound won''t play (there are no errors reported, but the sound just doesn''t play). It''s annoying me very much!!!

"I envy you, who has seen it all"
"And I, young sir, envy you, who have yet to see it for the first time..."
- Daniel Glenfield
1st October 2001
if (witisism == !witty) return to_hole

This topic is closed to new replies.

Advertisement