diff options
Diffstat (limited to 'midi/midi.ha')
| -rw-r--r-- | midi/midi.ha | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/midi/midi.ha b/midi/midi.ha index b63ce60..68a3078 100644 --- a/midi/midi.ha +++ b/midi/midi.ha @@ -109,48 +109,48 @@ export fn noteoff(c: *trchunk, d: vlen, n: note, vel: u8 = 0x40, oct: uint = 0) append(c.ev, e); }; -export fn writeheader(c: hchunk) void = { - io::writeall(os::stdout, c.chk.chktype)!; +export fn writeheader(h: io::handle, c: hchunk) void = { + io::writeall(h, c.chk.chktype)!; let buf: [4]u8 = [0...]; let l = c.chk.length; endian::beputu32(buf, l); - io::writeall(os::stdout, buf)!; + io::writeall(h, buf)!; let bf: [2]u8 = [0...]; endian::beputu16(bf, c.format); - io::writeall(os::stdout, bf)!; + io::writeall(h, bf)!; let bf: [2]u8 = [0...]; endian::beputu16(bf, c.ntrks); - io::writeall(os::stdout, bf)!; + io::writeall(h, bf)!; let bf: [2]u8 = [0...]; endian::beputu16(bf, c.division); - io::writeall(os::stdout, bf)!; + io::writeall(h, bf)!; }; -export fn writechunk(c: trchunk) void = { - io::writeall(os::stdout, c.chk.chktype)!; +export fn writechunk(h: io::handle, c: trchunk) void = { + io::writeall(h, c.chk.chktype)!; let buf: [4]u8 = [0...]; let l = calclength(c); //let l = c.chk.length; endian::beputu32(buf, l); - io::writeall(os::stdout, buf)!; + io::writeall(h, buf)!; for (const ev .. c.ev) { let dt = encodevlen(ev.deltatime); endian::beputu32(buf, dt); if (dt <= 127) { - io::writeall(os::stdout, [buf[3]])!; + io::writeall(h, [buf[3]])!; } else if (dt <= 0xFF7F) { - io::writeall(os::stdout, buf[2..])!; + io::writeall(h, buf[2..])!; } else if (dt <= 0xFFFF7F) { - io::writeall(os::stdout, buf[1..])!; + io::writeall(h, buf[1..])!; } else { - io::writeall(os::stdout, buf)!; + io::writeall(h, buf)!; }; match (ev.ev) { case let m: midi => - io::writeall(os::stdout, [m.status])!; - io::writeall(os::stdout, m.data)!; + io::writeall(h, [m.status])!; + io::writeall(h, m.data)!; case => abort(); }; |
