diff options
Diffstat (limited to 'apps/plugins/midi/synth.c')
-rw-r--r-- | apps/plugins/midi/synth.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 0ad7bb59f8..663565ecdb 100644 --- a/apps/plugins/midi/synth.c +++ b/apps/plugins/midi/synth.c | |||
@@ -201,8 +201,6 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) | |||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
204 | #define getSample(s,wf) ((short *)(wf)->data)[s] | ||
205 | |||
206 | void setPoint(struct SynthObject * so, int pt) ICODE_ATTR; | 204 | void setPoint(struct SynthObject * so, int pt) ICODE_ATTR; |
207 | void setPoint(struct SynthObject * so, int pt) | 205 | void setPoint(struct SynthObject * so, int pt) |
208 | { | 206 | { |
@@ -269,6 +267,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i | |||
269 | register unsigned int cp_temp = so->cp; | 267 | register unsigned int cp_temp = so->cp; |
270 | 268 | ||
271 | wf = so->wf; | 269 | wf = so->wf; |
270 | const int16_t *sample_data = wf->data; | ||
272 | 271 | ||
273 | const unsigned int pan = chPan[so->ch]; | 272 | const unsigned int pan = chPan[so->ch]; |
274 | const int volscale = so->volscale; | 273 | const int volscale = so->volscale; |
@@ -309,7 +308,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i | |||
309 | cp_temp += so->delta; | 308 | cp_temp += so->delta; |
310 | } | 309 | } |
311 | 310 | ||
312 | s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); | 311 | s2 = sample_data[(cp_temp >> FRACTSIZE)+1]; |
313 | 312 | ||
314 | if(LIKELY(mode_mask28)) | 313 | if(LIKELY(mode_mask28)) |
315 | { | 314 | { |
@@ -319,7 +318,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i | |||
319 | if(UNLIKELY(mode_mask_looprev)) | 318 | if(UNLIKELY(mode_mask_looprev)) |
320 | { | 319 | { |
321 | cp_temp += diff_loop; | 320 | cp_temp += diff_loop; |
322 | s2=getSample((cp_temp >> FRACTSIZE), wf); | 321 | s2 = sample_data[cp_temp >> FRACTSIZE]; |
323 | } | 322 | } |
324 | else | 323 | else |
325 | { | 324 | { |
@@ -333,7 +332,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i | |||
333 | if(UNLIKELY(!mode_mask24)) | 332 | if(UNLIKELY(!mode_mask24)) |
334 | { | 333 | { |
335 | cp_temp -= diff_loop; | 334 | cp_temp -= diff_loop; |
336 | s2=getSample((cp_temp >> FRACTSIZE), wf); | 335 | s2 = sample_data[cp_temp >> FRACTSIZE]; |
337 | } | 336 | } |
338 | else | 337 | else |
339 | { | 338 | { |
@@ -346,7 +345,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i | |||
346 | if(UNLIKELY(cp_temp >= num_samples)) | 345 | if(UNLIKELY(cp_temp >= num_samples)) |
347 | { | 346 | { |
348 | cp_temp -= so->delta; | 347 | cp_temp -= so->delta; |
349 | s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); | 348 | s2 = sample_data[(cp_temp >> FRACTSIZE)+1]; |
350 | 349 | ||
351 | if (!rampdown) /* stop voice */ | 350 | if (!rampdown) /* stop voice */ |
352 | { | 351 | { |
@@ -356,7 +355,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i | |||
356 | } | 355 | } |
357 | 356 | ||
358 | /* Better, working, linear interpolation */ | 357 | /* Better, working, linear interpolation */ |
359 | s1=getSample((cp_temp >> FRACTSIZE), wf); | 358 | s1 = sample_data[cp_temp >> FRACTSIZE]; |
360 | 359 | ||
361 | s1 +=((signed)((s2 - s1) * (cp_temp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); | 360 | s1 +=((signed)((s2 - s1) * (cp_temp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); |
362 | 361 | ||