PDL-Audio
view release on metacpan or search on metacpan
sndlib/audio.c view on Meta::CPAN
static char *audio_error_name_1(int err)
{
switch (err)
{
case SNDLIB_NO_ERROR: return(""); break;
case SNDLIB_CHANNELS_NOT_AVAILABLE: return("channel(s) not available"); break;
case SNDLIB_SRATE_NOT_AVAILABLE: return("srate not available"); break;
case SNDLIB_FORMAT_NOT_AVAILABLE: return("format not available"); break;
case SNDLIB_NO_INPUT_AVAILABLE: return("no input available"); break;
case SNDLIB_NO_OUTPUT_AVAILABLE: return("no output available"); break;
case SNDLIB_INPUT_BUSY: return("input busy"); break;
case SNDLIB_OUTPUT_BUSY: return("output busy"); break;
case SNDLIB_CONFIGURATION_NOT_AVAILABLE: return("configuration not available"); break;
case SNDLIB_INPUT_CLOSED: return("input closed"); break;
case SNDLIB_OUTPUT_CLOSED: return("output closed"); break;
case SNDLIB_IO_INTERRUPTED: return("io interrupted"); break;
case SNDLIB_NO_LINES_AVAILABLE: return("no lines available"); break;
case SNDLIB_WRITE_ERROR: return("write error"); break;
case SNDLIB_SIZE_NOT_AVAILABLE: return("size not available"); break;
case SNDLIB_DEVICE_NOT_AVAILABLE: return("device not available"); break;
case SNDLIB_CANT_CLOSE: return("close failed"); break;
case SNDLIB_CANT_OPEN: return("open failed"); break;
sndlib/audio.c view on Meta::CPAN
* find volume field, if none, go on, else read current volume
* open next unchecked dsp, try to set volume, read current, if different we found a match -- set and go on.
* if no change, move to next dsp and try again, if no more dsps, quit (checking for null case as before)
*/
sprintf(dname,"%s%d",MIXER_NAME,nmix);
md = open(dname,O_RDWR|O_NONBLOCK,0);
if (md == -1)
{
if (errno == EBUSY)
{
fprintf(stderr,"%s is busy: can't access it",dname);
nmix++;
continue;
}
else break;
}
sprintf(dname,"%s%d",DAC_NAME,ndsp);
fd = open(dname,O_RDWR|O_NONBLOCK,0);
if (fd == -1) fd = open(dname,O_RDONLY|O_NONBLOCK,0);
if (fd == -1) fd = open(dname,O_WRONLY|O_NONBLOCK,0); /* some output devices need this */
if (fd == -1)
{
close(md);
if (errno == EBUSY) /* in linux /usr/include/asm/errno.h */
{
fprintf(stderr,"%s is busy: can't access it\n",dname);
ndsp++;
continue;
}
else
{
if (errno != ENXIO && errno != ENODEV)
fprintf(stderr,"%s: %s! ",dname,strerror(errno));
break;
}
}
sndlib/audio.c view on Meta::CPAN
}
int initialize_audio(void) {AUDIO_ERROR = SNDLIB_NO_ERROR; return(0);}
char *audio_error_name(int err) {return(audio_error_name_1(err));}
int audio_systems(void) {return(1);}
char *audio_system_name(int system) {return("HPUX");}
/* struct audio_status status_b;
* ioctl(devAudio, AUDIO_GET_STATUS, &status_b)
* not_busy = (status_b.transmit_status == AUDIO_DONE);
*/
int open_audio_input(int ur_dev, int srate, int chans, int format, int size)
{
int fd,i,dev;
struct audio_describe desc;
AUDIO_ERROR = SNDLIB_NO_ERROR;
dev = SNDLIB_DEVICE(ur_dev);
fd = open("/dev/audio",O_RDWR);
if (fd == -1) {AUDIO_ERROR = SNDLIB_CANT_OPEN; return(-1);}
( run in 0.320 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )