def on_midi(self, msg): self.ear.hear(msg) if not self.ear.heard_count() >= 1: return heard = self.ear.retrieve() print("Heard", heard) for neighbor in self.map.neighbors(self.pc_loc): if notes_match(heard, self.map.node_label(neighbor).container()): prev_loc = self.pc_loc self.pc_loc = neighbor anim = Animation( center=(self.pc_loc.x, self.pc_loc.y), duration=0.5, transition=AnimationTransition.in_out_quad ) anim.on_complete = self.resetNavigationWidgets if self.overlay: anim.on_start = partial(self.reveal_map_areas, self.pc_loc) print(self.map.wall_between_nodes(prev_loc, self.pc_loc)) anim.start(self.features.pcWidget)
def handleNote(self, msg): self.ear.hear(msg) if self.ear.heard_count() >= 2: heard = self.ear.retrieve() return notes_match(heard, NoteContainer(self.notes)) return None
def test_multiple_octave_match(self): nc1, nc2 = NoteContainer(["A-3", "B-4"]), NoteContainer(["A-5", "B-5"]) self.assertTrue(mingushelpers.notes_match(nc1, nc2))
def test_empty_match(self): self.assertTrue(mingushelpers.notes_match(NoteContainer(), NoteContainer()))
def test_different_note_counts_nomarch(self): nc1, nc2 = NoteContainer(["A-4", "B-5"]), NoteContainer(["A-4"]) self.assertFalse(mingushelpers.notes_match(nc1, nc2))
def test_single_unison_match(self): nc1, nc2 = NoteContainer(["A-4"]), NoteContainer(["A-4"]) self.assertTrue(mingushelpers.notes_match(nc1, nc2))