Revert some changes that broke looping in midiplayer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15631 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h
index f26f120..18d493b 100644
--- a/apps/plugins/midi/midiutil.h
+++ b/apps/plugins/midi/midiutil.h
@@ -109,7 +109,7 @@
int delta;
int decay;
unsigned int cp; /* unsigned int */
- int state;
+ int state, loopState;
int note, vol, ch;
int curRate, curOffset, targetOffset;
int curPoint;
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c
index 7847c37..bd2f33b 100644
--- a/apps/plugins/midi/sequencer.c
+++ b/apps/plugins/midi/sequencer.c
@@ -227,6 +227,7 @@
setVolScale(a);
+ voices[a].loopState=STATE_NONLOOPING;
/*
* OKAY. Gt = Gus Table value
* rf = Root Frequency of wave
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index b2efce1..f9af487 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -316,29 +316,33 @@
s2 = getSample((cp_temp >> FRACTSIZE)+1, wf);
- if(mode_mask28 && cp_temp >= end_loop)
+ if(mode_mask28)
{
- if(!mode_mask24)
+ /* LOOP_REVERSE|LOOP_PINGPONG = 24 */
+ if(mode_mask24 && so->loopState == STATE_LOOPING && (cp_temp < start_loop))
{
- cp_temp -= diff_loop;
- s2=getSample((cp_temp >> FRACTSIZE), wf);
- }
- else
- {
- so->delta = -so->delta;
-
- /* LOOP_REVERSE|LOOP_PINGPONG = 24 */
- if(cp_temp < start_loop) /* this appears to never be true in here */
+ if(mode_mask_looprev)
{
- if(mode_mask_looprev)
- {
- cp_temp += diff_loop;
- s2=getSample((cp_temp >> FRACTSIZE), wf);
- }
- else
- {
- so->delta = -so->delta; /* At this point cp_temp is wrong. We need to take a step */
- }
+ cp_temp += diff_loop;
+ s2=getSample((cp_temp >> FRACTSIZE), wf);
+ }
+ else
+ {
+ so->delta = -so->delta; /* At this point cp_temp is wrong. We need to take a step */
+ }
+ }
+
+ if(cp_temp >= end_loop)
+ {
+ so->loopState = STATE_LOOPING;
+ if(!mode_mask24)
+ {
+ cp_temp -= diff_loop;
+ s2=getSample((cp_temp >> FRACTSIZE), wf);
+ }
+ else
+ {
+ so->delta = -so->delta;
}
}
}