Exemplo n.º 1
0
 def play_sound_async(self, sound, gain=1.0, **kwargs):
     """Async version of play_sound()"""
     fv = FloatValue()
     fv.value = gain
     request = audio_pb2.PlaySoundRequest(sound=sound, gain=fv)
     return self.call_async(self._stub.PlaySound, request, self._play_sound_from_response,
                            self._audio_error_from_response, **kwargs)
Exemplo n.º 2
0
 def play_sound(self, sound, gain=None, **kwargs):
     """Play already uploaded sound with optional volume gain multiplier"""
     if gain:
         fv = FloatValue()
         fv.value = gain
         request = audio_pb2.PlaySoundRequest(sound=sound, gain=fv)
     else:
         request = audio_pb2.PlaySoundRequest(sound=sound)
     return self.call(self._stub.PlaySound, request, self._play_sound_from_response,
                      self._audio_error_from_response, **kwargs)