Skip to content

Commit

Permalink
[sound_play/scripts/soundplay_node.py] updates states and force stop …
Browse files Browse the repository at this point in the history
…when ends playing
  • Loading branch information
furushchev committed Jul 11, 2016
1 parent 5001fde commit 0114ad2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sound_play/scripts/soundplay_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -437,6 +445,7 @@ def idle_loop(self):
#print "idle_loop"
self.diagnostics(0)
self.sleep(1)
self.update()
self.cleanup()
#print "idle_exiting"

Expand Down

0 comments on commit 0114ad2

Please sign in to comment.