Quote:
Originally Posted by geekmaster
//============================
// sndplay - play sound buffer
// this plays until we kill it
//----------------------------
void sndplay(void) {
unsigned char buf[1024]; // play buffer
snd_pcm_sframes_t fc; // frame count
unsigned int i,j;
for (i=0;;i++) { // forever
for (j=0;j<sizeof(buf);j++) buf[j]=(random()&3)*i*350;
fc=snd_pcm_writei(hp,buf,sizeof(buf)); // play buffer
if (fc<0) fc=snd_pcm_recover(hp,fc,0); // error recovery
}
}
|
HEH! I love it! Brilliant