EVENT_NAME(ME_SHERRY);
EVENT_NAME(ME_BARMARKER);
EVENT_NAME(ME_STEP);
+ EVENT_NAME(ME_LOOP_EXPANSION_START);
+ EVENT_NAME(ME_LOOP_EXPANSION_END);
EVENT_NAME(ME_LAST);
EVENT_NAME(ME_EOT);
}
set_cuepoint(ch, current_event->a, current_event->b);
break;
+ case ME_LOOP_EXPANSION_START:
+ play_mode->acntl(PM_REQ_LOOP_START, (void *)current_event->time);
+ break;
+
+ case ME_LOOP_EXPANSION_END:
+ play_mode->acntl(PM_REQ_LOOP_END, (void *)current_event->time);
+ break;
+
case ME_EOT:
ctl_mode_event(CTLE_CURRENT_TIME_END, 0, (long)(current_sample / (midi_time_ratio * play_mode->rate)), 0);
return midi_play_end();
};
int loop_type;
const int loop_filter = opt_use_midi_loop_repeat;
- int loop_startflag;
+ int loop_startflag; // 1 == end, 2 == start
#endif /* SUPPORT_LOOPEVENT */
move_channels(chidx);
"ME_LOOP_START: %d", loop_begin_time);
groomed_list = lp =
(MidiEvent*) safe_large_realloc(groomed_list, sizeof(MidiEvent) * (event_count +
- (loop_end_event_count - loop_begin_event_count) *
+ (loop_end_event_count - loop_begin_event_count + 1) *
loop_repeat_counter + 1));
lp += our_event_count;
- }
+ loop_startflag = 2;
+ }
skip_this_event = 1;
break;
loop_begin_time = meep->event.time;
loop_startmeep = meep;
loop_begin_event_count = i;
- }
+ loop_startflag = 2;
+ }
}
skip_this_event = 1;
break;
loop_end_event_count = i;
groomed_list = lp =
(MidiEvent*) safe_large_realloc(groomed_list, sizeof(MidiEvent) * (event_count +
- (loop_end_event_count - loop_begin_event_count) *
+ (loop_end_event_count - loop_begin_event_count + 1) *
loop_repeat_counter + 1));
lp += our_event_count;
}
loop_begin_time = meep->event.time;
loop_startmeep = meep;
loop_begin_event_count = i;
- }
+ loop_startflag = 2;
+ }
skip_this_event = 1;
}
if (strcmp(text + 1, "(B)") == 0) {
loop_end_event_count = i;
groomed_list = lp =
(MidiEvent*) safe_large_realloc(groomed_list, sizeof(MidiEvent) * (event_count +
- (loop_end_event_count - loop_begin_event_count) *
+ (loop_end_event_count - loop_begin_event_count + 1) *
loop_repeat_counter + 1));
lp += our_event_count;
}
loop_begin_time = meep->event.time;
loop_startmeep = meep;
loop_begin_event_count = i;
- }
+ loop_startflag = 2;
+ }
skip_this_event = 1;
}
if (strcmp(text + 1, "(Loop_End)") == 0) {
loop_end_event_count = i;
groomed_list = lp =
(MidiEvent*) safe_large_realloc(groomed_list, sizeof(MidiEvent) * (event_count +
- (loop_end_event_count - loop_begin_event_count) *
+ (loop_end_event_count - loop_begin_event_count + 1) *
loop_repeat_counter + 1));
lp += our_event_count;
}
}
if (loop_startflag) {
- if (loop_startmeep) {
- if (loop_end_time == 0)
- loop_end_time = at;
- loop_add_at += (loop_end_time - loop_begin_time);
- meep = loop_startmeep->next;
- ctl->cmsg(CMSG_INFO, VERB_DEBUG,
- "Loop jump: from %d, to %d",
- loop_end_time,
- meep->event.time);
- }
- loop_repeat_counter--;
+ if (loop_startflag == 2) {
+ *lp = meep->event;
+ lp->time = st;
+ lp->type = ME_LOOP_EXPANSION_START;
+ lp->a = loop_type;
+ lp->b = (opt_use_midi_loop_repeat ? opt_midi_loop_repeat - loop_repeat_counter : 0);
+ lp++;
+ our_event_count++;
+ }
+ else if (loop_startflag == 1) {
+ if (loop_startmeep) {
+ *lp = meep->event;
+ lp->time = st;
+ lp->type = ME_LOOP_EXPANSION_END;
+ lp->a = loop_type;
+ lp->b = (opt_use_midi_loop_repeat ? opt_midi_loop_repeat - loop_repeat_counter : 0);
+ lp++;
+ our_event_count++;
+
+ if (loop_end_time == 0)
+ loop_end_time = at;
+ loop_add_at += (loop_end_time - loop_begin_time);
+ meep = loop_startmeep->next;
+ ctl->cmsg(CMSG_INFO, VERB_DEBUG,
+ "Loop jump: from %d, to %d",
+ loop_end_time,
+ meep->event.time);
+ }
+ loop_repeat_counter--;
+ }
loop_startflag = 0;
}
#endif /* SUPPORT_LOOPEVENT */