diff --git a/__init__.py b/__init__.py index ffd12df2943b072487d47d2322435293f0b522e1..1850f04961279d9feb2ac7b56e3bc79e1ed9bdc8 100644 --- a/__init__.py +++ b/__init__.py @@ -119,6 +119,7 @@ class PetalHero(Application): if not self.loaded: return self.blm.foreground = False + self.blm.clear() self.blm.free = True self.blm = None self.loaded = False @@ -143,9 +144,8 @@ class PetalHero(Application): if not self.is_active(): return - if media.get_time() >= 17.92 or media.get_position() == media.get_duration(): - #media.seek(0) - media.load(self.path + '/sounds/menu.mp3') + if media.get_position() == media.get_duration(): + media.seek(0) #leds.set_brightness(32 - int(math.cos(self.time) * 32)) leds.set_all_rgb(0, 0, 0) diff --git a/select.py b/select.py index 00aa6664ce0a8ac2d2b25578123e2a9fb1e426f5..a9080ff8b96746c2a4f7aac698c0f88d21b4c39c 100644 --- a/select.py +++ b/select.py @@ -100,6 +100,8 @@ class SelectView(BaseView): ctx.move_to (0, -10) ctx.text("PROCESSING NEW SONGS") + ctx.rgba(0.8, 0.8, 0.8, 0.15) + ctx.rectangle(-120.0, 3.0, 240.0, 10.0).fill() ctx.gray(0.8) ctx.rectangle( -120.0, @@ -202,12 +204,15 @@ class SelectView(BaseView): if pos < 0: pos = 0 if pos > len(self.songs) - 1: pos = len(self.songs) - 1 - if pos != cur_target: - media.load(self.songs[pos].dirName + "/song.mp3") - if not self.is_active(): return + if pos != cur_target: + media.load(self.songs[pos].dirName + "/song.mp3") + + if media.get_position() == media.get_duration(): + media.seek(0) + if self.input.buttons.app.middle.pressed: utils.play_go(self.app) if self.songs: diff --git a/song.py b/song.py index 5303e2bb9554403ea001bcc859fb059b9151beed..16ddd123f1e02986974cbf78de055e46c30a1e73 100644 --- a/song.py +++ b/song.py @@ -54,14 +54,12 @@ class SongView(BaseView): self.fps = False self.debug = False self.paused = False - self.successive_sames = 0 self.first_think = False self.finished = False self.streak = 0 self.longeststreak = 0 self.led_override = [0] * 5 self.laststreak = -1 - self.scoreview = None self.notes = set() self.events_in_margin = set() self.petal_events = [set() for i in range(5)] @@ -272,21 +270,10 @@ class SongView(BaseView): if not self.is_active(): return - if media.get_time() * 1000 + AUDIO_DELAY == self.time and not self.paused: - self.successive_sames += min(delta_ms, 100) - else: - self.successive_sames = 0 - - #if self.input.buttons.app.middle.pressed: - # self.successive_sames = 1000 - - if self.successive_sames > 250 and not self.scoreview: - self.scoreview = score.ScoreView(self.app, self.data, self.longeststreak) - - if self.successive_sames > 350 and not self.finished: + if self.song and self.started and media.get_position() == media.get_duration() and not self.finished: self.finished = True media.stop() - self.vm.replace(self.scoreview, ViewTransitionBlend()) + self.vm.replace(score.ScoreView(self.app, self.data, self.longeststreak), ViewTransitionBlend()) return if self.streak > self.longeststreak: