PDA

View Full Version : adding sound in program??



abhilashm86
June 15th, 2009, 04:07 PM
actually i've done a program that has transformations like rotation and translation in opengl, its a small aircraft, so i want to add sound, where to start and which are formats of audio it can recognise??
also can we achieve sound in c++, just for curiosity?? how to do it??

Krupski
June 15th, 2009, 04:33 PM
actually i've done a program that has transformations like rotation and translation in opengl, its a small aircraft, so i want to add sound, where to start and which are formats of audio it can recognise??
also can we achieve sound in c++, just for curiosity?? how to do it??

You could write to the /dev/dsp device (the sound card).

This page (LINK (http://www.oreilly.de/catalog/multilinux/excerpt/ch14-05.htm)) should give you enough information to get started and use the /dev/dsp device.

-- Roger

nvteighen
June 15th, 2009, 08:28 PM
I guess you can use libogg, libsndfile or some other library to load a pre-recorded file rather than feeding data directly to the sound card... :p

Krupski
June 16th, 2009, 05:13 PM
I guess you can use libogg, libsndfile or some other library to load a pre-recorded file rather than feeding data directly to the sound card... :p

The reason I mentioned /dev/dsp was that I made a DTMF generator program (to dial telephone tones) in C. And, it generates the tones on the fly into a buffer. Frankly, I wouldn't know how to do it any other way BUT to use /dev/dsp..