mò %U²Ic@sAdZdZdefd„ƒYZd„Zd„Zd„ZdS(sInterpret sun audio headers.s.sndterrorcBstZRS(N(t__name__t __module__(((t%/data/zmath/lib/python2.4/sunaudio.pyRscCsDt|dƒd>t|dƒd>Bt|dƒd>Bt|dƒBS( s"Convert a 4-char value to integer.iiiiiiiN(tordts(R((Rt get_long_be scCsé|idƒtjo td‚nt|idƒƒ}t|idƒƒ}t|idƒƒ}t|idƒƒ}t|idƒƒ}|d}|djo td‚n|djo|i|ƒ}nd}|||||fS(s&Read a sound header from an open file.isgethdr: bad magic wordiisgethdr: bad hdr_sizetN( tfptreadtMAGICRRthdr_sizet data_sizetencodingt sample_ratetchannelstexcesstinfo(RR R RRRRR ((Rtgethdrs     cCstt|dƒƒ}|\}}}}}x |ddjo|d }q-WdG|GHdG|GHdG|GHdG|GHdG|GHd Gt |ƒGHd S( s0Read and print the sound header of a named file.triÿÿÿÿts File name: s Data size: s Encoding: s Sample rate:s Channels: s Info: N( RtopentfilethdrR R RRRtrepr(RRRR RRR ((Rtprinthdr!s     N(t__doc__R t ExceptionRRRR(RR RRR((Rt?s