Mercurial > code > home > repos > light9
changeset 1151:fe7ed6395e9f
don't coast if song is paused
Ignore-this: 81b4d1c6236262b4fbfeb74b3d1a841e
author | drewp@bigasterisk.com |
---|---|
date | Sat, 14 Jun 2014 22:33:59 +0000 |
parents | 0e0776d3bd74 |
children | eb8c4352798c |
files | light9/effecteval/effectloop.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/effecteval/effectloop.py Sat Jun 14 22:31:34 2014 +0000 +++ b/light9/effecteval/effectloop.py Sat Jun 14 22:33:59 2014 +0000 @@ -30,6 +30,7 @@ self.period = 1 / 30 self.coastSecs = .3 # main reason to keep this low is to notice play/pause self.songTimeFetch = 0 + self.songIsPlaying = False self.songTimeFromRequest = 0 self.requestTime = 0 # unix sec for when we fetched songTime self.initOutput() @@ -85,13 +86,16 @@ self.currentSong = song # this may be piling on the handlers self.graph.addHandler(self.setEffects) - self.songTime = songTime + elapsed = time.time() - t1 reactor.callLater(max(0, self.period - elapsed), self.updateTimeFromMusic) def estimatedSongTime(self): now = time.time() - return self.songTime + max(0, now - self.songTimeFetch) + t = self.songTime + if self.currentPlaying: + t += max(0, now - self.songTimeFetch) + return t @inlineCallbacks def sendLevels(self):