[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: audio recording question - audioio.h
Akos Maroy wrote:
> I'm trying to port my project, darkice (darkice.sf.net) to OpenBSD.
> I'm encountering a problem though. I open the audio device in
> read-only mode, configure it with the appropriate settings, but then
> it blocks when I try to read. It seems that recording itself does not
> Basically here's what I'm doing:
> int fileDescriptor;
> audio_info_t audioInfo;
> void * buf;
> unsigned int len;
> ssize_t ret;
> fileDescriptor = open( fileName, O_RDONLY);
> AUDIO_INITINFO( &audioInfo);
> audioInfo.record.sample_rate = getSampleRate();
> audioInfo.record.channels = getChannel();
> audioInfo.record.precision = getBitsPerSample();
> audioInfo.record.encoding = AUDIO_ENCODING_LINEAR;
> ioctl( fileDescriptor, AUDIO_SETINFO, &audioInfo);
> // buf and len have some proper values
> ret = read( fileDescriptor, buf, len);
> and the code blocks on the call to read(). if I set it to non-blocking
> mode (O_NONBLOCK at open()), I get a -1 in return.
> What am I doing wrong?
Do you ignore "interupted by system calls error" (EINTR) on your
non-blocking read ?
This typically happens when using select on non-blocking IO.