~rabbits/orca-toy

7810e2484a5271ac74d1996a4b629eedc0725606 — neauoire 2 months ago 88dd6b2
Fixed midi issue
1 files changed, 14 insertions(+), 6 deletions(-)

M orca.c
M orca.c => orca.c +14 -6
@@ 707,20 707,28 @@ opcomment(Grid *g, int x, int y)
void
opspecial(Grid *g, int x, int y)
{
	int chn, oct, vel, len;
	char nte;
	int chn, oct, nte, vel, len;
	if(getport(g, x, y, 1) != ':')
		return;
	chn = cb36(getport(g, x + 1, y, 1));
	if(chn == '.')
		return;
	oct = cb36(getport(g, x + 2, y, 1));
	if(oct == '.')
		return;
	nte = getport(g, x + 3, y, 1);
	if(nte == '.')
		return;
	vel = getport(g, x + 4, y, 1);
	len = cb36(getport(g, x + 5, y, 1));
	if(vel == '.')
		vel = 'z';
	len = getport(g, x + 5, y, 1);
	if(getbang(g, x, y)) {
		sendmidi(chn,
		sendmidi(
			clmp(chn, 0, 16),
			12 * oct + ctbl(nte),
			vel == '.' ? 36 : clmp(cb36(vel), 0, 36),
			clmp(len, 1, 36));
			clmp(cb36(vel), 0, 36),
			clmp(cb36(len), 1, 36));
		settype(g, x, y, 3);
	}
}