There is another way to make a sound, quite simple, you load a wave file and play it:
// play a wave file sound using the winmm library // For DevCpp add the library libwinmm.a to linker via // Project/Project Options/Parameters/Add Library // remember this is a console program! #include <iostream> #include <windows.h> // for PlaySound() #define SND_FILENAME 0x20000 #define SND_LOOP 8 #define SND_ASYNC 1 using namespace std; int main() { // play sound as loop (remove SND_LOOP for one time play) // file boing.wav has be in the working directory PlaySound("boing.wav",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC); cin.get(); // wait return 0; }
Will this work even in C while i use a turbo or borland C compiler. If it does where do i get the winmm library?