static void off(channel_t *channel, midipitch_t midipitch, uchar vel, int offed, import_ctx_t *ctx) { noteon_t *on = &ctx->on[channel->number][midipitch]; if (on->vel != 0) { note_t n = { .track = ctx->track, .channel = channel, .on_time = on->time, .on_vel = on->vel, .off_time = ctx->time, .off_vel = vel, .pitch = on->pitch, .midipitch = midipitch, }; if (n.on_time != n.off_time) insert_note(&n)->note_offed = offed; on->vel = 0; } else {
LVAL xlc_seq_insert_note(void) { seq_type arg1 = getseq(xlgaseq()); long arg2 = getfixnum(xlgafixnum()); long arg3 = getfixnum(xlgafixnum()); long arg4 = getfixnum(xlgafixnum()); long arg5 = getfixnum(xlgafixnum()); long arg6 = getfixnum(xlgafixnum()); long arg7 = getfixnum(xlgafixnum()); xllastarg(); insert_note(arg1, arg2, arg3, arg4, arg5, arg6, arg7); return NIL; }
static void * off_clb(note_t *note, void *_arg) { noteoff_t *arg = _arg; if (note->midipitch != arg->midipitch) return NULL; if (arg->time < note->off_time || note->note_offed < arg->offed) { note_t n = *note; n.off_time = arg->time; n.off_vel = arg->vel; erase_note(note); if (n.on_time != n.off_time) insert_note(&n)->note_offed = arg->offed; } return arg; }