Standard Audio Device Driver Specification

Similar documents
T-Engine Forum Specification

Audio Controller i. Audio Controller

ZED / Sonar Trouble shooter

DCS 6000 External Microphone Control

User's Manual. USB 2.0 Audio PCA with 16 Bit I/O, 4 x 4 Audio Mixer

HS-P82. Contents. New functions in firmware V2.00

PLENA matrix API Table of contents en 3

ALLO AUDIO CARDS TECHNICAL DETAILS

NuForce DAC-80 User s Guide

Communications Protocol

WaveIO Version 1.02 A Soundcard interface for LabView with ASIO support

460 Presentation Audio Mixer

Super UA Q&A 2015/03/16

Anybus CompactCom. Host Application Implementation Guide. Doc.Id. HMSI Doc. Rev Connecting DevicesTM

C. Zeitnitz December 2017 WaveIO Version 1.08 A Soundcard interface for LabView with WASAPI and ASIO support. C. Zeitnitz

Realtek Audio Utility User Guide

Digital to Analog Converter

Morset Sound Development. User s Guide

Spider MT503 SMART USER MANUAL. Page 1

F8 Control Version 2.0 Operation Manual

CyberData SIP Intercom Integration with 8x8

SONiX TECHNOLOGY CO.,LTD.

PJP-50USB. Conference Microphone Speaker. User s Manual MIC MUTE VOL 3 CLEAR STANDBY ENTER MENU

OPERATING MANUAL Manual Version 1.4 (Sep 11, 2017) Tel: or

User Manual. Please read this manual carefully before using the Phoenix Octopus

Apptec Corporation. Our products and solutions make your work easier!

Data encoding. Lauri Võsandi

Quality Audio Software Pipeline. Presenters Subhranil Choudhury, Rajendra C Turakani

DMX88 Specifications 30 August, 2011

Pentium-class computer with one available PCI slot Windows 7 / Vista / 2003 / XP / 2000, (32/64 bit) DirectX 8.1 above is required

VComm Signal File Specification

OSEK/VDX. Communication. Version January 29, 2003

User s Manual. Touch Panel Setting Tool. Important

DALI SOUND HUB MANUAL

Section. Amplifier Description and Operation

QUICKSTART MANUAL ENGLISH ( 3 10 ) MANUALE DE INICIO RÁPIDO ESPAÑOL ( ) GUIDE D'UTILISATION SIMPLIFIÉ FRANÇAIS ( )

VoIP Overview. Device Setup The device is configured via the VoIP tab of the devices Device Properties dialog in Integration Designer.

PS 630 SIX CHANNEL REMOTE SPEAKER STATION. User Manual. January 2017 V1.0

SPARK. Native Device Interface (NDI)

Soundcard Setup for Radio-SkyPipe

Linux based 3G Multimedia Mobile-phone API Specification

WebEx Recording Editor. User Guide

ES1921 AC 97 Rev 2.1 Audio Codec Product Brief. ESS Technology, Inc. DESCRIPTION FEATURES

DL32R. 32-Channel Wireless Digital Live Sound Mixer with ipad Control

QUICKSTART GUIDE ENGLISH ( 3 9 ) MANUAL DE INICIO RÁPIDO ESPAÑOL ( ) GUIDE D UTILISATION RAPIDE FRANÇAIS ( )

You Only Have a Telephone?

PORTABLE PREMIUM SOUND BLUETOOTH SPEAKER Owner s Manual

Owner s Manual DA-300USB D/A CONVERTER. Appendix. Contents. You can print more than one page of a PDF onto a single sheet of paper.

Audio Queue Services. Dave

NuForce 192kHz/24bit USB Driver Setup Guide

VS-2480 Q&A BASIC FUNCTIONS. Q: What are the main differences between VS-2480 and VS-1880/1680? Q: Are the audio data compressed?

PS 430 FOUR CHANNEL REMOTE SPEAKER STATION. User Manual. January 2017 V1.0

Audio Perfect Tools. Audio Perfect Tools

Polycom Real-time Signal Level and Microphone Gating Information from SoundStructure

STAC9750/51 PRODUCT BRIEF. Value-Line Two-Channel AC 97 Codecs with Headphone Drive and SPDIF Output DESCRIPTION OVERVIEW FEATURES

