Message::HitCount(x) => self.midi.update(x, &self.info),
Message::NewMap(m) => {
self.map.update(map::Message::Ticked(m.clone()));
- let hits = self.mask.tick(m);
+ let hits = self.mask.tick(m, self.info.voices);
return Command::perform(async move { hits }, Message::HitCount);
}
Message::Tick(_) => {
let bytes = self.midi.tick();
let new_map = map.clone();
- let hits = self.mask.tick(map);
+ let hits = self.mask.tick(map, self.info.voices);
let midi = tokio::spawn(async move {
for byte in bytes {
.into()
}
- pub fn tick(&mut self, life: CellMap) -> u8 {
+ pub fn tick(&mut self, life: CellMap, voices: u8) -> u8 {
self.hits.clear();
for cell in self.cells.iter() {
if life.contains(cell) {
}
}
- self.hits.len().try_into().unwrap_or(127)
+ self.hits.len().try_into().unwrap_or(127) % voices
}
pub fn randomize(&mut self) {