use tunes::prelude::*;
fn main() -> anyhow::Result<()> {
println!("\n🎛️ Example: Drum Grid (Step Sequencer)\n");
let engine = AudioEngine::new()?;
let mut comp = Composition::new(Tempo::new(120.0));
comp.track("basic_beat")
.drum_grid(16, 0.125, |g| g .sound(DrumType::Kick, &[0, 4, 8, 12]) .sound(DrumType::Snare, &[4, 12]) .sound(DrumType::HiHatClosed, &[0, 2, 4, 6, 8, 10, 12, 14]));
comp.track("complex_beat")
.at(2.0)
.drum_grid(16, 0.125, |g| g
.sound(DrumType::Kick, &[0, 3, 6, 10, 13]) .sound(DrumType::Snare, &[4, 11]) .sound(DrumType::HiHatClosed, &[1, 2, 5, 7, 9, 10, 14, 15]) .sound(DrumType::Clap, &[8]));
comp.track("triplet_beat")
.at(4.0)
.drum_grid(12, 0.167, |g| g .sound(DrumType::Kick, &[0, 6])
.sound(DrumType::Snare, &[3, 9])
.sound(DrumType::HiHatClosed, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]));
comp.track("cowbell")
.at(6.0)
.drum_grid(8, 0.25, |g| g
.sound(DrumType::Cowbell, &[0, 2, 5, 7]));
println!("✓ .drum_grid(steps, step_duration) creates step sequencer");
println!("✓ Then use .sound(DrumType::Kick, ), .sound(DrumType::Snare, ), .sound(DrumType::HiHatClosed, ), etc with step indices");
println!("✓ Example: .sound(DrumType::Kick, &[0, 4, 8, 12]) = quarter note kicks");
println!("✓ Typical: 16 steps at 0.125s = one bar of 16th notes\n");
engine.play_mixer(&comp.into_mixer())?;
Ok(())
}