
2:\c           @  sa   d  d l  m Z d  d l Z d  d l Z d  d l m Z e j d  Z d e f d     YZ	 d S(   i(   t   print_functionN(   t   MusicContextt   VideoPlayert   IOSVideoChannelc           B  s   e  Z d  d  d d  Z d   Z e e  Z d   Z d   Z d   Z	 d   Z
 e d  Z d   Z d	   Z e e d
 d e d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   t    c         C  s   g  |  _  d  |  _ d  |  _ | |  _ d  |  _ d |  _ d  |  _ t |  _	 t |  _
 g  |  _ | |  _ | |  _ | d  k r t |  _ t |  _ n | |  _ t |  _ d  S(   Ni    (   t   queuet   Nonet   filenamet   playert   namet   mixert   last_changedt   callbackt   Falset   synchro_startt	   wait_stopt   loopt   file_prefixt   file_suffixt   Truet   default_loopt   default_loop_set(   t   selfR	   R   R   R   (    (    s   renpy/audio/ioshw.pyt   __init__   s"    														c         C  sK   t  j j   j } | j |  j  } | d k rG t   } | |  j <n  | S(   s   
        Returns the MusicContext corresponding to this channel, taken from
        the context object. Allocates a MusicContext if none exists.
        N(   t   renpyt   gamet   contextt   musict   getR	   R   R   (   R   t   mcdt   rv(    (    s   renpy/audio/ioshw.pyt   get_context9   s
    c         C  s_   |  j  s d S|  j  j d  } t j j |  } | j } | |  _ t j   j	 |  |  _
 d S(   s>   
        Starts playing the first video in the queue.
        Ni    (   R   t   popR   t   loadert   loadR	   R   R   t   alloct   initWithFile_R   (   R   R   t   ft   real_fn(    (    s   renpy/audio/ioshw.pyt   startI   s    			c         C  s5   |  j  d  k	 r( |  j  j   d  |  _  n  d  |  _ d  S(   N(   R   R   t   stopR   (   R   (    (    s   renpy/audio/ioshw.pyR(   Y   s    c         C  s-   |  j  d  k r d  S|  j  j   r) |  j Sd  S(   N(   R   R   t	   isPlayingR   (   R   (    (    s   renpy/audio/ioshw.pyt   get_playinga   s    c         C  sT   |  j  j } | r* |  j   |  j   d  S|  j   r: d  S|  j rP |  j   n  d  S(   N(   R   t
   force_stopt   dequeueR(   R*   R   R'   (   R   R+   (    (    s   renpy/audio/ioshw.pyt   periodici   s    

	c         C  s,   |  j    r g  |  _ n |  j d  |  _ d S(   se   
        Clears the queued music, except for a first item that has
        not been started.
        i   N(   R*   R   (   R   t
   even_tight(    (    s   renpy/audio/ioshw.pyR,   z   s    c         C  s   |  j    d S(   s7   
        Called (mostly) once per interaction.
        N(   R-   (   R   (    (    s   renpy/audio/ioshw.pyt   interact   s    c         C  s   |  j    g  |  _ d S(   s   
        Causes the playing music to be faded out for the given number
        of seconds. Also clears any queued music.
        N(   R(   R   (   R   t   secs(    (    s   renpy/audio/ioshw.pyt   fadeout   s    
i    c         C  s   |  j  j |  d  S(   N(   R   t   extend(   R   t	   filenamesR   R   t   fadeint   tightt	   loop_only(    (    s   renpy/audio/ioshw.pyt   enqueue   s    c         C  s#   |  j  d  k	 r |  j  j   n  d  S(   N(   R   R   t   pause(   R   (    (    s   renpy/audio/ioshw.pyR8      s    c         C  s#   |  j  d  k	 r |  j  j   n  d  S(   N(   R   R   t   unpause(   R   (    (    s   renpy/audio/ioshw.pyR9      s    c         C  s   d  S(   N(    (   R   t   volume(    (    s   renpy/audio/ioshw.pyt
   set_volume   s    c         C  s   d  S(   N(    (   R   (    (    s   renpy/audio/ioshw.pyt   get_pos   s    c         C  s   d  S(   N(    (   R   t   pant   delay(    (    s   renpy/audio/ioshw.pyt   set_pan   s    c         C  s   d  S(   N(    (   R   R:   R>   (    (    s   renpy/audio/ioshw.pyt   set_secondary_volume   s    N(   t   __name__t
   __module__R   R   R   t   propertyR   R'   R(   R*   R-   R   R,   R/   R1   R   R7   R8   R9   R;   R<   R?   R@   (    (    (    s   renpy/audio/ioshw.pyR      s"   ,													(
   t
   __future__R    R   t   pyobjust   renpy.audio.audioR   t	   autoclassR   t   objectR   (    (    (    s   renpy/audio/ioshw.pyt   <module>   s
   