summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/synth.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/midi/synth.c')
-rw-r--r--apps/plugins/midi/synth.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index 7e283d4ef1..969d9b939a 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -293,10 +293,10 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
293 const unsigned int start_loop = wf->startLoop << FRACTSIZE; 293 const unsigned int start_loop = wf->startLoop << FRACTSIZE;
294 const int diff_loop = end_loop-start_loop; 294 const int diff_loop = end_loop-start_loop;
295 295
296 while(likely(samples-- > 0)) 296 while(LIKELY(samples-- > 0))
297 { 297 {
298 /* Is voice being ramped? */ 298 /* Is voice being ramped? */
299 if(unlikely(so->state == STATE_RAMPDOWN)) 299 if(UNLIKELY(so->state == STATE_RAMPDOWN))
300 { 300 {
301 if(so->decay != 0) /* Ramp has been started */ 301 if(so->decay != 0) /* Ramp has been started */
302 { 302 {
@@ -318,12 +318,12 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
318 318
319 s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); 319 s2 = getSample((cp_temp >> FRACTSIZE)+1, wf);
320 320
321 if(likely(mode_mask28)) 321 if(LIKELY(mode_mask28))
322 { 322 {
323 /* LOOP_REVERSE|LOOP_PINGPONG = 24 */ 323 /* LOOP_REVERSE|LOOP_PINGPONG = 24 */
324 if(unlikely(mode_mask24 && so->loopState == STATE_LOOPING && (cp_temp < start_loop))) 324 if(UNLIKELY(mode_mask24 && so->loopState == STATE_LOOPING && (cp_temp < start_loop)))
325 { 325 {
326 if(unlikely(mode_mask_looprev)) 326 if(UNLIKELY(mode_mask_looprev))
327 { 327 {
328 cp_temp += diff_loop; 328 cp_temp += diff_loop;
329 s2=getSample((cp_temp >> FRACTSIZE), wf); 329 s2=getSample((cp_temp >> FRACTSIZE), wf);
@@ -334,10 +334,10 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
334 } 334 }
335 } 335 }
336 336
337 if(unlikely(cp_temp >= end_loop)) 337 if(UNLIKELY(cp_temp >= end_loop))
338 { 338 {
339 so->loopState = STATE_LOOPING; 339 so->loopState = STATE_LOOPING;
340 if(unlikely(!mode_mask24)) 340 if(UNLIKELY(!mode_mask24))
341 { 341 {
342 cp_temp -= diff_loop; 342 cp_temp -= diff_loop;
343 s2=getSample((cp_temp >> FRACTSIZE), wf); 343 s2=getSample((cp_temp >> FRACTSIZE), wf);
@@ -350,7 +350,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
350 } 350 }
351 351
352 /* Have we overrun? */ 352 /* Have we overrun? */
353 if(unlikely(cp_temp >= num_samples)) 353 if(UNLIKELY(cp_temp >= num_samples))
354 { 354 {
355 cp_temp -= so->delta; 355 cp_temp -= so->delta;
356 s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); 356 s2 = getSample((cp_temp >> FRACTSIZE)+1, wf);
@@ -362,21 +362,21 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
362 362
363 s1 +=((signed)((s2 - s1) * (cp_temp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); 363 s1 +=((signed)((s2 - s1) * (cp_temp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE);
364 364
365 if(unlikely(so->curRate == 0)) 365 if(UNLIKELY(so->curRate == 0))
366 { 366 {
367 stopVoice(so); 367 stopVoice(so);
368// so->isUsed = false; 368// so->isUsed = false;
369 369
370 } 370 }
371 371
372 if(likely(so->ch != 9 && so->state != STATE_RAMPDOWN)) /* Stupid ADSR code... and don't do ADSR for drums */ 372 if(LIKELY(so->ch != 9 && so->state != STATE_RAMPDOWN)) /* Stupid ADSR code... and don't do ADSR for drums */
373 { 373 {
374 if(unlikely(so->curOffset < so->targetOffset)) 374 if(UNLIKELY(so->curOffset < so->targetOffset))
375 { 375 {
376 so->curOffset += (so->curRate); 376 so->curOffset += (so->curRate);
377 if(unlikely(so -> curOffset > so->targetOffset && so->curPoint != 2)) 377 if(UNLIKELY(so -> curOffset > so->targetOffset && so->curPoint != 2))
378 { 378 {
379 if(unlikely(so->curPoint != 5)) 379 if(UNLIKELY(so->curPoint != 5))
380 { 380 {
381 setPoint(so, so->curPoint+1); 381 setPoint(so, so->curPoint+1);
382 } 382 }
@@ -388,9 +388,9 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
388 } else 388 } else
389 { 389 {
390 so->curOffset -= (so->curRate); 390 so->curOffset -= (so->curRate);
391 if(unlikely(so -> curOffset < so->targetOffset && so->curPoint != 2)) 391 if(UNLIKELY(so -> curOffset < so->targetOffset && so->curPoint != 2))
392 { 392 {
393 if(unlikely(so->curPoint != 5)) 393 if(UNLIKELY(so->curPoint != 5))
394 { 394 {
395 setPoint(so, so->curPoint+1); 395 setPoint(so, so->curPoint+1);
396 } 396 }
@@ -403,7 +403,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
403 } 403 }
404 } 404 }
405 405
406 if(unlikely(so->curOffset < 0)) 406 if(UNLIKELY(so->curOffset < 0))
407 { 407 {
408 so->curOffset = so->targetOffset; 408 so->curOffset = so->targetOffset;
409 stopVoice(so); 409 stopVoice(so);
@@ -416,7 +416,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i
416 s1 = s1 * volscale >> 14; 416 s1 = s1 * volscale >> 14;
417 417
418 /* need to set ramp beginning */ 418 /* need to set ramp beginning */
419 if(unlikely(so->state == STATE_RAMPDOWN && so->decay == 0)) 419 if(UNLIKELY(so->state == STATE_RAMPDOWN && so->decay == 0))
420 { 420 {
421 so->decay = s1; 421 so->decay = s1;
422 if(so->decay == 0) 422 if(so->decay == 0)
@@ -442,7 +442,7 @@ int32_t samp_buf[512] IBSS_ATTR;
442void synthSamples(int32_t *buf_ptr, unsigned int num_samples) ICODE_ATTR; 442void synthSamples(int32_t *buf_ptr, unsigned int num_samples) ICODE_ATTR;
443void synthSamples(int32_t *buf_ptr, unsigned int num_samples) 443void synthSamples(int32_t *buf_ptr, unsigned int num_samples)
444{ 444{
445 if (unlikely(num_samples > 512)) 445 if (UNLIKELY(num_samples > 512))
446 DEBUGF("num_samples is too big!\n"); 446 DEBUGF("num_samples is too big!\n");
447 else 447 else
448 { 448 {