Hello everyone,
I am trying to write a little program that allow me to get an audible signal or alert from the internal PC speaker, not the sound card.
I'm new to C++, but I remember doing this in Turbo Pascal a long time ago. I was able to select the frequency or pitch, and set the length. I remember being able to compose little songs, with the proper loops. Can this be done in C++. I'm working with Borland C++ Builder 5 in windows, and also in the built-in compilers in Unix - SunOS.
I searched through all the posts, and all I came up with is the following code that allows you to include a wave file, but doesn't help me with the internal speaker thing:
Thanks in advance,
-Kosta
I am trying to write a little program that allow me to get an audible signal or alert from the internal PC speaker, not the sound card.
I'm new to C++, but I remember doing this in Turbo Pascal a long time ago. I was able to select the frequency or pitch, and set the length. I remember being able to compose little songs, with the proper loops. Can this be done in C++. I'm working with Borland C++ Builder 5 in windows, and also in the built-in compilers in Unix - SunOS.
I searched through all the posts, and all I came up with is the following code that allows you to include a wave file, but doesn't help me with the internal speaker thing:
Code:
#include <windows.h>
int main(void) {
PSZ lpszFileName = "c:\\windows\\media\\lockdown.wav";
char lpszCmd[512];
wsprintf(lpszCmd, "open %s type waveaudio alias wave wait", lpszFileName);
mciSendString(lpszCmd, NULL, 0, 0);
wsprintf(lpszCmd, "play wave wait");
mciSendString(lpszCmd, NULL, 0, 0);
wsprintf(lpszCmd, "close wave");
mciSendString(lpszCmd, NULL, 0, 0);
}
Thanks in advance,
-Kosta