Mail Archives: djgpp/1999/09/07/15:03:15
Graeme Fenwick writes:
> As part of a basic (note lack of capitalization ;-) sound generating
program
> I'm thinking of designing, I'd like to be able to playback the sounds as
> soon as they're made. However, I'm not sure how to do this, as I can't get
> enough out of the existing documentation. Audiostreams look like my best
bet
> in this direction, but what format is the audiostream meant to be in?
Audiostreams are very much the best way to do this: it is exactly the
situation they were designed for! And as it happens, the audiostream
example program (ex28.c, or exstream.c if you have a recent WIP
version) does almost exactly what you are needing: it generates a
simple sawtooth wave with a gradually increasing pitch, feeding the
data to the soundcard as it is produced.
As for the format of the data, it is just a list of sample values,
either 8 bit (chars) or 16 bit (shorts) depending on what type of
stream you created. If it is a stereo stream, the samples come in
pairs, one for the left speaker and then another for the right.
Shawn Hargreaves.
- Raw text -