I tried to use this method as a really lightweight way to play a .wav file, but it didn't work, it still played what sounded like the copy sound. any idea what I'm doing wrong?
void playAudio()
{
if (!quiet){
printf("Playing %s
",fname);
}
// o.k. this is sneaky!
// rename the current file to the sound file
// play it
// rename it back!
if (rename( SOUND_FILE, SOUND_FILE".bak")==0){
if(symlink( fname, SOUND_FILE)==0){
playIt();
usleep(500); // give it a chance...
unlink(SOUND_FILE);
}
rename( SOUND_FILE".bak", SOUND_FILE);
}
}
void playIt()
{
int fd;
int buf;
if (-1 == (fd = open("/dev/bleep", 2)))
{
if (!quiet){
printf("Error: bleep not running
");
}
return;
}
buf[0] = 0;
buf = 2; // the copy sound
write(fd, buf, 8);
close(fd);
}
http://www.bloodyeck.com/projects/audrey/