ADR Standard Procedure (Revised 3/09)

ASI5788 FEATURES DESCRIPTION LOW PROFILE PCI EXPRESS BROADCAST SOUND CARD

Steps to test Windows Audio

Spider MT503 SMART USER MANUAL. Page 1

PowerShare Editor User's Guide. Version 1.0

DESCRIPTION FEATURES MULTISTREAM PCI SOUND CARDS 26 DECEMBER 2007 ASI6514, ASI6518

User Guide Konftel 220 ENGLISH

Quickstart Guide (English)

MMC-2 CD MODEL. Document Number R0 File name MM2-05r0.doc. Content: Clause 5 of SFF CD Model

a format for audio data files in broadcasting Version 1 July 2001 Technical Specification

Audio Studio Guide Version: 3.5 Author: Ton Valkenburgh Date: January 8,

1. MME and the extension Availability of the Extension Identification of MARIAN Record and Playback Devices...4

PCI-16HSDI: 16-Bit, Six-Channel Sigma-Delta Analog Input PMC Board. With 1.1 MSPS Sample Rate per Channel, and Two Independent Clocks

LoLa280. Professional multichannel sound card. User manual

AMP Watt Audio Amplifier with RS-232 and IR Control. User s Manual CUSTOMER SUPPORT INFORMATION

Intercom Subsystem Reference and Information Guide

4-in/6-out USB Recording Interface. User s Guide

1. Selection Tool allows selection of specific portions of the waveform on the timeline

Selecting Audio and Meet Now Options

Product information AD-850

ASI564x 12-Play Mode. Play 1. Play 2. Play 3. Play 4. Play 5. Play 6. Play 7. Play 8. Play 9. Play 10. Play 11. Play 12. Record 1. Record 2.

Overview: Functional Description:

73M1866B/73M1966B FXOAPI User Guide

User Guide Konftel 220 ENGLISH. Tel: +44 (0) Fax: +44 (0)

LogiCORE IP AXI Video Direct Memory Access (axi_vdma) (v3.01.a)

Selection tool - for selecting the range of audio you want to edit or listen to.

USER MANUAL DUET PCS USB DESKTOP SPEAKERPHONE

Quick-Start Guide...3. Operation...5. Volume Control...4. Sound Quality...4. Dial tones and speaker mute note...5. Connection...5. Dial...

int fnvgetconfig(handle h, UINT32 id, const void *cfg, size_t sz);... 4

DxP Protocol Version 1.2

CFast Embedded Flash Module

Quick Guide 2017 ZOOM CORPORATION. You must read the Usage and Safety Precautions before use.

27 Designing Your Own Program

D C. TASCAM PCM Recorder. iphone/ipad/ipod touch Application USER'S GUIDE

DA-3700 Digital Karaoke Mixing Amplifier with Key Control

PS 230 DUAL CHANNEL REMOTE SPEAKER STATION. User Manual. January 2017 V1.0

Mikogo Version 4.7 (Beta) Voice Conferencing

CPCI-16HSDI. 16-Bit, Six-Channel Sigma-Delta Analog Input Board. With 1.1 MSPS Sample Rate per Channel, and Two Independent Clocks.

PowerShare Editor User's Guide. Version 2.0

USB BF70x Audio 1.0 Library v.1.2 Users Guide Users Guide Revision 1.3. For Use With Analog Devices ADSP-BF70x Series Processors

CPCI-16AIO Channel 16-Bit Analog I/O CPCI Board With 8 Input Channels, 8 Output Channels, and Auto calibration

User s Manual. Touch Panel Setting Tool. Important

PC104P-24DSI6LN. Six-Channel Low-Noise 24-Bit Delta-Sigma PC104-Plus Analog Input Module. With 200 KSPS Sample Rate per Channel

Viewing Live Video. Viewing Video through the Home Window Overview. Home Window Overview CHAPTER

DIGITIZING ANALOG AUDIO SOURCES USING AUDACITY

Transcription:

T-Engine Forum Specification September 29, 2003 Standard Audio Device Driver Specification 1

Number: Title: Standard Audio Device Driver Specification Status: [ ] Working Draft, [ ] Final Draft for Voting, [*] Standard Date: July 22, 2003 First Edited (Takeshi Aida, Faith, Inc.) August 5, 2003 Updated to 00.00.02 (revised Section 2.7 and the figures) September 29, 2003 Voted Copyright (C) 2003-2005 T-Engine Forum. All Rights Reserved. 2

