Pages: [1]
  Print  
Author Topic: How to Play Sounds  (Read 2581 times)
Offline (Male) RetroX
Posted on: February 20, 2009, 07:33:29 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Play Sound:
cpp { PlaySound(soundstr,NULL,SND_FILENAME | SND_ASYNC); }
Where soundstr is the relative path to the WAV sound.

Loop Sound:
cpp { PlaySound(soundstr,NULL,SND_FILENAME | SND_LOOP | SND_ASYNC); }

Stop Sound:
cpp { PlaySound(NULL,0,0); }

Won't allow you to play more than one sound at once, but this works for now.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #1 Posted on: February 20, 2009, 09:28:04 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
That's a relatively small WinApi hack, but whatever makes you happy, I suppose. I'm going with OpenAL, when the time comes. Either way, nice find.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #2 Posted on: February 20, 2009, 09:32:22 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Never mind, it doesn't work. >_>
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: February 20, 2009, 09:45:50 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
Hahaha.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) score_under
Reply #4 Posted on: February 22, 2009, 09:33:29 AM

Member
Joined: Aug 2008
Posts: 308

View Profile
http://www.gamedev.net/reference/articles/article2053.asp <-- *Will* allow you to play multiple sounds
There you go. Another silly Win32 API thing, but it should work.

EDIT: Ahaha, needs a lib.
If you've scrolled down to here, rejoice! You've scrolled to the right place!
Find "CompileEGMF.exe" in your enigma folder, rename it (so that it's all backed up and you can't hold me responsible if anything goes wrong), then paste the files from this zip into the folder:
http://dl.getdropbox.com/u/518733/thing.zip
Hey presto! You now have a version of CompileEGMF that will compile your C++ multimedia code!
« Last Edit: February 22, 2009, 02:01:39 PM by score_under » Logged
Offline (Male) Josh @ Dreamland
Reply #5 Posted on: April 21, 2009, 05:23:07 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2946

View Profile Email
Now do it with OpenAL.
Oh right, that's my job.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: [1]
  Print