|
|
|
|
@ -611,9 +611,6 @@ fn new_cell(
|
|
|
|
|
let playback_settings = PlaybackSettings::ONCE.with_volume(volume);
|
|
|
|
|
|
|
|
|
|
info!("using coordinates {:?}", c);
|
|
|
|
|
info!("cell_pitch: {:?}", pitch_map.coordinates_cell_pitch(&c));
|
|
|
|
|
info!("pitch map {:?}", pitch_map);
|
|
|
|
|
info!("cell assets materials: {:#?}", cell_assets.materials);
|
|
|
|
|
|
|
|
|
|
bsn! {
|
|
|
|
|
Cell
|
|
|
|
|
@ -763,11 +760,11 @@ impl CellPitch {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let lightness = (self.octave as f32 + 5.0) / 11.0;
|
|
|
|
|
let chroma = (self.octave as f32 + 5.0) / 11.0;
|
|
|
|
|
|
|
|
|
|
Color::Oklcha(Oklcha {
|
|
|
|
|
hue,
|
|
|
|
|
lightness,
|
|
|
|
|
chroma,
|
|
|
|
|
..default()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -976,20 +973,20 @@ impl PitchMap {
|
|
|
|
|
/// Given the currently selected notes and octave range selected in the PitchMap convert the given coordinates to a CellPitch
|
|
|
|
|
fn coordinates_cell_pitch(&self, c: &Coordinates) -> CellPitch {
|
|
|
|
|
let note: Note = {
|
|
|
|
|
// Note is the x-axis pattern, repeating every 12 tiles because we support 12 pitches
|
|
|
|
|
let idx = (c.x as usize) % self.notes.len();
|
|
|
|
|
// TODO: pretty sure this doesn't handle negative numbers at all...
|
|
|
|
|
// need to shift by ?? first
|
|
|
|
|
self.notes.get(idx).unwrap().clone()
|
|
|
|
|
let num_notes: usize = self.notes.len();
|
|
|
|
|
let x_coord: usize = c.x.strict_abs() as usize; // TODO: shift first or something
|
|
|
|
|
self.notes.get(x_coord % num_notes).unwrap().clone()
|
|
|
|
|
};
|
|
|
|
|
let octave: isize = {
|
|
|
|
|
// Octave is the y-axis pattern, repeating every 11 tiles because we support 11 octaves
|
|
|
|
|
let total_octaves = self.octaves_up as isize + self.octaves_down as isize + 1;
|
|
|
|
|
// TODO: pretty sure this doesn't handle negative numbers at all...
|
|
|
|
|
// need to shift by ?? first
|
|
|
|
|
c.y % total_octaves
|
|
|
|
|
let num_octaves: usize = self.octaves_up + self.octaves_down + 1;
|
|
|
|
|
let y_coord: usize = c.y.strict_abs() as usize; // TODO: shift first or something
|
|
|
|
|
info!("num_octaves: {:?}", num_octaves);
|
|
|
|
|
info!("y_coord: {:?}", y_coord);
|
|
|
|
|
(y_coord % num_octaves) as isize - 5
|
|
|
|
|
};
|
|
|
|
|
CellPitch { note, octave }
|
|
|
|
|
let cp = CellPitch { note, octave };
|
|
|
|
|
info!("Cell Pitch: {:?}", cp);
|
|
|
|
|
cp
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|