From 0114ad22844fed75c8413ddbea160c61aff6ff7a Mon Sep 17 00:00:00 2001 From: Yuki Furuta Date: Fri, 1 Jul 2016 16:13:36 +0900 Subject: [PATCH] [sound_play/scripts/soundplay_node.py] updates states and force stop when ends playing --- sound_play/scripts/soundplay_node.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sound_play/scripts/soundplay_node.py b/sound_play/scripts/soundplay_node.py index fadde3ba..1168cd83 100755 --- a/sound_play/scripts/soundplay_node.py +++ b/sound_play/scripts/soundplay_node.py @@ -99,7 +99,7 @@ def __init__(self, file, volume = 1.0): def on_stream_end(self, bus, message): if message.type == gst.MESSAGE_EOS: - self.state = self.STOPPED + self.stop() def __del__(self): # stop our GST object so that it gets garbage-collected @@ -188,6 +188,14 @@ def stopall(self): self.stopdict(self.filesounds) self.stopdict(self.voicesounds) + def update(self): + for sound in self.builtinsounds.values(): + sound.update() + for sound in self.filesounds.values(): + sound.update() + for sound in self.voicesounds.values(): + sound.update() + def select_sound(self, data): if data.sound == SoundRequest.PLAY_FILE: if not data.arg2: @@ -437,6 +445,7 @@ def idle_loop(self): #print "idle_loop" self.diagnostics(0) self.sleep(1) + self.update() self.cleanup() #print "idle_exiting"