#!/usr/bin/env perl
use strict;
use warnings;

use lib map { "$ENV{HOME}/sandbox/$_/lib" } qw(MIDI-Simple-Drummer);
use MIDI::Simple::Drummer::Euclidean;

my $d = MIDI::Simple::Drummer::Euclidean->new(
    -file   => "$0.mid",
    -bpm    => 70,
    -onsets => 4,
    -beats  => 8,
);

$d->sync_tracks(
    sub {
        $d->{-pad} = 'kick';
#        $d->{-rhythm} = [qw( x . x x x . x . )];
        $d->beat(-name => 1);
    },
    sub {
        $d->{-pad} = 'snare';
#        $d->{-rhythm} = [qw( . x . x x . . x )];
        $d->beat(-name => 1);
    },
    sub {
#        $d->{-rhythm} = undef;
        $d->{-pad} = 'tick';
        $d->beat(-name => 1);
    },
) for 1 .. 4;

$d->write();