Contents 1 Introduction...4 2 Driver...5 2.1 Implementation Requirements...5 2.2 ID tk_opn_dev(ub *devnm, UINT omode)...7 2.3 ER tk_cls_dev(id dd, UINT option)...7 2.4 ID tk_wai_dev(id dd, ID reqid, INT *a, ER *ioer, TMO tmout)...7 2.5 ID tk_wri_dev(id dd, INT start, VP, INT, TMO tmout) ER tk_swri_dev(id dd, INT start, VP, INT, INT *a)...8 2.5.1 Audio playback...8 2.5.2 Driver message fer registration...8 2.5.3 Driver message fer release...9 2.5.4 Internal driver status setting...10 2.5.5 Output data format designation...10 2.5.6 Input data format designation...11 2.5.7 Output drive control (optional)...11 2.5.8 Input drive control (optional)...12 2.5.9 Mixer functions (optional)...12 2.5.9.1 Set output volume...13 2.5.9.2 Set input volume...14 2.5.9.3 Mute line...14 2.5.9.4 Select recording source...15 2.6 ID tk_rea_dev(id dd, INT start, VP, INT, TMO tmout) ER tk_srea_dev(id dd, INT start, VP, INT, INT *a)...16 2.6.1 Audio recording...16 2.6.2 Get the supported data format...16 2.6.3 Get the internal driver status...16 2.6.4 Get the current write address...17 2.6.5 Get the current read address...17 2.6.6 Mixer functions (optional)...18 2.6.6.1 Enumerate lines...18 2.7 Mixer hardware example (optional)...19 2.8 Device control code example (concept)...20 2.8.1 Without request queuing...20 2.8.2 With request queuing...20 3

1 Introduction This specification defines the standard API for a device driver that enables audio IO with T-Engine. The driver provides audio codec control. In a minimal configuration, the driver is designed to support hardware equipped with one audio input or output system or both. It was also designed considering expandability for hardware with a digital IO interface and analog volume control. Two methods of supporting hardware expansion are assumed: an expanded audio codec can be supported with more driver units, and multiple implementations of DAC and ADC can be supported with more driver subunits. Application Control / Status Data stream Control / Status Driver Audio stream Control / Status ADC, AMP DAC, AMP Figure 1. Schematic diagram 4

2 Driver 2.1 Implementation Requirements The block of audio device-specific data is defined in AUDIO_DEVBLKSIZE [byte]. The subunit ID is assigned by the DAC or ADC implementation. The subunit number starts with 0. The driver must support the asynchronous read/write mechanisms tk_wri_dev(), k_rea_dev(), and tk_wai_dev() for device-specific data. Queuing is enabled up to AUDIO_MAXREQQ times for read and write in asynchronous access requests to device-specific data. In other words, if AUDIO_MAXREQQ=2, even when the queue becomes full of write requests as depicted in Figure 2, if read requests are issued the driver must receive them without any wait. This is not required, however, if the hardware does not support full-duplex operation. id0 = tk_wri_dev( dd, 0, Buf0, length, TMO_FEVR ); id1 = tk_wri_dev( dd, 0, Buf1, length, TMO_FEVR ); id2 = tk_rea_dev( dd, 0, BufR, lengthr, TMO_FEVR ); 1. Playback starts immediately 2. Queued (This fills up the write queue.) lengthr length length 3. Recording starts immediately Time Buf0 playback BufR Recording Buf1 playback Timing for executing Figure 2. Asynchronous access requests and queuing All access requests for attribute data must be immediately executed. In addition, access to attribute data is provided regardless of the queuing status of access requests for device-specific data. In other words, if AUDIO_MAXREQQ=2, even when the queue becomes full of write requests for device-specific data as depicted in Figure 3, if write requests for attribute data DN_AUDIO_MIXERSETOUTPUTVOL are issued, the driver must receive them without any wait for the write to DN_AUDIO_MIXERSETOUTPUTVOL. 5

