diff options
-rw-r--r-- | apps/plugins/midi/midiutil.h | 2 | ||||
-rw-r--r-- | apps/plugins/midi/sequencer.c | 1 | ||||
-rw-r--r-- | apps/plugins/midi/synth.c | 40 |
3 files changed, 24 insertions, 19 deletions
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h index f26f1208e3..18d493b23a 100644 --- a/apps/plugins/midi/midiutil.h +++ b/apps/plugins/midi/midiutil.h | |||
@@ -109,7 +109,7 @@ struct SynthObject | |||
109 | int delta; | 109 | int delta; |
110 | int decay; | 110 | int decay; |
111 | unsigned int cp; /* unsigned int */ | 111 | unsigned int cp; /* unsigned int */ |
112 | int state; | 112 | int state, loopState; |
113 | int note, vol, ch; | 113 | int note, vol, ch; |
114 | int curRate, curOffset, targetOffset; | 114 | int curRate, curOffset, targetOffset; |
115 | int curPoint; | 115 | int curPoint; |
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c index 7847c375ba..bd2f33b365 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) | |||
227 | 227 | ||
228 | setVolScale(a); | 228 | setVolScale(a); |
229 | 229 | ||
230 | voices[a].loopState=STATE_NONLOOPING; | ||
230 | /* | 231 | /* |
231 | * OKAY. Gt = Gus Table value | 232 | * OKAY. Gt = Gus Table value |
232 | * rf = Root Frequency of wave | 233 | * rf = Root Frequency of wave |
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index b2efce1f7d..f9af4876fd 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 | |||
316 | 316 | ||
317 | s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); | 317 | s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); |
318 | 318 | ||
319 | if(mode_mask28 && cp_temp >= end_loop) | 319 | if(mode_mask28) |
320 | { | 320 | { |
321 | if(!mode_mask24) | 321 | /* LOOP_REVERSE|LOOP_PINGPONG = 24 */ |
322 | if(mode_mask24 && so->loopState == STATE_LOOPING && (cp_temp < start_loop)) | ||
322 | { | 323 | { |
323 | cp_temp -= diff_loop; | 324 | if(mode_mask_looprev) |
324 | s2=getSample((cp_temp >> FRACTSIZE), wf); | 325 | { |
326 | cp_temp += diff_loop; | ||
327 | s2=getSample((cp_temp >> FRACTSIZE), wf); | ||
328 | } | ||
329 | else | ||
330 | { | ||
331 | so->delta = -so->delta; /* At this point cp_temp is wrong. We need to take a step */ | ||
332 | } | ||
325 | } | 333 | } |
326 | else | ||
327 | { | ||
328 | so->delta = -so->delta; | ||
329 | 334 | ||
330 | /* LOOP_REVERSE|LOOP_PINGPONG = 24 */ | 335 | if(cp_temp >= end_loop) |
331 | if(cp_temp < start_loop) /* this appears to never be true in here */ | 336 | { |
337 | so->loopState = STATE_LOOPING; | ||
338 | if(!mode_mask24) | ||
332 | { | 339 | { |
333 | if(mode_mask_looprev) | 340 | cp_temp -= diff_loop; |
334 | { | 341 | s2=getSample((cp_temp >> FRACTSIZE), wf); |
335 | cp_temp += diff_loop; | 342 | } |
336 | s2=getSample((cp_temp >> FRACTSIZE), wf); | 343 | else |
337 | } | 344 | { |
338 | else | 345 | so->delta = -so->delta; |
339 | { | ||
340 | so->delta = -so->delta; /* At this point cp_temp is wrong. We need to take a step */ | ||
341 | } | ||
342 | } | 346 | } |
343 | } | 347 | } |
344 | } | 348 | } |