diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/midi/guspat.c | 4 | ||||
-rw-r--r-- | apps/plugins/midi/guspat.h | 2 | ||||
-rw-r--r-- | apps/plugins/midi/midiutil.c | 4 | ||||
-rw-r--r-- | apps/plugins/midi/midiutil.h | 2 | ||||
-rw-r--r-- | apps/plugins/midi/synth.c | 13 |
5 files changed, 12 insertions, 13 deletions
diff --git a/apps/plugins/midi/guspat.c b/apps/plugins/midi/guspat.c index 5f6ba35110..ea0ca92518 100644 --- a/apps/plugins/midi/guspat.c +++ b/apps/plugins/midi/guspat.c @@ -122,7 +122,7 @@ struct GWaveform * loadWaveform(int file) /* Byte-swap if necessary. Gus files are little endian */ for(a=0; a<wav->numSamples; a++) { - ((unsigned short *) wav->data)[a] = letoh16(((unsigned short *) wav->data)[a]); + ((uint16_t*) wav->data)[a] = letoh16(((uint16_t *) wav->data)[a]); } #endif @@ -130,7 +130,7 @@ struct GWaveform * loadWaveform(int file) if(wav->mode & 2) { for(a=0; a<wav->numSamples; a++) - ((short *) wav->data)[a] = ((unsigned short *) wav->data)[a] - 32768; + ((int16_t *) wav->data)[a] = ((uint16_t *) wav->data)[a] - 32768; } diff --git a/apps/plugins/midi/guspat.h b/apps/plugins/midi/guspat.h index c59cf7a3e3..ebb5f227d7 100644 --- a/apps/plugins/midi/guspat.h +++ b/apps/plugins/midi/guspat.h @@ -50,7 +50,7 @@ struct GWaveform unsigned int scaleFactor; unsigned char * res; - signed char * data; + int16_t * data; }; diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c index f960b72654..f4950408ab 100644 --- a/apps/plugins/midi/midiutil.c +++ b/apps/plugins/midi/midiutil.c @@ -114,9 +114,9 @@ unsigned char readChar(int file) return buf[0]; } -unsigned char * readData(int file, int len) +void * readData(int file, int len) { - unsigned char * dat = malloc(len); + void * dat = malloc(len); rb->read(file, dat, len); return dat; } diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h index 62a31d0c65..cf3666c97f 100644 --- a/apps/plugins/midi/midiutil.h +++ b/apps/plugins/midi/midiutil.h @@ -148,7 +148,7 @@ int readTwoBytes(int file); int readFourBytes(int file); int readVarData(int file); int eof(int fd); -unsigned char * readData(int file, int len); +void * readData(int file, int len); #define malloc(n) my_malloc(n) void * my_malloc(int size); 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) return 0; } -#define getSample(s,wf) ((short *)(wf)->data)[s] - void setPoint(struct SynthObject * so, int pt) ICODE_ATTR; void setPoint(struct SynthObject * so, int pt) { @@ -269,6 +267,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i register unsigned int cp_temp = so->cp; wf = so->wf; + const int16_t *sample_data = wf->data; const unsigned int pan = chPan[so->ch]; const int volscale = so->volscale; @@ -309,7 +308,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i cp_temp += so->delta; } - s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); + s2 = sample_data[(cp_temp >> FRACTSIZE)+1]; if(LIKELY(mode_mask28)) { @@ -319,7 +318,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i if(UNLIKELY(mode_mask_looprev)) { cp_temp += diff_loop; - s2=getSample((cp_temp >> FRACTSIZE), wf); + s2 = sample_data[cp_temp >> FRACTSIZE]; } else { @@ -333,7 +332,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i if(UNLIKELY(!mode_mask24)) { cp_temp -= diff_loop; - s2=getSample((cp_temp >> FRACTSIZE), wf); + s2 = sample_data[cp_temp >> FRACTSIZE]; } else { @@ -346,7 +345,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i if(UNLIKELY(cp_temp >= num_samples)) { cp_temp -= so->delta; - s2 = getSample((cp_temp >> FRACTSIZE)+1, wf); + s2 = sample_data[(cp_temp >> FRACTSIZE)+1]; if (!rampdown) /* stop voice */ { @@ -356,7 +355,7 @@ static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned i } /* Better, working, linear interpolation */ - s1=getSample((cp_temp >> FRACTSIZE), wf); + s1 = sample_data[cp_temp >> FRACTSIZE]; s1 +=((signed)((s2 - s1) * (cp_temp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); |