1. Playback starts immediately id0 = tk_wri_dev( dd, 0, Buf0, length, TMO_FEVR ); id1 = tk_wri_dev( dd, 0, Buf1, length, TMO_FEVR ); er = tk_swri_dev( dd, DN_AUDIO_MIXERSETOUTPUTVOL, 2. Queued &MixerVol, of(mixervol), &a ); (This fills up the write queue.) 3. The volume is changed immediately length length Time Volume changed Buf0 playback starts Buf1 playback starts Timing for executing Figure 3. Asynchronous access requests and access to attribute data DMA transfer is assumed for this explanation. For platforms not supporting DMA transfer, the implementation is platform-dependent. Items herein that are not described in detail should conform to provisions of T-Engine standards. 6

2.2 ID tk_opn_dev(ub *devnm, UINT omode) Reserves the device and establishes standby. devnm omode Pointer to the device name string The device name comprises "audio" to distinguish the type, followed by the unit, represented by a letter from a to z, and the subunit, represented by a number. The first unit is designated by the device name "audioa0" if the subunit is 0. Designates options. TD_WRITE TD_READ TD_NOLOCK Enables processing for audio playback Enables processing for audio recording No locking of the specific data fer by the driver Whether or not simultaneous setting of TD_WRITE and TD_READ (full-duplex operation) is available is hardware-dependent. However, read and write of attribute data (start < 0) is supported regardless of the omode designation. With tk_wri_dev() and tk_rea_dev(), the driver locks and unlocks the relevant fer (making them resident or non-resident) for specific data before and after access. If TD_NOLOCK is designated here, this is not performed. 2.3 ER tk_cls_dev(id dd, UINT option) Stops the device and releases it. Interrupts active read or write operations and cancels all queued requests. If the driver message fer (see Section 2.5.2) is registered by DN_AUDIO_REGISTERMSGBUF, this releases it. 2.4 ID tk_wai_dev(id dd, ID reqid, INT *a, ER *ioer, TMO tmout) Waits for read and write requests indicated by reqid to be completed. If it ends in error, *a is undefined. 7

2.5 ID tk_wri_dev(id dd, INT start, VP, INT, TMO tmout) ER tk_swri_dev(id dd, INT start, VP, INT, INT *a) 2.5.1 Audio playback Designates the start address and number of blocks of the data for playback and starts playback. If requests are queued through asynchronous processing, the driver must enter processing for the next request continuously after the current request is complete without pause. A fer must not be released once it has issued a write request until that request is complete. If the driver message fer (see Section 2.5.2) is registered by DN_AUDIO_REGISTERMSGBUF, the driver issues a notification message immediately before and after fer playback. DN_AUDIO_PLAYAUDIO (=0) The start address of the fer where playback data is stored. Depending on the hardware platform, the following limitations may occur. (Examples of limitations) Alignment required for each memory page Must not be in task-specific space The number of fer blocks 2.5.2 Driver message fer registration Registers the driver-specific message fer. If the message fer is already registered, the registered message fer ID is returned without registration. It may be difficult for the invoker to know the actual timing for processing read and write requests that are issued asynchronously. But through the message fer registered here, notification of the start and end of the read or write can be received from the driver. It is advisable that the timing when messages are issued coincide with the moment of playback and recording. This message fer is not registered by default. The message from the driver is sent in the AudioMsgPacket structure. typedef struct { ID id; VP ; SYSTIM otm; } AudioMsgPacket; #define AUDIO_MSGPKTID_WRITESTART 0x0000 #define AUDIO_MSGPKTID_WRITECOMPLETE 0x0001 8

#define AUDIO_MSGPKTID_READSTART #define AUDIO_MSGPKTID_READCOMPLETE 0x0002 0x0003 The message type is indicated in id. This corresponds to one of the following four types. AUDIO_MSGPKTID_WRITESTART AUDIO_MSGPKTID_WRITECOMPLETE AUDIO_MSGPKTID_READSTART AUDIO_MSGPKTID_READCOMPLETE The message is a notification of the start of playback The message is a notification of the end of playback The message is a notification of the start of recording The message is a notification of the end of recording indicates the fer start address ( of tk_wri_dev(), tk_rea_dev()) of the read or write requests of the message source. otm indicates the system up time when the message was issued (in the same way it can be retrieved with tk_get_otm()). The driver has an internal status for notification if the message fer is flooded. Read and write for this internal status is done by setting the internal driver status (DN_AUDIO_SETSTATUS) or referring the internal driver status (DN_AUDIO_GETSTATUS). No message is issued if the message fer becomes full. A bit is set in AUDIO_STATUS_MBFFLOW in the internal status. DN_AUDIO_REGISTERMSGBUF Return Code Pointer to the ID type that stored the created message fer to be registered Must be of(id). The ID of the registered driver message fer 2.5.3 Driver message fer release Releases the driver-specific message fer. If the message fer is not registered, E_OBJ is returned. and are ignored. Return Code DN_AUDIO_UNREGISTERMSGBUF The ID of the released driver message fer 9

