display then beep

Search this archive.

From: Joseph Miller (jmiller@eyes.arizona.edu)
Date: Mon 04 Sep 2000 - 09:36:42 IDT


Hello, kinda stuck here and could use a suggestion.

I am using svgalib to measure vision.  Little letters= good vision etc.
The test procedure is to blank the screen, have the speaker go beep, wait one half second, put up the letter for one second, then blank the screen again.  I am calling sleep() and usleep() fine, but am having trouble making the speaker go "beep".  I have tried using printf("\007"); but there is a BIG latency and it destroys the timing.

I am trying to use ioctl() to generate the tone.  However, I am having trouble getting the file descriptor for the speaker, and not being musically inclined, have no clue as to what tone I should generate.  500 hertz?  1000 hertz?

Is there a simpler way to sound a beep?????
I always exit, not getting a file descriptor, with the following code:

include <sys/ioctl.h>
include <fcntl.h>
int fd;
if ((fd = open("/dev/audio", O_RDONLY)) < 0){
    printf("couldn't get file descriptor for audio device");
    exit();
}
ioctl(fd, KDMKTONE, 0x000907ff);

I am using red hat version 6.1 and there are two audio devices
/dev/audio
/dev/audio1

any suggestions would be greatly appreciated.
thanks

joe





--
Joseph M Miller MD  University of Arizona
Associate Professor, Ophthalmology and Optical Sciences
655 North Alvernon Way Suite 108
Tucson AZ  85711
Voice 520-321-3677  Fax 520-321-3665  Home 520-742-9849
Primary email: jmiller@eyes.arizona.edu
Secondary email: millerjm@u.arizona.edu
--


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST