Sign in with
Sign up | Sign in
Your question

How to send the cpu sound to my speakers in a c program?

Last response: in Applications
Share
June 18, 2011 9:20:50 AM

Hi I am using sound function to generate sounds of certain frequencies.
The sounds generated re coming out from the cpu.
i want them to come out from speakers.
Please suggest me how to do the same.

Here is the code:

#include<iostream.h>
#include
#include<conio.h>
void main()
{
sound(240);
getch();
nosound();
sound(270);
getch();
nosound();sound(300);
getch();
nosound();sound(320);
getch();
nosound();sound(360);
getch();
nosound();sound(400);
getch();
nosound();sound(450);
getch();
nosound();
sound(480);
getch();
nosound();

return;
}
a b L Programming
June 20, 2011 8:50:00 AM

By from the CPU I'm guessing you mean it's coming from the motherboard speaker. You're trying to get sound to be emitted by your onboard sound device or via your soundcard.

I don't know the C in question but you probably need to get a handle on the sound device and call the appropriate function by their API.
m
0
l
Related resources
!