
    h	                        S SK r S SKJr  S SKJr  S SKrS SKr\R                  S\R                  S\R                  S\R                  S\R                  S\R                  S	0r SS
\R                  S\\   S\\   SS4S jjrg)    N)platform)Optionalu8s16s32s64fltdblwaveformsample_ratedevicereturnc           	      n   [         S:X  a  U=(       d    SnSnO[        S[          35      e[        [        R                  R
                  R                  5       R                  5       5      nX$;  a  [        SU SU 35      eU R                  [        ;  a-  [        SU R                   S[        R                  5        35      e[        U R                     nU R                  S	:w  a  [        S
U R                   S35      eU R                  5       u  pgUS	:  a  [        R                  " SU S3S	S9  [        R                  R                  X2S9nUR!                  XUS9  Sn	UR#                  5          [%        SXi5       H  n
UR'                  SX
X-   2SS24   5        M!     SSS5        g! , (       d  f       g= f)a  Plays audio through specified or available output device.

.. warning::
   This function is currently only supported on MacOS, and requires
   libavdevice (FFmpeg) with ``audiotoolbox`` output device.

.. note::
   This function can play up to two audio channels.

Args:
    waveform: Tensor containing the audio to play.
        Expected shape: `(time, num_channels)`.
    sample_rate: Sample rate of the audio to play.
    device: Output device to use. If None, the default device is used.
darwinaudiotoolbox-z5This function only supports MacOS, but current OS is zDevice z* is not available. Available devices are: zUnsupported type z". The list of supported types is:    z:Expected 2D tensor with shape `(time, num_channels)`, got zD tensor insteadzExpected up to 2 channels, got z< channels instead. Only the first 2 channels will be played.)
stacklevel)dstformat)r      r   N)r   
ValueErrorlist
torchaudioutilsffmpeg_utilsget_output_deviceskeysdtypedict_formatndimsizewarningswarnioStreamWriteradd_audio_streamopenrangewrite_audio_chunk)r   r   r   pathavailable_devicesr   timenum_channelss
block_sizeis              O/var/www/auris/envauris/lib/python3.13/site-packages/torchaudio/io/_playback.py
play_audior3      s   * 8)>PQYPZ[\\Z--::MMOTTVW&76(*TUfTghii~~[(,X^^,<<^_j_o_o_q^rstt(F}}UV^VcVcUddtuvv!Da-l^ <8 8	
 	""t";A{@ J	
q$+A8,>,A#BC , 
s   -0F&&
F4)N)r#   sysr   typingr   torchr   uint8int16int32int64float32float64r    Tensorfloatstrr3        r2   <module>rB      s         
KK	KK	KK	KK	MM5	MM5 !6Dll6D%6D SM6D 
	6DrA   