Greetings fellow coders,
I am using the Playsound() function for playing music or sounds in my console based C++ application. I have a few brief questions that I need answered before I can continue.

1. When using the Playsound() function, how do you set the volume level?

2. How do you get the project to continue while playing the sound, (It currently waits for the wav file to stop)?

3. How do you stop the wav prematurely?

4. What are some other useful string to add for RPG based coding?

5. What do the strings I have defined do?

Current string: PlaySound(TEXT("test.wav"), NULL, SND_ALIAS | SND_APPLICATION); Other information using namespace std ; I am using Visual C++ 2005, and Namespace as shown.
My code is very large and very complicated and I do not wish to upload it. I appreciate any help you may provide, but remember I am a basic coder and I do not know much C++ beyond namespace or the basics. Thank you for your time, -Keith

Hey,

1. You cannot set the volume from PlaySound(), You will have to find another way to control the Windows Mixer API. The best reference (by my humble opinion) is: http://www.qsl.net/i2phd/mixer/index.html

2. To get the PlaySound() to return instantly, the parameter "SND_ASYNC" must be used.

3. To stop the playing sound call the PlaySound(NULL, 0, 0) - This is for "one sound playing at the time" purposes only, for controlling individual stop of several files, the handle must be used.

4. & 5. Look in reference: http://msdn.microsoft.com/en-us/library/ms712879.aspx for details of all PlaySound() parameters.

Greetings & Salutations
Martin Skibye

commented: A bit late, but that's a damn good answer for a first post :) +17
commented: Good response, good references. Great start here at DaniWeb +9
commented: Good info +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.