/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1989-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file contains routines to read and write the audio device state.
*/
#include <errno.h>
#include <stropts.h>
#include <libaudio_impl.h>
#include <audio_errno.h>
#include <audio_hdr.h>
#include <audio_device.h>
/*
* Get device information structure.
*/
int
{
return (AUDIO_UNIXERROR);
} else {
return (AUDIO_SUCCESS);
}
}
/*
* Set device information structure.
* The calling routine should use AUDIO_INITINFO prior to setting new values.
*/
int
{
return (AUDIO_UNIXERROR);
} else {
return (AUDIO_SUCCESS);
}
}
/*
* Return an Audio_hdr corresponding to the encoding configuration
* of the audio device on 'fd'.
*/
int
{
int err;
if (which & AUDIO__PLAY)
else if (which & AUDIO__RECORD)
else
return (AUDIO_ERR_BADARG);
if (which & AUDIO__SET) {
} else {
}
/* Decode back into the header structure */
/* since the I_SMSG is set, upon completion of updating */
/* the format, the driver sends the msg so the */
/* system call is interrupted. For now, just ignore this */
case AUDIO_ENCODING_ULAW:
case AUDIO_ENCODING_ALAW:
case AUDIO_ENCODING_LINEAR:
case AUDIO_ENCODING_LINEAR8:
case AUDIO_ENCODING_FLOAT:
break;
default:
return (AUDIO_ERR_ENCODING);
}
if (which & AUDIO__SET) {
/* Check to see if *all* changes took effect */
return (AUDIO_ERR_NOEFFECT);
}
}
return (err);
}
/*
* Attempt to configure the audio device to match a particular encoding.
*/
/*
* This routine is generally invoked by using the audio_set_*()
* and audio_get_*() macros.
* The 'valp' argument is always a pointer to an unsigned int.
*/
int
{
int err;
unsigned *up;
unsigned char *cp;
/* Set a pointer to the value of interest */
if (which & AUDIO__PLAY)
else if (which & AUDIO__RECORD)
return (AUDIO_ERR_BADARG);
switch (which & AUDIO__SETVAL_MASK) {
case AUDIO__PORT:
case AUDIO__SAMPLES:
case AUDIO__ERROR:
case AUDIO__EOF:
case AUDIO__OPEN:
case AUDIO__ACTIVE:
case AUDIO__WAITING:
case AUDIO__GAIN:
case AUDIO__MONGAIN:
case AUDIO__BALANCE:
default:
return (AUDIO_ERR_BADARG);
}
if (which & AUDIO__SET) {
/* Init so that only the value of interest is changed */
} else {
}
} else {
}
if (err == AUDIO_SUCCESS) {
else
}
return (err);
}
/*
* NOTE: legal values are floating-point double 0. - 1.
*/
int
{
int err;
unsigned x;
if (which & AUDIO__SET) {
return (AUDIO_ERR_BADARG);
/* Map value into legal range */
}
/* Get or set the new value */
if (err == AUDIO_SUCCESS) {
/* Map value back to double */
*valp = ((double)(x - AUDIO_MIN_GAIN) /
(AUDIO_MAX_GAIN - AUDIO_MIN_GAIN));
}
return (err);
}
/*
* Can set play and record individually or together.
*/
int
{
int err;
unsigned char x;
x = TRUE;
x = FALSE;
} else {
return (AUDIO_ERR_BADARG);
}
if (which & AUDIO__PLAY) {
}
if (which & AUDIO__RECORD) {
}
/* Set the new value */
/* Check to see if this took effect */
if (err == AUDIO_SUCCESS) {
return (AUDIO_ERR_NOEFFECT);
}
return (err);
}
/*
*/
int
{
int flag;
}
/*
* Wait synchronously for output buffers to finish playing.
* If 'sig' is TRUE, signals may interrupt the drain.
*/
int
{
return (AUDIO_UNIXERROR);
}
if (sig) {
return (AUDIO_ERR_INTERRUPTED);
}
}
return (AUDIO_SUCCESS);
}
/*
* Write an EOF marker to the output audio stream.
*/
int
{
}