2 Epichord - a midi sequencer
3 Copyright (C) 2008 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
26 the sequencer will use some number of ticks per beat which
27 corresponds to its minimum allowed note length.
29 a beat is divided into four parts at the regular zoom.
30 in 4/4 time this corresponds to 1/16 notes.
31 lets make the shortest note 1/128 note.
32 this means there are 128 'ticks' per beat.
34 to convert from time in us into ticks do
36 ticks = time * BPM * TPB / (1000000 * 60);
44 #define MIDI_NOTE_ON 0x90
45 #define MIDI_NOTE_OFF 0x80
47 //encodes data in e as a midi event placed in buf
48 int midi_encode(mevent
* e
, int chan
, char* buf
, size_t* n
);
50 //decodes midi data and creates a new mevent
51 int midi_decode(char* buf
, mevent
* e
);