use crate::composition::{Composition, Tempo};
use crate::consts::*;
use crate::engine::AudioEngine;
use crate::instruments::Instrument;
fn main() -> anyhow::Result<()> {
let mut comp = Composition::new(Tempo::new(140.0));
comp.track("drums")
.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.instrument("bass", &Instrument::sub_bass())
.at(0.0)
.notes(&[C2, C2, G2, G2], 0.5);
comp.instrument("lead", &Instrument::synth_lead())
.notes(&[C4, E4, G4, C5, G4, E4, C4, C4], 0.25);
let mixer = comp.into_mixer();
let engine = AudioEngine::with_buffer_size(4096)?;
let loop_id = engine.play_looping(&mixer)?;
loop {
std::thread::sleep(std::time::Duration::from_millis(100));
}
}