Your IP : 3.145.44.46


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/audiodev.pyc

�
zfc@s�dZddlmZeddd�[ddgZdefd��YZd	dd
��YZddd��YZd
�Zdd�Z
edkr�e
�ndS(sGClasses for manipulating audio devices (currently only for Sun and SGI)i����(twarnpy3ks2the audiodev module has been removed in Python 3.0t
stackleveliterrortAudioDevcBseZRS((t__name__t
__module__(((s /usr/lib64/python2.7/audiodev.pyRstPlay_Audio_sgicBs�eZdZd
ZZZd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zd�ZRS(icCs�ddl}d|jfd|jfd|jfd|jfd|jfd|jfd|jfg|_d	|j	fd
|j
fd|jfg|_d	|j
fd
|jfd|jfg|_d	|_dS(
Ni����i��iD�i}i"Vi�>i+i@iiii(tALt
RATE_48000t
RATE_44100t
RATE_32000t
RATE_22050t
RATE_16000t
RATE_11025t	RATE_8000t
frameratelisttMONOtSTEREOtQUADROt
nchannelslisttSAMPLE_8t	SAMPLE_16t	SAMPLE_24t
sampwidthlisttclassinited(tselfR((s /usr/lib64/python2.7/audiodev.pyt	initclassscCs�ddl}ddl}|js.|j�ng|_|jdg|_|j�|_d|_	d|_
d|_d|_
d|_dS(Ni����i(talRRRt	oldparamstOUTPUT_RATEtparamst	newconfigtconfigtinited_outratetinited_widthtinited_nchannelstNonet	convertertport(RRR((s /usr/lib64/python2.7/audiodev.pyt__init__+s	
						cCs]|jr|j�n|jrYddl}ddl}|j|j|j�g|_ndS(Ni����(R&tstopRRRt	setparamstDEFAULT_DEVICE(RRR((s /usr/lib64/python2.7/audiodev.pyt__del__9s	
	cCsP|js
dSddl}x&|jj�dkrA|jd�qW|j�dS(Ni����ig�������?(R&ttimet	getfilledtsleepR((RR,((s /usr/lib64/python2.7/audiodev.pytwaitAs	cCsi|jr"|jj�d|_n|jreddl}ddl}|j|j|j�g|_ndS(Ni����(R&t	closeportR$RRRR)R*(RRR((s /usr/lib64/python2.7/audiodev.pyR(Is	
	cCsMxF|jD]2\}}||kr
||jd<d|_Pq
q
Wtd�dS(Nisbad output rate(RRR!R(Rtratetrawtcooked((s /usr/lib64/python2.7/audiodev.pyt
setoutrateRs
	cCs�x�|jD]5\}}||kr
|jj|�d|_Pq
q
W|dkr�ddl}d|_|jj|j�|j|_n	td�dS(Niii����sbad sample width(	RR tsetwidthR"RRtulaw2linR%R(RtwidthR2R3R((s /usr/lib64/python2.7/audiodev.pytsetsampwidth[s		cCsPxI|jD]5\}}||kr
|jj|�d|_Pq
q
Wtd�dS(Nisbad # of channels(RR tsetchannelsR#R(Rt	nchannelsR2R3((s /usr/lib64/python2.7/audiodev.pytsetnchannelsjs	cCs�|jo|jstd�n|js�ddl}ddl}|jdd|j�|_|j|_	|j
|j|j	�|j|j|j�n|j
r�|j
|�}n|jj|�dS(Nsparams not specifiedi����tPythontw(R!R#RR&RRtopenportR RRt	getparamsR*R)R%t
writesamps(RtdataRR((s /usr/lib64/python2.7/audiodev.pytwriteframesss	
	cCs|jr|jj�SdSdS(Ni(R&R-(R((s /usr/lib64/python2.7/audiodev.pyR-�s	
cCs'|jr|jj�S|jj�SdS(N(R&tgetfillableR tgetqueuesize(R((s /usr/lib64/python2.7/audiodev.pyRC�s	
cCsddl}|j|d�S(Ni����i(taudioopR6(RRARE((s /usr/lib64/python2.7/audiodev.pyR6�sN(RRRR$RRRRR'R+R/R(R4R8R;RBR-RCR6(((s /usr/lib64/python2.7/audiodev.pyRs												
			tPlay_Audio_suncBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cCsLd|_d|_d|_d|_d|_d|_d|_d|_dS(Ni(	toutratet	sampwidthR:R!R"R#R$R%R&(R((s /usr/lib64/python2.7/audiodev.pyR'�s								cCs|j�dS(N(R((R((s /usr/lib64/python2.7/audiodev.pyR+�scCs||_d|_dS(Ni(RGR!(RR1((s /usr/lib64/python2.7/audiodev.pyR4�s	cCs||_d|_dS(Ni(RHR"(RR7((s /usr/lib64/python2.7/audiodev.pyR8�s	cCs||_d|_dS(Ni(R:R#(RR:((s /usr/lib64/python2.7/audiodev.pyR;�s	cCs|jo|jo|js'td�n|js�ddl}ddl}|jd�|_|jj�}|j	|_
|j|_|j
dkr�d|_|j|_q�d|j
|_|j|_|jj|�n|jr�|j|�}n|jj|�dS(Nsparams not specifiedi����R=ii(R!R"R#RR&tsunaudiodevtSUNAUDIODEVtopentgetinfoRGt
o_sample_rateR:t
o_channelsRHto_precisiont
ENCODING_ULAWt
o_encodingtENCODING_LINEARtsetinfoR%twrite(RRARIRJtinfo((s /usr/lib64/python2.7/audiodev.pyRB�s"			cCs(|js
dS|jj�|j�dS(N(R&tdrainR((R((s /usr/lib64/python2.7/audiodev.pyR/�s	
cCs3|jr/|jj�|jj�d|_ndS(N(R&tflushtcloseR$(R((s /usr/lib64/python2.7/audiodev.pyR(�s	

cCs|jr|jj�SdSdS(Ni(R&t	obufcount(R((s /usr/lib64/python2.7/audiodev.pyR-�s	
(RRR'R+R4R8R;RBR/R(R-(((s /usr/lib64/python2.7/audiodev.pyRF�s								cCs�yddl}Wnstk
r�yddl}t�SWq�tk
r�yddl}Wntk
rstd�q�X|j�Sq�XnXt�SdS(Ni����sno audio device(RtImportErrorRIRFt	Audio_macRtPlay_Audio_macR(RRIR[((s /usr/lib64/python2.7/audiodev.pyR�s



cCsddl}|jdr)|jd}nd}ddl}|j|d�}|G|j�GHt�}|j|j��|j|j	��|j
|j��|j�|j	�|j�}x5|j|�}|s�Pnt
|�GH|j|�q�W|j�dS(Ni����isf:just samples:just.aiftr(tsystargvtaifcRKR?RR4tgetframerateR8tgetsampwidthR;tgetnchannelst
readframestlenRBR/(tfnR^R`taftptBUFSIZRA((s /usr/lib64/python2.7/audiodev.pyttest�s&
	 t__main__N(((t__doc__twarningsRt__all__t	ExceptionRRRFRR$RjR(((s /usr/lib64/python2.7/audiodev.pyt<module>s�I	

?>