Exemplo n.º 1
0
    def __init__(self):
        Player.__init__(self)
        
        self.volume = 50
        
        self.pipeline = Gst.Pipeline()
        
        self.source = Gst.ElementFactory.make("filesrc", "source")
        self.decoder = Gst.ElementFactory.make("decodebin", "decoder")
        self.convert = Gst.ElementFactory.make('audioconvert', 'convert')
        self.volctrl = Gst.ElementFactory.make('volume', "volume")
        self.output = Gst.ElementFactory.make("autoaudiosink", "sink")

        if not self.source:
            # print("Cannot initialize audio source")
            return
        if not self.decoder:
            # print("Cannot initialize audio decoder")
            return
        if not self.convert:
            # print("Cannot initialize audio convert")
            return
        if not self.output:
            # print("Cannot initialize audio output")
            return
        if not self.volctrl:
            # print("Cannot initialize audio volume control")
            return

        self.pipeline.add(self.source)
        self.pipeline.add(self.decoder)
        self.pipeline.add(self.convert)
        self.pipeline.add(self.volctrl)
        self.pipeline.add(self.output)
            
        self.source.link(self.decoder)
        self.decoder.link(self.convert)
        self.convert.link(self.volctrl)
        self.volctrl.link(self.output)

        self.decoder.connect("pad-added", self._new_decoded_pad_cb)

        bus = self.pipeline.get_bus()
        bus.add_signal_watch()
        bus.connect("message", self._on_bus_message)
        
        self.volctrl.set_property('volume', self.volume/100.0)
        
        self.pipeline.set_state(Gst.State.READY)
        
        self.mainloop_thread = GstThread(mainloop)
        
        self.mainloop_thread.start()
Exemplo n.º 2
0
Arquivo: ai.py Projeto: mpaulin/HS_AI
 def __init__(self, *args, **kwargs):
     Player.__init__(self, *args)
     self.maxloss = kwargs.get('maxloss',3)
     self.timeout = kwargs.get('timeout',1)
Exemplo n.º 3
0
 def __init__(self, nof_dice, player_id):
     Player.__init__(self, nof_dice=nof_dice, player_id=player_id)
     # super(Player.Player, self).__init__() ??
     self.newVar = "dummy"
Exemplo n.º 4
0
 def __init__(self, name, idx, env):
     Player.__init__(self, None, None, name)
     self.idx = idx
     self.env = env
Exemplo n.º 5
0
 def __init__(self, name):
     Player.__init__(self, None, None, name)
Exemplo n.º 6
0
 def __init__(self, player, game):
     Player.__init__(self, player, game)
Exemplo n.º 7
0
 def __init__(self, board, symbol, mode):
     Player.__init__(self, board, symbol)
     self.game_mode = mode
     self.player2Symbol = 'X'
     if (symbol == 'X'):
         self.player2Symbol = 'O'
Exemplo n.º 8
0
 def __init__(self, nof_dice, player_id, memory=True):
     Player.__init__(self, nof_dice=nof_dice, player_id=player_id)
     self.m = memory