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.
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?
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Code:... case WM_KEYDOWN: if (wParam == 'S') ExitProcess(0); return 0; break; ...
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
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?
Last edited by Travis Dane; 01-06-2003 at 01:24 PM.
>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.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
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.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.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Or set the third parameter to SND_PURGE