From bdbd30ff27993bd4ce35d0151507720be71361d1 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 23 Jul 2013 04:30:15 +0200 Subject: [PATCH] increase bouncetime, try stop trig --- piplayer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/piplayer.py b/piplayer.py index 23529b5..5b0385c 100644 --- a/piplayer.py +++ b/piplayer.py @@ -61,7 +61,7 @@ class GPIOController(Thread): def add_channel_callback(self, channel, callback): self.server.setup(channel, self.server.IN, pull_up_down=self.method) - self.server.add_event_detect(channel, self.method, callback=callback, bouncetime=100) + self.server.add_event_detect(channel, self.method, callback=callback, bouncetime=1000) def run(self): pass @@ -148,12 +148,14 @@ class AudioPlayer(object): def osc_play_stop(self, path, value): value = value[0] - if value: + if value and not self.playing: #print 'play' self.pipeline.set_state(gst.STATE_NULL) self.pipeline.set_state(gst.STATE_PLAYING) + self.playing = True else: self.pipeline.set_state(gst.STATE_NULL) + self.playing = False def gpio_play(self, value): if not self.playing: @@ -161,6 +163,9 @@ class AudioPlayer(object): self.pipeline.set_state(gst.STATE_NULL) self.pipeline.set_state(gst.STATE_PLAYING) self.playing = True + else: + self.pipeline.set_state(gst.STATE_NULL) + self.playing = False def update_uri(uri): self.uri = uri -- 2.39.5