i want music to play in the background of my program which i have, but i want the music to stop when they press 's'. how can i do this.
Printable View
i want music to play in the background of my program which i have, but i want the music to stop when they press 's'. how can i do this.
Could you be a little less specific, please? :confused:
Code:...
case WM_KEYDOWN:
if (wParam == 'S')
ExitProcess(0);
return 0;
break;
...
What kind of program are you using? (Console,Win32)
What compiler are you using? (Dev,MSVC,Borland)
What kind of music do you want to play? (wav,mp3)
[edit]
By the way, what has the title got to do with your
question?
>By the way, what has the title got to do with your
question?
I think he wants to use a boolean value to control whether the music is playing or not.
But, as was mentioned previously, we need to know what platform, compiler, and music type you are using.
We actually don't need to know the music type he is using, but we do need to know the platform. He wants to stop sending music to the soundcard when 's' is pressed.Quote:
But, as was mentioned previously, we need to know what platform, compiler, and music type you are using.
So rderiu, what platform are you using and how are you driving your soundcard?
im using visual C++ and i want to use a bool function to turn the sound oof i am using PlaySound to play the .wav file. i want it so when u press 'p' the bool function becomes false and the sound stops.
>bool function
Ah, you mean a toggle function, you want to be able to toggle the sound on or off using that function. If you're using Visual C++, you can use the Win32 API functions for handling wave devices. Take a look at MSDN and look for Waveform Functions.
http://msdn.microsoft.com/
There are function waveOutPause stops the playing for a while and waveOutRestart resumes the playing.
If you call PlaySound with the first(?) parameter as NULL, it will stop all sounds currently playing.
Or set the third parameter to SND_PURGE