home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pytexdoc / ext / lib / lib2 / sun / tex
LaTeX Document  |  1996-11-08  |  4.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 53 75 6e 4f 53 20 53 |\chapter|{SunOS S|
|00000010| 70 65 63 69 66 69 63 20 | 53 65 72 76 69 63 65 73 |pecific |Services|
|00000020| 7d 0a 0a 54 68 65 20 6d | 6f 64 75 6c 65 73 20 64 |}..The m|odules d|
|00000030| 65 73 63 72 69 62 65 64 | 20 69 6e 20 74 68 69 73 |escribed| in this|
|00000040| 20 63 68 61 70 74 65 72 | 20 70 72 6f 76 69 64 65 | chapter| provide|
|00000050| 20 69 6e 74 65 72 66 61 | 63 65 73 20 74 6f 20 66 | interfa|ces to f|
|00000060| 65 61 74 75 72 65 73 0a | 74 68 61 74 20 61 72 65 |eatures.|that are|
|00000070| 20 75 6e 69 71 75 65 20 | 74 6f 20 74 68 65 20 53 | unique |to the S|
|00000080| 75 6e 4f 53 20 6f 70 65 | 72 61 74 69 6e 67 20 73 |unOS ope|rating s|
|00000090| 79 73 74 65 6d 20 28 76 | 65 72 73 69 6f 6e 73 20 |ystem (v|ersions |
|000000a0| 34 20 61 6e 64 20 35 3b | 20 74 68 65 0a 6c 61 74 |4 and 5;| the.lat|
|000000b0| 74 65 72 20 69 73 20 61 | 6c 73 6f 20 6b 6e 6f 77 |ter is a|lso know|
|000000c0| 6e 20 61 73 20 53 6f 6c | 61 72 69 73 20 76 65 72 |n as Sol|aris ver|
|000000d0| 73 69 6f 6e 20 32 29 2e | 0a 0a 5c 73 65 63 74 69 |sion 2).|..\secti|
|000000e0| 6f 6e 7b 42 75 69 6c 74 | 2d 69 6e 20 4d 6f 64 75 |on{Built|-in Modu|
|000000f0| 6c 65 20 5c 73 65 63 74 | 63 6f 64 65 7b 73 75 6e |le \sect|code{sun|
|00000100| 61 75 64 69 6f 64 65 76 | 7d 7d 0a 5c 62 69 6d 6f |audiodev|}}.\bimo|
|00000110| 64 69 6e 64 65 78 7b 73 | 75 6e 61 75 64 69 6f 64 |dindex{s|unaudiod|
|00000120| 65 76 7d 0a 0a 54 68 69 | 73 20 6d 6f 64 75 6c 65 |ev}..Thi|s module|
|00000130| 20 61 6c 6c 6f 77 73 20 | 79 6f 75 20 74 6f 20 61 | allows |you to a|
|00000140| 63 63 65 73 73 20 74 68 | 65 20 73 75 6e 20 61 75 |ccess th|e sun au|
|00000150| 64 69 6f 20 69 6e 74 65 | 72 66 61 63 65 2e 20 54 |dio inte|rface. T|
|00000160| 68 65 20 73 75 6e 0a 61 | 75 64 69 6f 20 68 61 72 |he sun.a|udio har|
|00000170| 64 77 61 72 65 20 69 73 | 20 63 61 70 61 62 6c 65 |dware is| capable|
|00000180| 20 6f 66 20 72 65 63 6f | 72 64 69 6e 67 20 61 6e | of reco|rding an|
|00000190| 64 20 70 6c 61 79 69 6e | 67 20 62 61 63 6b 20 61 |d playin|g back a|
|000001a0| 75 64 69 6f 20 64 61 74 | 61 0a 69 6e 20 55 2d 4c |udio dat|a.in U-L|
|000001b0| 41 57 20 66 6f 72 6d 61 | 74 20 77 69 74 68 20 61 |AW forma|t with a|
|000001c0| 20 73 61 6d 70 6c 65 20 | 72 61 74 65 20 6f 66 20 | sample |rate of |
|000001d0| 38 4b 20 70 65 72 20 73 | 65 63 6f 6e 64 2e 20 41 |8K per s|econd. A|
|000001e0| 20 66 75 6c 6c 0a 64 65 | 73 63 72 69 70 74 69 6f | full.de|scriptio|
|000001f0| 6e 20 63 61 6e 20 62 65 | 20 67 6f 74 74 65 6e 20 |n can be| gotten |
|00000200| 77 69 74 68 20 5c 73 61 | 6d 70 7b 6d 61 6e 20 61 |with \sa|mp{man a|
|00000210| 75 64 69 6f 7d 2e 0a 0a | 54 68 65 20 6d 6f 64 75 |udio}...|The modu|
|00000220| 6c 65 20 64 65 66 69 6e | 65 73 20 74 68 65 20 66 |le defin|es the f|
|00000230| 6f 6c 6c 6f 77 69 6e 67 | 20 76 61 72 69 61 62 6c |ollowing| variabl|
|00000240| 65 73 20 61 6e 64 20 66 | 75 6e 63 74 69 6f 6e 73 |es and f|unctions|
|00000250| 3a 0a 0a 5c 72 65 6e 65 | 77 63 6f 6d 6d 61 6e 64 |:..\rene|wcommand|
|00000260| 7b 5c 69 6e 64 65 78 73 | 75 62 69 74 65 6d 7d 7b |{\indexs|ubitem}{|
|00000270| 28 69 6e 20 6d 6f 64 75 | 6c 65 20 73 75 6e 61 75 |(in modu|le sunau|
|00000280| 64 69 6f 64 65 76 29 7d | 0a 5c 62 65 67 69 6e 7b |diodev)}|.\begin{|
|00000290| 65 78 63 64 65 73 63 7d | 7b 65 72 72 6f 72 7d 0a |excdesc}|{error}.|
|000002a0| 54 68 69 73 20 65 78 63 | 65 70 74 69 6f 6e 20 69 |This exc|eption i|
|000002b0| 73 20 72 61 69 73 65 64 | 20 6f 6e 20 61 6c 6c 20 |s raised| on all |
|000002c0| 65 72 72 6f 72 73 2e 20 | 54 68 65 20 61 72 67 75 |errors. |The argu|
|000002d0| 6d 65 6e 74 20 69 73 20 | 61 20 73 74 72 69 6e 67 |ment is |a string|
|000002e0| 0a 64 65 73 63 72 69 62 | 69 6e 67 20 77 68 61 74 |.describ|ing what|
|000002f0| 20 77 65 6e 74 20 77 72 | 6f 6e 67 2e 0a 5c 65 6e | went wr|ong..\en|
|00000300| 64 7b 65 78 63 64 65 73 | 63 7d 0a 0a 5c 62 65 67 |d{excdes|c}..\beg|
|00000310| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 6f 70 65 |in{funcd|esc}{ope|
|00000320| 6e 7d 7b 6d 6f 64 65 7d | 0a 54 68 69 73 20 66 75 |n}{mode}|.This fu|
|00000330| 6e 63 74 69 6f 6e 20 6f | 70 65 6e 73 20 74 68 65 |nction o|pens the|
|00000340| 20 61 75 64 69 6f 20 64 | 65 76 69 63 65 20 61 6e | audio d|evice an|
|00000350| 64 20 72 65 74 75 72 6e | 73 20 61 20 73 75 6e 20 |d return|s a sun |
|00000360| 61 75 64 69 6f 20 64 65 | 76 69 63 65 0a 6f 62 6a |audio de|vice.obj|
|00000370| 65 63 74 2e 20 54 68 69 | 73 20 6f 62 6a 65 63 74 |ect. Thi|s object|
|00000380| 20 63 61 6e 20 74 68 65 | 6e 20 62 65 20 75 73 65 | can the|n be use|
|00000390| 64 20 74 6f 20 64 6f 20 | 49 2f 4f 20 6f 6e 2e 20 |d to do |I/O on. |
|000003a0| 54 68 65 20 5c 76 61 72 | 7b 6d 6f 64 65 7d 20 70 |The \var|{mode} p|
|000003b0| 61 72 61 6d 65 74 65 72 | 0a 69 73 20 6f 6e 65 20 |arameter|.is one |
|000003c0| 6f 66 20 5c 63 6f 64 65 | 7b 27 72 27 7d 20 66 6f |of \code|{'r'} fo|
|000003d0| 72 20 72 65 63 6f 72 64 | 2d 6f 6e 6c 79 20 61 63 |r record|-only ac|
|000003e0| 63 65 73 73 2c 20 5c 63 | 6f 64 65 7b 27 77 27 7d |cess, \c|ode{'w'}|
|000003f0| 20 66 6f 72 20 70 6c 61 | 79 2d 6f 6e 6c 79 0a 61 | for pla|y-only.a|
|00000400| 63 63 65 73 73 2c 20 5c | 63 6f 64 65 7b 27 72 77 |ccess, \|code{'rw|
|00000410| 27 7d 20 66 6f 72 20 62 | 6f 74 68 20 61 6e 64 20 |'} for b|oth and |
|00000420| 5c 63 6f 64 65 7b 27 63 | 6f 6e 74 72 6f 6c 27 7d |\code{'c|ontrol'}|
|00000430| 20 66 6f 72 20 61 63 63 | 65 73 73 20 74 6f 20 74 | for acc|ess to t|
|00000440| 68 65 0a 63 6f 6e 74 72 | 6f 6c 20 64 65 76 69 63 |he.contr|ol devic|
|00000450| 65 2e 20 53 69 6e 63 65 | 20 6f 6e 6c 79 20 6f 6e |e. Since| only on|
|00000460| 65 20 70 72 6f 63 65 73 | 73 20 69 73 20 61 6c 6c |e proces|s is all|
|00000470| 6f 77 65 64 20 74 6f 20 | 68 61 76 65 20 74 68 65 |owed to |have the|
|00000480| 20 72 65 63 6f 72 64 65 | 72 0a 6f 72 20 70 6c 61 | recorde|r.or pla|
|00000490| 79 65 72 20 6f 70 65 6e | 20 61 74 20 74 68 65 20 |yer open| at the |
|000004a0| 73 61 6d 65 20 74 69 6d | 65 20 69 74 20 69 73 20 |same tim|e it is |
|000004b0| 61 20 67 6f 6f 64 20 69 | 64 65 61 20 74 6f 20 6f |a good i|dea to o|
|000004c0| 70 65 6e 20 74 68 65 20 | 64 65 76 69 63 65 0a 6f |pen the |device.o|
|000004d0| 6e 6c 79 20 66 6f 72 20 | 74 68 65 20 61 63 74 69 |nly for |the acti|
|000004e0| 76 69 74 79 20 6e 65 65 | 64 65 64 2e 20 53 65 65 |vity nee|ded. See|
|000004f0| 20 74 68 65 20 61 75 64 | 69 6f 20 6d 61 6e 70 61 | the aud|io manpa|
|00000500| 67 65 20 66 6f 72 20 64 | 65 74 61 69 6c 73 2e 0a |ge for d|etails..|
|00000510| 5c 65 6e 64 7b 66 75 6e | 63 64 65 73 63 7d 0a 0a |\end{fun|cdesc}..|
|00000520| 5c 73 75 62 73 65 63 74 | 69 6f 6e 7b 41 75 64 69 |\subsect|ion{Audi|
|00000530| 6f 20 44 65 76 69 63 65 | 20 4f 62 6a 65 63 74 73 |o Device| Objects|
|00000540| 7d 0a 0a 54 68 65 20 61 | 75 64 69 6f 20 64 65 76 |}..The a|udio dev|
|00000550| 69 63 65 20 6f 62 6a 65 | 63 74 73 20 61 72 65 20 |ice obje|cts are |
|00000560| 72 65 74 75 72 6e 65 64 | 20 62 79 20 5c 63 6f 64 |returned| by \cod|
|00000570| 65 7b 6f 70 65 6e 7d 20 | 64 65 66 69 6e 65 20 74 |e{open} |define t|
|00000580| 68 65 0a 66 6f 6c 6c 6f | 77 69 6e 67 20 6d 65 74 |he.follo|wing met|
|00000590| 68 6f 64 73 20 28 65 78 | 63 65 70 74 20 5c 63 6f |hods (ex|cept \co|
|000005a0| 64 65 7b 63 6f 6e 74 72 | 6f 6c 7d 20 6f 62 6a 65 |de{contr|ol} obje|
|000005b0| 63 74 73 20 77 68 69 63 | 68 20 6f 6e 6c 79 20 70 |cts whic|h only p|
|000005c0| 72 6f 76 69 64 65 0a 67 | 65 74 69 6e 66 6f 2c 20 |rovide.g|etinfo, |
|000005d0| 73 65 74 69 6e 66 6f 20 | 61 6e 64 20 64 72 61 69 |setinfo |and drai|
|000005e0| 6e 29 3a 0a 0a 5c 72 65 | 6e 65 77 63 6f 6d 6d 61 |n):..\re|newcomma|
|000005f0| 6e 64 7b 5c 69 6e 64 65 | 78 73 75 62 69 74 65 6d |nd{\inde|xsubitem|
|00000600| 7d 7b 28 61 75 64 69 6f | 20 64 65 76 69 63 65 20 |}{(audio| device |
|00000610| 6d 65 74 68 6f 64 29 7d | 0a 0a 5c 62 65 67 69 6e |method)}|..\begin|
|00000620| 7b 66 75 6e 63 64 65 73 | 63 7d 7b 63 6c 6f 73 65 |{funcdes|c}{close|
|00000630| 7d 7b 7d 0a 54 68 69 73 | 20 6d 65 74 68 6f 64 20 |}{}.This| method |
|00000640| 65 78 70 6c 69 63 69 74 | 6c 79 20 63 6c 6f 73 65 |explicit|ly close|
|00000650| 73 20 74 68 65 20 64 65 | 76 69 63 65 2e 20 49 74 |s the de|vice. It|
|00000660| 20 69 73 20 75 73 65 66 | 75 6c 20 69 6e 20 73 69 | is usef|ul in si|
|00000670| 74 75 61 74 69 6f 6e 73 | 0a 77 68 65 72 65 20 64 |tuations|.where d|
|00000680| 65 6c 65 74 69 6e 67 20 | 74 68 65 20 6f 62 6a 65 |eleting |the obje|
|00000690| 63 74 20 64 6f 65 73 20 | 6e 6f 74 20 69 6d 6d 65 |ct does |not imme|
|000006a0| 64 69 61 74 65 6c 79 20 | 63 6c 6f 73 65 20 69 74 |diately |close it|
|000006b0| 20 73 69 6e 63 65 20 74 | 68 65 72 65 0a 61 72 65 | since t|here.are|
|000006c0| 20 6f 74 68 65 72 20 72 | 65 66 65 72 65 6e 63 65 | other r|eference|
|000006d0| 73 20 74 6f 20 69 74 2e | 20 41 20 63 6c 6f 73 65 |s to it.| A close|
|000006e0| 64 20 64 65 76 69 63 65 | 20 73 68 6f 75 6c 64 20 |d device| should |
|000006f0| 6e 6f 74 20 62 65 20 75 | 73 65 64 20 61 67 61 69 |not be u|sed agai|
|00000700| 6e 2e 0a 5c 65 6e 64 7b | 66 75 6e 63 64 65 73 63 |n..\end{|funcdesc|
|00000710| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 66 75 6e 63 64 65 |}..\begi|n{funcde|
|00000720| 73 63 7d 7b 64 72 61 69 | 6e 7d 7b 7d 0a 54 68 69 |sc}{drai|n}{}.Thi|
|00000730| 73 20 6d 65 74 68 6f 64 | 20 77 61 69 74 73 20 75 |s method| waits u|
|00000740| 6e 74 69 6c 20 61 6c 6c | 20 70 65 6e 64 69 6e 67 |ntil all| pending|
|00000750| 20 6f 75 74 70 75 74 20 | 69 73 20 70 72 6f 63 65 | output |is proce|
|00000760| 73 73 65 64 20 61 6e 64 | 20 74 68 65 6e 20 72 65 |ssed and| then re|
|00000770| 74 75 72 6e 73 2e 0a 43 | 61 6c 6c 69 6e 67 20 74 |turns..C|alling t|
|00000780| 68 69 73 20 6d 65 74 68 | 6f 64 20 69 73 20 6f 66 |his meth|od is of|
|00000790| 74 65 6e 20 6e 6f 74 20 | 6e 65 63 65 73 73 61 72 |ten not |necessar|
|000007a0| 79 3a 20 64 65 73 74 72 | 6f 79 69 6e 67 20 74 68 |y: destr|oying th|
|000007b0| 65 20 6f 62 6a 65 63 74 | 20 77 69 6c 6c 0a 61 75 |e object| will.au|
|000007c0| 74 6f 6d 61 74 69 63 61 | 6c 6c 79 20 63 6c 6f 73 |tomatica|lly clos|
|000007d0| 65 20 74 68 65 20 61 75 | 64 69 6f 20 64 65 76 69 |e the au|dio devi|
|000007e0| 63 65 20 61 6e 64 20 74 | 68 69 73 20 77 69 6c 6c |ce and t|his will|
|000007f0| 20 64 6f 20 61 6e 20 69 | 6d 70 6c 69 63 69 74 20 | do an i|mplicit |
|00000800| 64 72 61 69 6e 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |drain..\|end{func|
|00000810| 64 65 73 63 7d 0a 0a 5c | 62 65 67 69 6e 7b 66 75 |desc}..\|begin{fu|
|00000820| 6e 63 64 65 73 63 7d 7b | 66 6c 75 73 68 7d 7b 7d |ncdesc}{|flush}{}|
|00000830| 0a 54 68 69 73 20 6d 65 | 74 68 6f 64 20 64 69 73 |.This me|thod dis|
|00000840| 63 61 72 64 73 20 61 6c | 6c 20 70 65 6e 64 69 6e |cards al|l pendin|
|00000850| 67 20 6f 75 74 70 75 74 | 2e 20 49 74 20 63 61 6e |g output|. It can|
|00000860| 20 62 65 20 75 73 65 64 | 20 61 76 6f 69 64 20 74 | be used| avoid t|
|00000870| 68 65 0a 73 6c 6f 77 20 | 72 65 73 70 6f 6e 73 65 |he.slow |response|
|00000880| 20 74 6f 20 61 20 75 73 | 65 72 27 73 20 73 74 6f | to a us|er's sto|
|00000890| 70 20 72 65 71 75 65 73 | 74 20 28 64 75 65 20 74 |p reques|t (due t|
|000008a0| 6f 20 62 75 66 66 65 72 | 69 6e 67 20 6f 66 20 75 |o buffer|ing of u|
|000008b0| 70 20 74 6f 20 6f 6e 65 | 0a 73 65 63 6f 6e 64 20 |p to one|.second |
|000008c0| 6f 66 20 73 6f 75 6e 64 | 29 2e 0a 5c 65 6e 64 7b |of sound|)..\end{|
|000008d0| 66 75 6e 63 64 65 73 63 | 7d 0a 0a 5c 62 65 67 69 |funcdesc|}..\begi|
|000008e0| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 67 65 74 69 |n{funcde|sc}{geti|
|000008f0| 6e 66 6f 7d 7b 7d 0a 54 | 68 69 73 20 6d 65 74 68 |nfo}{}.T|his meth|
|00000900| 6f 64 20 72 65 74 72 69 | 65 76 65 73 20 73 74 61 |od retri|eves sta|
|00000910| 74 75 73 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |tus info|rmation |
|00000920| 6c 69 6b 65 20 69 6e 70 | 75 74 20 61 6e 64 20 6f |like inp|ut and o|
|00000930| 75 74 70 75 74 20 76 6f | 6c 75 6d 65 2c 0a 65 74 |utput vo|lume,.et|
|00000940| 63 2e 20 61 6e 64 20 72 | 65 74 75 72 6e 73 20 69 |c. and r|eturns i|
|00000950| 74 20 69 6e 20 74 68 65 | 20 66 6f 72 6d 20 6f 66 |t in the| form of|
|00000960| 0a 61 6e 20 61 75 64 69 | 6f 20 73 74 61 74 75 73 |.an audi|o status|
|00000970| 20 6f 62 6a 65 63 74 2e | 20 54 68 69 73 20 6f 62 | object.| This ob|
|00000980| 6a 65 63 74 20 68 61 73 | 20 6e 6f 20 6d 65 74 68 |ject has| no meth|
|00000990| 6f 64 73 20 62 75 74 20 | 69 74 20 63 6f 6e 74 61 |ods but |it conta|
|000009a0| 69 6e 73 20 61 0a 6e 75 | 6d 62 65 72 20 6f 66 20 |ins a.nu|mber of |
|000009b0| 61 74 74 72 69 62 75 74 | 65 73 20 64 65 73 63 72 |attribut|es descr|
|000009c0| 69 62 69 6e 67 20 74 68 | 65 20 63 75 72 72 65 6e |ibing th|e curren|
|000009d0| 74 20 64 65 76 69 63 65 | 20 73 74 61 74 75 73 2e |t device| status.|
|000009e0| 20 54 68 65 20 6e 61 6d | 65 73 0a 61 6e 64 20 6d | The nam|es.and m|
|000009f0| 65 61 6e 69 6e 67 73 20 | 6f 66 20 74 68 65 20 61 |eanings |of the a|
|00000a00| 74 74 72 69 62 75 74 65 | 73 20 61 72 65 20 64 65 |ttribute|s are de|
|00000a10| 73 63 72 69 62 65 64 20 | 69 6e 0a 5c 66 69 6c 65 |scribed |in.\file|
|00000a20| 7b 2f 75 73 72 2f 69 6e | 63 6c 75 64 65 2f 73 75 |{/usr/in|clude/su|
|00000a30| 6e 2f 61 75 64 69 6f 69 | 6f 2e 68 7d 20 61 6e 64 |n/audioi|o.h} and|
|00000a40| 20 69 6e 20 74 68 65 20 | 61 75 64 69 6f 20 6d 61 | in the |audio ma|
|00000a50| 6e 20 70 61 67 65 2e 20 | 4d 65 6d 62 65 72 20 6e |n page. |Member n|
|00000a60| 61 6d 65 73 0a 61 72 65 | 20 73 6c 69 67 68 74 6c |ames.are| slightl|
|00000a70| 79 20 64 69 66 66 65 72 | 65 6e 74 20 66 72 6f 6d |y differ|ent from|
|00000a80| 20 74 68 65 69 72 20 43 | 20 63 6f 75 6e 74 65 72 | their C| counter|
|00000a90| 70 61 72 74 73 3a 20 61 | 20 73 74 61 74 75 73 20 |parts: a| status |
|00000aa0| 6f 62 6a 65 63 74 20 69 | 73 0a 6f 6e 6c 79 20 61 |object i|s.only a|
|00000ab0| 20 73 69 6e 67 6c 65 20 | 73 74 72 75 63 74 75 72 | single |structur|
|00000ac0| 65 2e 20 4d 65 6d 62 65 | 72 73 20 6f 66 20 74 68 |e. Membe|rs of th|
|00000ad0| 65 20 5c 63 6f 64 65 7b | 70 6c 61 79 7d 20 73 75 |e \code{|play} su|
|00000ae0| 62 73 74 72 75 63 74 75 | 72 65 20 68 61 76 65 0a |bstructu|re have.|
|00000af0| 5c 73 61 6d 70 7b 6f 5f | 7d 20 70 72 65 70 65 6e |\samp{o_|} prepen|
|00000b00| 64 65 64 20 74 6f 20 74 | 68 65 69 72 20 6e 61 6d |ded to t|heir nam|
|00000b10| 65 20 61 6e 64 20 6d 65 | 6d 62 65 72 73 20 6f 66 |e and me|mbers of|
|00000b20| 20 74 68 65 20 5c 63 6f | 64 65 7b 72 65 63 6f 72 | the \co|de{recor|
|00000b30| 64 7d 0a 73 74 72 75 63 | 74 75 72 65 20 68 61 76 |d}.struc|ture hav|
|00000b40| 65 20 5c 73 61 6d 70 7b | 69 5f 7d 2e 20 53 6f 2c |e \samp{|i_}. So,|
|00000b50| 20 74 68 65 20 43 20 6d | 65 6d 62 65 72 20 5c 63 | the C m|ember \c|
|00000b60| 6f 64 65 7b 70 6c 61 79 | 2e 73 61 6d 70 6c 65 5f |ode{play|.sample_|
|00000b70| 72 61 74 65 7d 20 69 73 | 0a 61 63 63 65 73 73 65 |rate} is|.accesse|
|00000b80| 64 20 61 73 20 5c 63 6f | 64 65 7b 6f 5f 73 61 6d |d as \co|de{o_sam|
|00000b90| 70 6c 65 5f 72 61 74 65 | 7d 2c 20 5c 63 6f 64 65 |ple_rate|}, \code|
|00000ba0| 7b 72 65 63 6f 72 64 2e | 67 61 69 6e 7d 20 61 73 |{record.|gain} as|
|00000bb0| 20 5c 63 6f 64 65 7b 69 | 5f 67 61 69 6e 7d 0a 61 | \code{i|_gain}.a|
|00000bc0| 6e 64 20 5c 63 6f 64 65 | 7b 6d 6f 6e 69 74 6f 72 |nd \code|{monitor|
|00000bd0| 5f 67 61 69 6e 7d 20 70 | 6c 61 69 6e 6c 79 20 61 |_gain} p|lainly a|
|00000be0| 73 20 5c 63 6f 64 65 7b | 6d 6f 6e 69 74 6f 72 5f |s \code{|monitor_|
|00000bf0| 67 61 69 6e 7d 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |gain}..\|end{func|
|00000c00| 64 65 73 63 7d 0a 0a 5c | 62 65 67 69 6e 7b 66 75 |desc}..\|begin{fu|
|00000c10| 6e 63 64 65 73 63 7d 7b | 69 62 75 66 63 6f 75 6e |ncdesc}{|ibufcoun|
|00000c20| 74 7d 7b 7d 0a 54 68 69 | 73 20 6d 65 74 68 6f 64 |t}{}.Thi|s method|
|00000c30| 20 72 65 74 75 72 6e 73 | 20 74 68 65 20 6e 75 6d | returns| the num|
|00000c40| 62 65 72 20 6f 66 20 73 | 61 6d 70 6c 65 73 20 74 |ber of s|amples t|
|00000c50| 68 61 74 20 61 72 65 20 | 62 75 66 66 65 72 65 64 |hat are |buffered|
|00000c60| 20 6f 6e 20 74 68 65 0a | 72 65 63 6f 72 64 69 6e | on the.|recordin|
|00000c70| 67 20 73 69 64 65 2c 20 | 69 2e 65 2e 0a 74 68 65 |g side, |i.e..the|
|00000c80| 20 70 72 6f 67 72 61 6d | 20 77 69 6c 6c 20 6e 6f | program| will no|
|00000c90| 74 20 62 6c 6f 63 6b 20 | 6f 6e 20 61 20 5c 63 6f |t block |on a \co|
|00000ca0| 64 65 7b 72 65 61 64 7d | 20 63 61 6c 6c 20 6f 66 |de{read}| call of|
|00000cb0| 20 73 6f 20 6d 61 6e 79 | 20 73 61 6d 70 6c 65 73 | so many| samples|
|00000cc0| 2e 0a 5c 65 6e 64 7b 66 | 75 6e 63 64 65 73 63 7d |..\end{f|uncdesc}|
|00000cd0| 0a 0a 5c 62 65 67 69 6e | 7b 66 75 6e 63 64 65 73 |..\begin|{funcdes|
|00000ce0| 63 7d 7b 6f 62 75 66 63 | 6f 75 6e 74 7d 7b 7d 0a |c}{obufc|ount}{}.|
|00000cf0| 54 68 69 73 20 6d 65 74 | 68 6f 64 20 72 65 74 75 |This met|hod retu|
|00000d00| 72 6e 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |rns the |number o|
|00000d10| 66 20 73 61 6d 70 6c 65 | 73 20 62 75 66 66 65 72 |f sample|s buffer|
|00000d20| 65 64 20 6f 6e 20 74 68 | 65 20 70 6c 61 79 62 61 |ed on th|e playba|
|00000d30| 63 6b 0a 73 69 64 65 2e | 20 55 6e 66 6f 72 74 75 |ck.side.| Unfortu|
|00000d40| 6e 61 74 65 6c 79 2c 20 | 74 68 69 73 20 6e 75 6d |nately, |this num|
|00000d50| 62 65 72 20 63 61 6e 6e | 6f 74 20 62 65 20 75 73 |ber cann|ot be us|
|00000d60| 65 64 20 74 6f 20 64 65 | 74 65 72 6d 69 6e 65 20 |ed to de|termine |
|00000d70| 61 20 6e 75 6d 62 65 72 | 0a 6f 66 20 73 61 6d 70 |a number|.of samp|
|00000d80| 6c 65 73 20 74 68 61 74 | 20 63 61 6e 20 62 65 20 |les that| can be |
|00000d90| 77 72 69 74 74 65 6e 20 | 77 69 74 68 6f 75 74 20 |written |without |
|00000da0| 62 6c 6f 63 6b 69 6e 67 | 20 73 69 6e 63 65 20 74 |blocking| since t|
|00000db0| 68 65 20 6b 65 72 6e 65 | 6c 0a 6f 75 74 70 75 74 |he kerne|l.output|
|00000dc0| 20 71 75 65 75 65 20 6c | 65 6e 67 74 68 20 73 65 | queue l|ength se|
|00000dd0| 65 6d 73 20 74 6f 20 62 | 65 20 76 61 72 69 61 62 |ems to b|e variab|
|00000de0| 6c 65 2e 0a 5c 65 6e 64 | 7b 66 75 6e 63 64 65 73 |le..\end|{funcdes|
|00000df0| 63 7d 0a 0a 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |c}..\beg|in{funcd|
|00000e00| 65 73 63 7d 7b 72 65 61 | 64 7d 7b 73 69 7a 65 7d |esc}{rea|d}{size}|
|00000e10| 0a 54 68 69 73 20 6d 65 | 74 68 6f 64 20 72 65 61 |.This me|thod rea|
|00000e20| 64 73 20 5c 76 61 72 7b | 73 69 7a 65 7d 20 73 61 |ds \var{|size} sa|
|00000e30| 6d 70 6c 65 73 20 66 72 | 6f 6d 20 74 68 65 20 61 |mples fr|om the a|
|00000e40| 75 64 69 6f 20 69 6e 70 | 75 74 20 61 6e 64 20 72 |udio inp|ut and r|
|00000e50| 65 74 75 72 6e 73 0a 74 | 68 65 6d 20 61 73 20 61 |eturns.t|hem as a|
|00000e60| 20 70 79 74 68 6f 6e 20 | 73 74 72 69 6e 67 2e 20 | python |string. |
|00000e70| 54 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 62 6c 6f |The func|tion blo|
|00000e80| 63 6b 73 20 75 6e 74 69 | 6c 20 65 6e 6f 75 67 68 |cks unti|l enough|
|00000e90| 20 64 61 74 61 20 69 73 | 20 61 76 61 69 6c 61 62 | data is| availab|
|00000ea0| 6c 65 2e 0a 5c 65 6e 64 | 7b 66 75 6e 63 64 65 73 |le..\end|{funcdes|
|00000eb0| 63 7d 0a 0a 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |c}..\beg|in{funcd|
|00000ec0| 65 73 63 7d 7b 73 65 74 | 69 6e 66 6f 7d 7b 73 74 |esc}{set|info}{st|
|00000ed0| 61 74 75 73 7d 0a 54 68 | 69 73 20 6d 65 74 68 6f |atus}.Th|is metho|
|00000ee0| 64 20 73 65 74 73 20 74 | 68 65 20 61 75 64 69 6f |d sets t|he audio|
|00000ef0| 20 64 65 76 69 63 65 20 | 73 74 61 74 75 73 20 70 | device |status p|
|00000f00| 61 72 61 6d 65 74 65 72 | 73 2e 20 54 68 65 20 5c |arameter|s. The \|
|00000f10| 76 61 72 7b 73 74 61 74 | 75 73 7d 0a 70 61 72 61 |var{stat|us}.para|
|00000f20| 6d 65 74 65 72 20 69 73 | 20 61 6e 20 64 65 76 69 |meter is| an devi|
|00000f30| 63 65 20 73 74 61 74 75 | 73 20 6f 62 6a 65 63 74 |ce statu|s object|
|00000f40| 20 61 73 20 72 65 74 75 | 72 6e 65 64 20 62 79 20 | as retu|rned by |
|00000f50| 5c 63 6f 64 65 7b 67 65 | 74 69 6e 66 6f 7d 20 61 |\code{ge|tinfo} a|
|00000f60| 6e 64 0a 70 6f 73 73 69 | 62 6c 79 20 6d 6f 64 69 |nd.possi|bly modi|
|00000f70| 66 69 65 64 20 62 79 20 | 74 68 65 20 70 72 6f 67 |fied by |the prog|
|00000f80| 72 61 6d 2e 0a 5c 65 6e | 64 7b 66 75 6e 63 64 65 |ram..\en|d{funcde|
|00000f90| 73 63 7d 0a 0a 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|00000fa0| 64 65 73 63 7d 7b 77 72 | 69 74 65 7d 7b 73 61 6d |desc}{wr|ite}{sam|
|00000fb0| 70 6c 65 73 7d 0a 57 72 | 69 74 65 20 69 73 20 70 |ples}.Wr|ite is p|
|00000fc0| 61 73 73 65 64 20 61 20 | 70 79 74 68 6f 6e 20 73 |assed a |python s|
|00000fd0| 74 72 69 6e 67 20 63 6f | 6e 74 61 69 6e 69 6e 67 |tring co|ntaining|
|00000fe0| 20 61 75 64 69 6f 20 73 | 61 6d 70 6c 65 73 20 74 | audio s|amples t|
|00000ff0| 6f 20 62 65 20 70 6c 61 | 79 65 64 2e 0a 49 66 20 |o be pla|yed..If |
|00001000| 74 68 65 72 65 20 69 73 | 20 65 6e 6f 75 67 68 20 |there is| enough |
|00001010| 62 75 66 66 65 72 20 73 | 70 61 63 65 20 66 72 65 |buffer s|pace fre|
|00001020| 65 20 69 74 20 77 69 6c | 6c 20 69 6d 6d 65 64 69 |e it wil|l immedi|
|00001030| 61 74 65 6c 79 20 72 65 | 74 75 72 6e 2c 0a 6f 74 |ately re|turn,.ot|
|00001040| 68 65 72 77 69 73 65 20 | 69 74 20 77 69 6c 6c 20 |herwise |it will |
|00001050| 62 6c 6f 63 6b 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |block..\|end{func|
|00001060| 64 65 73 63 7d 0a 0a 54 | 68 65 72 65 20 69 73 20 |desc}..T|here is |
|00001070| 61 20 63 6f 6d 70 61 6e | 69 6f 6e 20 6d 6f 64 75 |a compan|ion modu|
|00001080| 6c 65 2c 20 5c 63 6f 64 | 65 7b 53 55 4e 41 55 44 |le, \cod|e{SUNAUD|
|00001090| 49 4f 44 45 56 7d 2c 20 | 77 68 69 63 68 20 64 65 |IODEV}, |which de|
|000010a0| 66 69 6e 65 73 20 75 73 | 65 66 75 6c 0a 73 79 6d |fines us|eful.sym|
|000010b0| 62 6f 6c 69 63 20 63 6f | 6e 73 74 61 6e 74 73 20 |bolic co|nstants |
|000010c0| 6c 69 6b 65 20 5c 63 6f | 64 65 7b 4d 49 4e 5f 47 |like \co|de{MIN_G|
|000010d0| 41 49 4e 7d 2c 20 5c 63 | 6f 64 65 7b 4d 41 58 5f |AIN}, \c|ode{MAX_|
|000010e0| 47 41 49 4e 7d 2c 0a 5c | 63 6f 64 65 7b 53 50 45 |GAIN},.\|code{SPE|
|000010f0| 41 4b 45 52 7d 2c 20 65 | 74 63 2e 20 54 68 65 20 |AKER}, e|tc. The |
|00001100| 6e 61 6d 65 73 20 6f 66 | 0a 74 68 65 20 63 6f 6e |names of|.the con|
|00001110| 73 74 61 6e 74 73 20 61 | 72 65 20 74 68 65 20 73 |stants a|re the s|
|00001120| 61 6d 65 20 6e 61 6d 65 | 73 20 61 73 20 75 73 65 |ame name|s as use|
|00001130| 64 20 69 6e 20 74 68 65 | 20 43 20 69 6e 63 6c 75 |d in the| C inclu|
|00001140| 64 65 20 66 69 6c 65 0a | 5c 66 69 6c 65 7b 3c 73 |de file.|\file{<s|
|00001150| 75 6e 2f 61 75 64 69 6f | 69 6f 2e 68 3e 7d 2c 20 |un/audio|io.h>}, |
|00001160| 77 69 74 68 20 74 68 65 | 20 6c 65 61 64 69 6e 67 |with the| leading|
|00001170| 20 73 74 72 69 6e 67 20 | 5c 73 61 6d 70 7b 41 55 | string |\samp{AU|
|00001180| 44 49 4f 5f 7d 20 73 74 | 72 69 70 70 65 64 2e 0a |DIO_} st|ripped..|
|00001190| 0a 55 73 65 61 62 69 6c | 69 74 79 20 6f 66 20 74 |.Useabil|ity of t|
|000011a0| 68 65 20 63 6f 6e 74 72 | 6f 6c 20 64 65 76 69 63 |he contr|ol devic|
|000011b0| 65 20 69 73 20 6c 69 6d | 69 74 65 64 20 61 74 20 |e is lim|ited at |
|000011c0| 74 68 65 20 6d 6f 6d 65 | 6e 74 2c 20 73 69 6e 63 |the mome|nt, sinc|
|000011d0| 65 20 74 68 65 72 65 0a | 69 73 20 6e 6f 20 77 61 |e there.|is no wa|
|000011e0| 79 20 74 6f 20 75 73 65 | 20 74 68 65 20 60 60 77 |y to use| the ``w|
|000011f0| 61 69 74 20 66 6f 72 20 | 73 6f 6d 65 74 68 69 6e |ait for |somethin|
|00001200| 67 20 74 6f 20 68 61 70 | 70 65 6e 27 27 20 66 65 |g to hap|pen'' fe|
|00001210| 61 74 75 72 65 20 74 68 | 65 0a 64 65 76 69 63 65 |ature th|e.device|
|00001220| 20 70 72 6f 76 69 64 65 | 73 2e 0a | provide|s.. |
+--------+-------------------------+-------------------------+--------+--------+