Click to See Complete Forum and Search --> : c++ beeps
jpersons
11-13-2001, 03:35 PM
I've written part of a c++ program to help me learn morse code, but I'd really like to include a portion that gives the code in audible format. How can I get sound in c++? All i need is a short and long sound. I'm using Red Hat and the GNU c++ compiler.
Energon
11-13-2001, 04:26 PM
the \a escape character will give you a small beep... maybe not what you're looking for... just a short tone from the system bell...
jpersons
11-14-2001, 12:05 AM
Thanks... I was wondering that too. I need to figure out how to change the length of the noises coming from the speaker. In basic I remember you could specify the length and frequency of the sound. I really don't care too much about frequency; I'd just like to change the length of the sounds. Anyone know how to do something like this in c++? ...using libraries that come with linux please :)
Energon
11-14-2001, 12:44 AM
This may be a bit overboard, but if you run KDE, in the "control panel" is a setting to modify the system bell... if you can get ahold of some KDE sources and figure out where that happens at in it, you can see one method of how to do it..
pinoy
11-14-2001, 03:55 AM
There are some ioctls to manipulate the PC speaker. grep the kernel source for KIOCSOUND. I'm not on a Linux box, so I can't provide some source.
Otherwise this actually involves manipulating the 8254 timer (I used to do this a lot in DOS, but can't remember how).
jpersons
11-15-2001, 01:43 PM
Does anyone have any easier methods???
pinoy
11-15-2001, 04:12 PM
The ioctl is easy. I just did a search for KIOCSOUND on google and got this: http://www2.linuxjournal.com/lj-issues/issue3/2783.html
jpersons
11-15-2001, 11:02 PM
Thanks pinoy. By the way... I grew up in pinoy land. Born in Manila, raised in Pangasinan, and went to boarding school in Cainta. Sorry you had to leave man :) The Philippines rocks. Now I'm stuck back in the States again.
pinoy
11-16-2001, 05:52 AM
jpersons, nice to know a fellow 'pinoy' here. I'm from Cebu myself. Yeah, I miss it but nevermind. Let me know how you get on with your sound stuff. I can provide source if I have to.