⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audio_device.3

📁 操作系统SunOS 4.1.3版本的源码
💻 3
字号:
.\" @(#)audio_device.3 1.1 92/07/30 SMI.ds Dc 7/30/92.TH AUDIO_DEVICE 3 "\*(Dc" "" "Audio Library".SH NAMEaudio_device,et al\- audio device control functions.SH DISCLAIMER.LPThe manual pages, header files, and object library associated with.B /usr/demo/SOUND/libaudio.aare furnished on an AS IS basis as a preliminary interface to severaluseful audio data-processing capabilities.  A future release of theoperating system may redefine the syntax or semantics of some of thefunctions described herein..SH SYNOPSIS.nf.B #include <multimedia/libaudio.h>.B #include <multimedia/audio_device.h>.LP.B int audio_pause_play(fd).B int fd;.B ....fi.SH DESCRIPTIONA number of functions are provided to query and control the state of theaudio device.  By using these functions, applications do not need tobe concerned with the details of the audio.B ioctlcommands.  This interface layer may be used, in the future, to redirectcontrol/status messages to and from an audio server process instead ofthe audio device itself..LPThe.I fdargument of the device control functionsspecifies an open file descriptor referring to the audio device.In most cases, this descriptor may refer either to the audio i/o device(\fB/dev/audio\fP) or the audio control device (\fB/dev/audioctl\fP).All of these functions return the value .SB AUDIO_SUCCESSif the requested operation succeeded;  otherwise anerror flag is returned.  Note that, in some cases, successful completiondoes not mean that the requested change of status actuallyaltered the state of the device..SH Pause/Resume.LPThe following functions pause and resume audio i/o.  If the requestedoperations failed to take effect (for instance, output may not be pausedif the device is not open for writing), the value.SB AUDIO_ERR_NOEFFECTis returned..TP 31.BI audio_pause_play( fd )pauses audio output, without affecting previously queued data..TP.BI audio_pause_record( fd )pauses audio input.  All input data that was converted priorto pausing is made available to the process..TP.BI audio_pause( fd )simultaneously pauses both input and output..TP.BI audio_resume_play( fd )resumes audio output..TP.BI audio_resume_record( fd )resumes audio input conversion..TP.BI audio_resume( fd )simultaneously resumes both input and output..SH Flush Queues.LPThe following functions flush the audio.SM STREAMSbuffers..TP 31.BI audio_flush_play( fd )flushes the output queue..TP.BI audio_flush_record( fd )flushes the input queue..TP.BI audio_flush( fd )simultaneously flushes the both the input and output queues..SH Synchronization.LPThe following functions perform operations related to the synchronizationof output data..TP 31.BI audio_drain( fd,sig )causes the requesting process to block until all previously queued outputdata has been played.  If the.I sigargument is.SM TRUE\s0,the reception of a signal will cause.B audio_drain(\|)to return immediately with the value.SB AUDIO_ERR_INTERRUPTED..TP.BI audio_play_eof( fd )writes an End-Of-File marker to the specified device.  When this markeris synchronously played, the output eof counter in the device informationstructure will be incremented..SH Gain.LPThe following functions manipulate the various gains associated with theaudio device.  Gain levels are represented by a floating-pointvalue between 0. and 1. (where 0. denotes infinite attenuation and1. represents the maximum gain level).  In this way, applications may mapany number of gradations of volume over the full scale of the device.The.I valpargument specifies the address of a floating-point.BR double .In the case of the.I setroutines, this value is scaled to the device range and the gain level is set.Both the.I getand.I setroutines return the latest gain setting in the address given by.IR valp ..TP 31.BI audio_get_play_gain( fd,valp )retrieves the current output gain..TP.BI audio_get_record_gain( fd,valp )retrieves the current input gain..TP.BI audio_get_monitor_gain( fd,valp )retrieves the current monitor gain..TP.BI audio_set_play_gain( fd,valp )sets the output gain and returns the new value..TP.BI audio_set_record_gain( fd,valp )sets the input gain and returns the new value..TP.BI audio_set_monitor_gain( fd,valp )sets the monitor gain and returns the new value..SH Device Status.LPThe following functions manipulate the various state flags of the audiodevice.  The.I valpargument specifies the address of an.B unsignedinteger.This value updated with the latest value of the particular state field.In the case of the.I setroutines, this value is first set in the appropriate device state field.Requests to alter read-only fields or to set values that are inappropriatefor the particular audio device are ignored.  Applications may check thereturn value in order to ensure that the requested change took place..TP 31.BI audio_get_play_port( fd,valp )retrieves the current output port configuration..TP.BI audio_get_record_port( fd,valp )retrieves the current input port configuration..TP.BI audio_get_play_samples( fd,valp )retrieves the current output sample count..TP.BI audio_get_record_samples( fd,valp )retrieves the current input sample count..TP.BI audio_get_play_error( fd,valp )sets.I *valp.SM TRUEif the output underflow indicator is set..TP.BI audio_get_record_error( fd,valp )sets.I *valp.SM TRUEif the input overflow indicator is set..TP.BI audio_get_play_eof( fd,valp )retrieves the current output end-of-file counter..TP.BI audio_get_play_open( fd,valp )sets.I *valp.S TRUEif the device is open for output..TP.BI audio_get_record_open( fd,valp )sets.I *valp.S TRUEif the device is open for input..TP.BI audio_get_play_active( fd,valp )sets.I *valp.S TRUEif data output is currently in progress..TP.BI audio_get_record_active( fd,valp )sets.I *valp.S TRUEif data input is currently in progress..TP.BI audio_get_play_waiting( fd,valp )sets.I *valp.S TRUEif a process is waiting for write access to the audio device..TP.BI audio_get_record_waiting( fd,valp )sets.I *valp.S TRUEif a process is waiting for read access to the audio device..TP.BI audio_set_play_port( fd,valp )sets the output port configuration and returns the new value..TP.BI audio_set_record_port( fd,valp )sets the input port configuration and returns the new value..TP.BI audio_set_play_samples( fd,valp )sets the output sample counter.  The value of the output sample counterimmediately prior to setting the new value is returned..TP.BI audio_set_record_samples( fd,valp )sets the input sample counter.  The value of the input sample counterimmediately prior to setting the new value is returned..TP.BI audio_set_play_error( fd,valp )sets the output error flag.  Ordinarily, applications should only reset thisflag to zero.  The value of the output error flag immediately prior tosetting the new value is returned..TP.BI audio_set_record_error( fd,valp )sets the input error flag.  Ordinarily, applications should only reset thisflag to zero.  The value of the input error flag immediately prior tosetting the new value is returned..TP.BI audio_set_play_eof( fd,valp )sets the output end-of-file counter.  The value of the output eof flagimmediately prior to setting the new value is returned..TP.BI audio_set_play_waiting( fd,valp )sets the output waiting flag.  This flag may only be set (it is clearedwhen the device becomes available for output)..TP.BI audio_set_record_waiting( fd,valp )sets the input waiting flag.  This flag may only be set (it is clearedwhen the device becomes available for input)..SH Encoding Configuration.LPThe following routines convert the current audio device encoding configurationto an.B Audio_hdrstructure whose address is given by the .I hpargument..TP.BI audio_get_play_config( fd,hp )returns the current output configuration..TP.BI audio_get_record_config( fd,hp )returns the current input configuration..LPThe following routines attempt to configure the audio device to match theencoding specified in the.B Audio_hdrstructure.  Some of the requested fields may be read-only for the device.If the device configuration cannot be made to match the requested encoding,the value.SB AUDIO_ERR_NOEFFECTis returned.  In this case, the application should check the particularfields of the returned.B Audio_hdrin order to determine the current state of the device..TP 31.BI audio_set_play_config( fd,hp )sets the output configuration to match the given.BR Audio_hdr .The new output configuration is returned..TP.BI audio_set_record_config( fd,hp )sets the input configuration to match the given.BR Audio_hdr .The new input configuration is returned..SH Direct Device Control.LPIn some cases, applications may wish to read or modify several device statefields atomically.  The following functions are provided for this purpose,though their use should be avoided where possible, since they expose theaudio.B ioctlinterface to applications.  The.I ipargument specifies the address of an.B Audio_info_tstructure (see.BR audio (4))that is filled in with the current state of the device..TP 31.B #include <sun/audioio.h>.TP.BI audio_getinfo( fd,ip )returns the current device information structure..TP.BI audio_setinfo( fd,ip )sets the device state from.IR *ipand updates it to reflect the new state.If the.SB AUDIO_INITINFOmacro was used to initialize the information structure, then onlyfields that were subsequently modified will affect the audio device state..SH RETURN VALUEThese routines return.SB AUDIO_SUCCESSon successful completion or, if unsuccessful, one of the following error codes:.TP 25.SM AUDIO_UNIXERRORAn error occurred while executing a system library function.  The globalvalue.I errnocontains the error code..TP.SM AUDIO_ERR_BADARGA user-supplied argument value was invalid..TP.SM AUDIO_ERR_ENCODINGThe device or.B Audio_hdrencoding contained an invalid or unsupported  format code..TP.SM AUDIO_ERR_NOEFFECTThe requested operation did not entirely take effect.  Partial devicestate changes may have occurred..TP.SM AUDIO_ERR_INTERRUPTEDThe requested operation was interrupted by a signal..SH SEE ALSO.BR audio_intro (3),.BR audio_hdr (3),.BR audio (4).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -