diff options
Diffstat (limited to 'apps/plugins/midi/midiplay.c')
-rw-r--r-- | apps/plugins/midi/midiplay.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index c557433dce..99f05718d6 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c | |||
@@ -148,32 +148,31 @@ bool lastswap=1; | |||
148 | 148 | ||
149 | static inline void synthbuf(void) | 149 | static inline void synthbuf(void) |
150 | { | 150 | { |
151 | int32_t *outptr; | 151 | int32_t *outptr; |
152 | register int i; | 152 | int i; |
153 | int currentSample=0; | ||
154 | int synthtemp[2]; | ||
155 | 153 | ||
156 | #ifndef SYNC | 154 | #ifndef SYNC |
157 | if(lastswap==swap) return; | 155 | if(lastswap==swap) return; |
158 | lastswap=swap; | 156 | lastswap=swap; |
159 | 157 | ||
160 | outptr=(swap ? gmbuf : gmbuf+BUF_SIZE); | 158 | outptr=(swap ? gmbuf : gmbuf+BUF_SIZE); |
161 | #else | 159 | #else |
162 | outptr=gmbuf; | 160 | outptr=gmbuf; |
163 | #endif | 161 | #endif |
164 | 162 | ||
165 | for(i=0; i<BUF_SIZE; i++) | 163 | for(i=0; i<BUF_SIZE/numberOfSamples; i++) |
166 | { | 164 | { |
167 | synthSample(&synthtemp[0], &synthtemp[1]); | 165 | synthSamples((int32_t*)outptr, numberOfSamples); |
168 | currentSample++; | 166 | outptr += numberOfSamples; |
169 | *outptr=((synthtemp[0]&0xFFFF) << 16) | (synthtemp[1]&0xFFFF); | 167 | if( tick() == 0 ) |
170 | outptr++; | 168 | quit=1; |
171 | if(currentSample==numberOfSamples) | 169 | } |
172 | { | 170 | |
173 | if( tick() == 0 ) quit=1; | 171 | if(BUF_SIZE%numberOfSamples) |
174 | currentSample=0; | 172 | { |
175 | } | 173 | synthSamples((int32_t*)outptr, BUF_SIZE%numberOfSamples); |
176 | } | 174 | outptr += BUF_SIZE%numberOfSamples; |
175 | } | ||
177 | } | 176 | } |
178 | 177 | ||
179 | void get_more(unsigned char** start, size_t* size) | 178 | void get_more(unsigned char** start, size_t* size) |