[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Audio programming..
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Audio programming..
- From: CyberPsychotic <mlists_(_at_)_gizmo_(_dot_)_kyrnet_(_dot_)_kg>
- Date: Fri, 12 Nov 1999 17:08:34 +0500 (KGT)
- Cc: sparc_(_at_)_openbsd_(_dot_)_org
- Reply-to: fygrave_(_at_)_tigerteam_(_dot_)_net
Hello people,
I am abit stuck with getting my sun4m boxen to record anything
from /dev/audio0. Based on audio(4), I crafted some code to test stuff:
#include <sys/types.h>
#include <sys/audioio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#define DEVICE "/dev/audio"
#define BUFSIZE 1024
int main(void) {
unsigned char buf[BUFSIZE];
audio_info_t ai;
int fd;
int n;
if((fd=open(DEVICE,O_RDONLY))<0) {
perror("open");
return -1;
}
AUDIO_INITINFO(&ai);
ai.mode=AUMODE_PLAY_ALL;
if(ioctl(fd,AUDIO_SETINFO,&ai)<0) {
perror("ioctl");
close(fd);
return -1;
}
if ((n=read(fd,buf,BUFSIZE))<0) {
perror("read");
close(fd);
return -1;
}
printf("Read %i bytes\n",n);
close(fd);
return 0;
}
However on read here I fail with `device is not configured' error. Any
hints what's wrong? (yeah, I can play kernel with cat /bsd > /dev/audio :))
here's head of my audioctl and relevant dmesg stuff:
name=SUNW,CS4231
version=a
config=onboard1
encodings=mulaw:8,alaw:8,slinear_le:16,ulinear:8,slinear_be:16,slinear:8*,ulinear_le:16*,ulinear_be:16*,adpcm:8
properties=full_duplex
...
~ 2.6 (GENERIC) #287: Thu Oct 21 23:31:48 MDT 1999
~ deraadt_(_at_)_sun4m_(_dot_)_openbsd_(_dot_)_org:/usr/src/sys/arch/sparc/compile/GENERIC
..
~ audiocs0 at sbus0 slot 4 offset 0xc000000 pri 9, softpri 4
~ audio0 at audiocs0
regards
Fyodor
Visit your host, monkey.org