2.5.4 Internal driver status setting Sets the driver-specific internal status. Details of the UW-type variable indicated by are copied to the internal driver status. #define AUDIO_STATUS_MBFFLOW 0x0001 // driver message fer is flooded DN_AUDIO_SETSTATUS Pointer to the UW-type variable where the new internal driver status is stored Must be of(uw). 2.5.5 Output data format designation Designates the data format for blocks to be written. (Note: The supported format is dependent on the hardware to be implemented.) DN_AUDIO_SETOUTPUTFMT Pointer to the following AudioDriverDataFormat structure struct { W nsize; W nformattag; W nfs; W nchannels; W ninterleavesample; } AudioDriverDataFormat; nsize Structure of AudioDriverDataFormat [byte] nformattag Designates the sample format type (if rawpcm, the number of bits, the byte order, and whether it is signed or unsigned). Designates specific values for each of the various combinations. Examples: FMT_PCM_S16_LE rawpcm signed 16bit LittleEndian FMT_PCM_U8 rawpcm unsigned 8bit (offset binary) 10

nfs Designates the sampling rate [Hz]. nchannels Designates the number of channels (>=1) in the data stream. ninterleavesample If nchannels >1 for the data stream, designates after how many samples the channels are changed. Examples: When nchannels = 2 Time--------------------> ninterleavesample=1 L R L R L R L R L R ninterleavesample=4 L L L L R R R R L L Must be of(audiodriverdataformat). 2.5.6 Input data format designation Designates the data format for blocks to be read. Designated the same way as for the output data format. (Note: The supported format is dependent on the hardware to be implemented.) DN_AUDIO_SETINPUTFMT Pointer to the AudioDriverDataFormat structure For a description, see the section on output data format. Must be of(audiodriverdataformat). 2.5.7 Output drive control (optional) Controls the operating status of audio output hardware (including DAC hardware). The default operating status is always run. The function is intended for situations in which the timing of initial data writing and the moment sound is heard must be separately controlled. This is the case for hardware with a significant delay (latency) in the period after specific data is written using DN_AUDIO_PLAYAUDIO until the time audio starts to be heard. DN_AUDIO_SETOUTPUTSTATE 11

Pointer to the UW-type The UW-type indicated by prescribes the following operating parameters. bit 31 0 = stop 1 = run bit 30 to 16 reserved (must be 0) bit 15 to 0 implementation-dependent Must be of(uw). 2.5.8 Input drive control (optional) Controls the operating status of audio input hardware (including ADC hardware). The default operating status is always run. The function is intended for situations in which the timing of indication of initial data reading and recording must be separately controlled. This is the case for hardware with a significant delay (latency) in the period after specific data is read using DN_AUDIO_RECAUDIO until the time audio starts to be recorded. DN_AUDIO_SETINPUTSTATE Pointer to the UW-type The UW-type indicated by prescribes the following operating parameters. bit 31 0 = stop 1 = run bit 30 to 16 reserved (must be 0) bit 15 to 0 implementation-dependent Must be of(uw). 2.5.9 Mixer functions (optional) This section defines mixer functions for write operations. In this specification, "mixer" refers to volume adjustment functions and analog mixing functions. (See Section 2.7.) Mixer functions can only be controlled with subunit 0. Attempting to use them with subunit 1 or later returns an error (E_OBJ). Although software-based volume control can be implemented for platforms that do not support analog mixing hardware, latency may affect the audio output. All mixer states immediately after open are undefined. 12

