summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-11-15 21:20:29 +0000
committerNils Wallménius <nils@rockbox.org>2007-11-15 21:20:29 +0000
commit65331f17497d132c03ad48be90322d24c20d6415 (patch)
treef17daff02a0ea0bbec8dc958eead09a49cd892d4 /apps/plugins
parent7aa4ae6e4507bcf8f9956e852940e41422a57a8f (diff)
downloadrockbox-65331f17497d132c03ad48be90322d24c20d6415.zip
rockbox-65331f17497d132c03ad48be90322d24c20d6415.tar.gz
rockbox-65331f17497d132c03ad48be90322d24c20d6415.tar.bz2
rockbox-65331f17497d132c03ad48be90322d24c20d6415.tar.xz
Revert some changes that broke looping in midiplayer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15631 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/midi/midiutil.h2
-rw-r--r--apps/plugins/midi/sequencer.c1
-rw-r--r--apps/plugins/midi/synth.c40
3 files changed, 24 insertions, 19 deletions
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 @@ struct SynthObject
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 @@ inline void pressNote(int ch, int note, int vol)
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 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
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);
+ 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 */
+ }
}
- else
- {
- so->delta = -so->delta;
- /* LOOP_REVERSE|LOOP_PINGPONG = 24 */
- if(cp_temp < start_loop) /* this appears to never be true in here */
+ if(cp_temp >= end_loop)
+ {
+ so->loopState = STATE_LOOPING;
+ if(!mode_mask24)
{
- 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;
}
}
}