%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/orca/__pycache__/sound.cpython-312.pyc

�

g
f����dZdZdZdZdZdZddlZddlmZ	ejd	d
�ddlm
Z
e
jd�\aZ
d
dlmZd
dlmZmZGd�d�Ze�Zd�Zy#e$rdaY�,wxYw)zUtilities for playing sounds.z$Id:$z$Revision:$z$Date:$zCopyright (c) 2016 Orca Team�LGPL�N)�GLib�Gstz1.0)rF�)�debug)�Icon�Tonec�T�eZdZdZd�Zd�Zd�Zd�Zd
d�Zd
d�Z	d�Z
d
d	�Zdd�Zd�Z
y
)�PlayerzPlays Icons and Tones.c���d|_d|_d|_d|_d|_t
s(d}t
jtj|d�y|j�y)NFz'SOUND ERROR: Gstreamer is not availableT)
�_initialized�_source�_sink�_player�	_pipeline�_gstreamerAvailabler�printMessage�
LEVEL_INFO�init)�self�msgs  �,/usr/lib/python3/dist-packages/orca/sound.py�__init__zPlayer.__init__-sR��!��������
�������"�;�C����u�/�/��d�;���	�	��c���|jtjjk(r4|jjtjj�y|jtjjk(rq|jjtjj�|j�\}}d|��}tjtj|d�yy�Nz
SOUND ERROR: T)
�typer�MessageType�EOSr�	set_state�State�NULL�ERROR�parse_errorrrr�r�bus�message�error�infors      r�_onPlayerMessagezPlayer._onPlayerMessage;s����<�<�3�?�?�.�.�.��L�L�"�"�3�9�9�>�>�2�
�\�\�S�_�_�2�2�
2��L�L�"�"�3�9�9�>�>�2�!�-�-�/�K�E�4�!�%��)�C����u�/�/��d�;�	3rc���|jtjjk(r4|jjtjj�y|jtjjk(rq|jjtjj�|j�\}}d|��}tjtj|d�yyr)
rrrrrr r!r"r#r$rrrr%s      r�_onPipelineMessagezPlayer._onPipelineMessageDs����<�<�3�?�?�.�.�.��N�N�$�$�S�Y�Y�^�^�4�
�\�\�S�_�_�2�2�
2��N�N�$�$�S�Y�Y�^�^�4�!�-�-�/�K�E�4�!�%��)�C����u�/�/��d�;�	3rc�V�|jtjj�y)NF)r rr!r"�r�elements  r�
_onTimeoutzPlayer._onTimeoutMs�����#�)�)�.�.�)�rc�&�|r3|jjtjj�|jjdd|j���|jjtjj�y)zIPlays a sound icon, interrupting the current play first unless specified.�urizfile://N)rr rr!r"�set_property�path�PLAYING)r�icon�	interrupts   r�	_playIconzPlayer._playIconQs\����L�L�"�"�3�9�9�>�>�2����!�!�%�7�4�9�9�+�)>�?������s�y�y�0�0�1rc�>�|r3|jjtjj�|j
j
d|j�|j
j
d|j�|j
j
d|j�|jjtjj�td|jz�}tj||j|j�y)zCPlays a tone, interrupting the current play first unless specified.�volume�freq�wavei�N)rr rr!r"rr3r:�	frequencyr<r5�int�durationr�timeout_addr0)r�toner7r?s    r�	_playTonezPlayer._playToneZs�����N�N�$�$�S�Y�Y�^�^�4����!�!�(�D�K�K�8����!�!�&�$�.�.�9����!�!�&�$�)�)�4���� � ����!2�!2�3��t�d�m�m�+�,������4�?�?�D�N�N�Crc���|jrytsytjj	dd�|_|j
�(d}t
jtj|d�y|j
j�}|j�|jd|j�tjd��|_|jj�}|j�|jd|j�tjj	d	d
�|_tjj	dd�|_|j �|j"�y|jj%|j �|jj%|j"�|j j'|j"�d|_y)
z(Re)Initializes the Player.N�playbin�playerz7SOUND ERROR: Gstreamer is available, but player is NoneTr'z
orca-pipeline)�name�audiotestsrc�src�
autoaudiosink�output)r
rr�ElementFactory�makerrrr�get_bus�add_signal_watch�connectr*�Pipelinerr,rr�add�link)rrr&s   rrzPlayer.initgsb������"���)�)�.�.�y�(�C����<�<��K�C����u�/�/��d�;���l�l�"�"�$���������I�t�4�4�5����?�;����n�n�$�$�&���������I�t�6�6�7��)�)�.�.�~�u�E����'�'�,�,�_�h�G��
��<�<��4�:�:�#5�������4�<�<�(������4�:�:�&������$�*�*�%� ��rc���t|t�r|j||�yt|t�r|j	||�yd|dg}tjt
j|d�y)zDPlays a sound, interrupting the current play first unless specified.zSOUND ERROR:zis not an Icon or ToneTN)�
isinstancerr8r	rBr�printTokensr)r�itemr7�tokenss    r�playzPlayer.play�sY���d�D�!��N�N�4��+�
��d�
#��N�N�4��+�$�d�,D�E�F����e�.�.���=rNc�h�tsy|r*|jtjj�y|j
r3|j
jtjj�|jr4|jjtjj�yy)zStops play.N)rr rr!r"rrr.s  r�stopzPlayer.stop�sm��#������c�i�i�n�n�-���<�<��L�L�"�"�3�9�9�>�>�2��>�>��N�N�$�$�S�Y�Y�^�^�4�rc�D�tsy|j�d|_day)zShuts down the sound utilities.NF)rrZr
)rs r�shutdownzPlayer.shutdown�s!��#���	�	��!���#�r)T�N)�__name__�
__module__�__qualname__�__doc__rr*r,r0r8rBrrXrZr\�rrrr*s9�� ��<�<��2�D�!!�F	>�5� 	$rrc��tSr])rrbrr�	getPlayerrd�s���Nr)ra�__id__�__version__�__date__�
__copyright__�__license__�gi�
gi.repositoryr�require_versionr�
init_checkr�args�	Exception�r�sound_generatorrr	rrrdrbrr�<module>rrs���($�������.�
���	��5��B���u�e�$�!�!/����t� 4�����'�D$�D$�L�(����a� ��� �s�A)�)A3�2A3

Zerion Mini Shell 1.0