2.5.9.1 Set output volume Controls the output volume of the designated line. DN_AUDIO_MIXERSETOUTPUTVOL Pointer to the following MixerLineVolume structure struct { UB lineid;// line ID UB time; // the time spent changing the volume [msec] H vol[0];// the volume value } MixerLineVolume; The following kinds of ID are designated for the line. MIXER_LINEID_MASTEROUT The output master volume MIXER_LINEID_PCMOUT PCM volume MIXER_LINEID_MICIN Microphone volume Each channel's volume is designated after vol[0]. Examples: For a monaural line vol[0] = volume For a two-channel stereo line vol[0] = L channel volume vol[1] = R channel volume The volume value is designated as a logarithm in increments of 1/256 db. The volume value for the nth channel is (vol[n] 256) db. The volume value is clipped to be in the effective range for that line. In time, the time spent until the designated volume value is reached is designated. To reach the designated volume value immediately, 0 is designated for time. When time>0, the driver gradually changes the volume from the current volume, taking time [msec] to reach the volume value designated after vol[0]. This function is intended to suppress quick noise, and implementation is optional. If quick noise suppression functions are implemented in the hardware, time is ignored. The effective byte from 13

2.5.9.2 Set input volume Controls the input volume (recording level) of the designated line. DN_AUDIO_MIXERSETINPUTVOL Pointer to the MixerLineVolume structure For a description, see the section, set output volume. The effective byte from. 2.5.9.3 Mute line Mutes or unmutes the output of the designated line. The volume value is retained even if muted. Volume adjustment is possible, but there is no sound for this line until unmute is used. DN_AUDIO_MIXERMUTELINE Pointer to the UW-type The UW-type indicated by prescribes the following operating parameters. bit 31 0 = unmute 1 = mute bit 30 to 16 reserved (must be 0) bit 15 to 8 time spent for mute [msec] bit 7 to 0 line ID For bit 15 to 8, the time spent until muting [msec] is designated as an unsigned 8-bit integer. For instantaneous mute, designate 0. When (bit 15 to 8)>0, the driver gradually lowers the volume from the current level until it is silent. This function is intended to suppress quick noise, and implementation is optional. If quick noise suppression functions are implemented in the hardware, bit 15 to 18 is ignored. Must be of(uw). 14

2.5.9.4 Select recording source Sets a recording source for the designated line. DN_AUDIO_MIXERSELECTRECSRC Pointer to the following MixerLineRecSrc structure struct { W nlines; UB lineid[0]; } MixerLineRecSrc; nlines Number of lines designated for the recording source lineid[0] to [nlines-1] Line ID for the lines to be used with the recording source The effective byte from 15

2.6 ID tk_rea_dev(id dd, INT start, VP, INT, TMO tmout) ER tk_srea_dev(id dd, INT start, VP, INT, INT *a) 2.6.1 Audio recording Designates the start address of the fer and number of fer blocks for recording. If requests are queued through asynchronous processing, the driver must enter processing for the next request continuously after the current request is complete without pause. A fer must not be released once it has issued a read request until that request is complete. If the driver message fer (see Section 2.5.2) is registered by DN_AUDIO_REGISTERMSGBUF, the driver issues a notification message immediately before and after recording to the fer. DN_AUDIO_RECAUDIO (=0) The start address of the fer where recording data is stored. Depending on the hardware platform, the following limitations may occur. (Examples of limitations) Alignment required for each memory page Must not be in task-specific space The number of fer blocks. 2.6.2 Get the supported data format Lists the data formats supported by the device unit. Descriptions of data formats are defined separately. If the available array is not large enough, E_PAR is returned. DN_AUDIO_GETAVAILABLEFMTS Pointer to the B-type array The data format description is stored in the array indicated here as a half-width alphanumeric (ASCII) string. The of the array indicated by [bytes] 2.6.3 Get the internal driver status Gets the driver-specific internal status. 16

The internal driver status is copied to the UW-type variable indicated by. Each bit of the internal driver status is significant. For telling what the status is, check each bit like as (status & AUDIO_STATUS_MBFFLOW). #define AUDIO_STATUS_MBFFLOW 0x0001 // driver message fer is flooded DN_AUDIO_GETSTATUS Pointer to the UW-type variable Must be of(uw). 2.6.4 Get the current write address Gets the current write address of the fer during recording. If recording is not in progress, E_OBJ is returned. DN_AUDIO_GETRECORDINGPOS Pointer to the VP-type variable The current write address of the fer is stored in the variable indicated here. Must be of(vp). 2.6.5 Get the current read address Gets the current read address of the fer during playback. If playback is not in progress, E_OBJ is returned. DN_AUDIO_GETPLAYINGPOS Pointer to the VP-type variable The current read address of the fer is stored in the variable indicated here. Must be of(vp). 17

2.6.6 Mixer functions (optional) This section defines analog mixer functions for read operations. In this specification, "mixer" refers to volume adjustment functions and analog mixing functions. (See Section 2.7.) Mixer functions can only be controlled with subunit 0. Attempting to use them with subunit 1 or later returns an error (E_OBJ). 2.6.6.1 Enumerate lines Lists mixer elements (supported line numbers, minimum and maximum volume, and name) as well as the number of channels supported by each line. The descriptors of each line are linedesc[0] to [nlines-1]. DN_AUDIO_MIXERENUMLINES Pointer to the following MixerAllLinesDesc structure struct { UB lineid; // line ID UB nchannels; // number of channels H volmax; // maximum effective volume [1/256 db] H volmin; // minimum effective volume [1/256 db] B LineName[32];// line name (half-width alphanumeric characters) } MixerLineDesc; struct { W nlines; // number of lines assigned to the mixer struct MixerLineDesc LineDesc[0]; } MixerAllLinesDesc; 18

2.7 Mixer hardware example (optional) A codec is assumed for this specification that supports multiple analog input mixing functions. Figure 4 shows an example of this. The mixer is depicted by the area bounded by dotted lines in the figure. As a specific example, Figure 5 shows the portion representing a mixer in a configuration supporting one stereo output system and one monaural input system. These are merely provided as examples of mixers supported by a driver of this specification. They are not intended to limit the hardware corresponding to the driver. PCM playback L,R, DAC master volume Analog input Σ Speaker output Microphone input PCM recording ADC Mixer gain/attenuation, mute Figure 4. Example of a codec assumed for this specification L PCMOUT[0] MASTEROUT[0] L from DAC R PCMOUT[1] MASTEROUT[1] R Stereo output MIC IN[0] Monaural input Set in DN_AUDIO_MIXERSETOUTPUTVOL to ADC L R RECGAIN[0] RECGAIN[1] and DN_AUDIO_MIXERMUTELINE Set in DN_AUDIO_MIXERSELECTRECSRC Set in DN_AUDIO_MIXERSETINPUTVOL Figure 5. Example of a mixer with one stereo output system and one monaural input system 19

2.8 Device control code example (concept) 2.8.1 Without request queuing // opens the device in write mode dd = tk_opn_dev("audioa0", TD_WRITE); // designates PCM format tk_swri_dev(dd, DN_AUDIO_SETOUTPUTFMT, &pcmfmt, of(pcmfmt), &a); // initializes the mixer volume // master volume tk_swri_dev(dd, DN_AUDIO_MIXERSETOUTPUTVOL, &mastv, of(mastv), &a); tk_swri_dev(dd, DN_AUDIO_MIXERMUTELINE, &mastmon, of(mastmon), &a); // pcmout volume tk_swri_dev(dd, DN_AUDIO_MIXERSETOUTPUTVOL, &pcmv, of(pcmv), &a); tk_swri_dev(dd, DN_AUDIO_MIXERMUTELINE, &pcmmon, of(pcmmon), &a); // audio playback // playback from of length [block] tk_swri_dev(dd, 0,, length, &a); // mutes the master volume (stopping noise) tk_swri_dev(dd, DN_AUDIO_MIXERMUTELINE, &mastmoff, of(mastmoff), &a); // closes the device tk_cls_dev(dd, 0); 2.8.2 With request queuing (Up to this point, same as without queuing) // audio playback nbuf = 0; id[nbuf] = tk_wri_dev(dd, 0, _A, length, TMO_FEVR); // id is the ID type, an array 2 long // repeats until there is a termination request while (!bend){ // handles the sound fer audioproc(nbuf?_a:_b); // issues the next request (with queuing) id[nbuf^1] = tk_wri_dev(dd, 0, nbuf?_a:_b, length, TMO_FEVR); // waits for termination of current request tk_wai_dev(dd, id[nbuf], &a, &er, TMO_FEVR); // switches the fer nbuf ^= 1; } tk_wai_dev(dd, id[nbuf], &a, &er, TMO_FEVR); 20