summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/sequencer.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-11-11 01:02:45 +0000
committerNils Wallménius <nils@rockbox.org>2007-11-11 01:02:45 +0000
commit0fd4c2e455957ec078425361972003e8c3c50fe4 (patch)
treedbd1e43836bf567cf8c5bc1f54c9eb4e3c2a77be /apps/plugins/midi/sequencer.c
parentd185f9eba8706fb2415eb6406a0ffd90113e95da (diff)
downloadrockbox-0fd4c2e455957ec078425361972003e8c3c50fe4.tar.gz
rockbox-0fd4c2e455957ec078425361972003e8c3c50fe4.zip
Rearrange logic in the synthVoice loop to do less tests and remove need of a struct member for a small speedup, move some memory lookups out of the loop for a small speedup, further cosmetic changes to the synthVoice function. Change isUsed to a bool for clearer logic and also a tiny speedup
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15563 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/midi/sequencer.c')
-rw-r--r--apps/plugins/midi/sequencer.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c
index 4e6c15fba6..7847c375ba 100644
--- a/apps/plugins/midi/sequencer.c
+++ b/apps/plugins/midi/sequencer.c
@@ -156,7 +156,7 @@ static inline void computeDeltas(int ch)
156 int a=0; 156 int a=0;
157 for(a = 0; a<MAX_VOICES; a++) 157 for(a = 0; a<MAX_VOICES; a++)
158 { 158 {
159 if(voices[a].isUsed==1 && voices[a].ch == ch) 159 if(voices[a].isUsed && voices[a].ch == ch)
160 { 160 {
161 findDelta(&voices[a], ch, voices[a].note); 161 findDelta(&voices[a], ch, voices[a].note);
162 } 162 }
@@ -202,7 +202,7 @@ inline void pressNote(int ch, int note, int vol)
202 if(voices[a].ch == ch && voices[a].note == note) 202 if(voices[a].ch == ch && voices[a].note == note)
203 break; 203 break;
204 204
205 if(voices[a].isUsed==0) 205 if(!voices[a].isUsed)
206 break; 206 break;
207 } 207 }
208 if(a==MAX_VOICES) 208 if(a==MAX_VOICES)
@@ -227,7 +227,6 @@ 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;
231 /* 230 /*
232 * OKAY. Gt = Gus Table value 231 * OKAY. Gt = Gus Table value
233 * rf = Root Frequency of wave 232 * rf = Root Frequency of wave
@@ -239,7 +238,7 @@ inline void pressNote(int ch, int note, int vol)
239 { 238 {
240 findDelta(&voices[a], ch, note); 239 findDelta(&voices[a], ch, note);
241 /* Turn it on */ 240 /* Turn it on */
242 voices[a].isUsed=1; 241 voices[a].isUsed=true;
243 setPoint(&voices[a], 0); 242 setPoint(&voices[a], 0);
244 } else 243 } else
245 { 244 {
@@ -256,7 +255,7 @@ inline void pressNote(int ch, int note, int vol)
256 wf->mode = wf->mode & (255-28); 255 wf->mode = wf->mode & (255-28);
257 256
258 /* Turn it on */ 257 /* Turn it on */
259 voices[a].isUsed=1; 258 voices[a].isUsed=true;
260 setPoint(&voices[a], 0); 259 setPoint(&voices[a], 0);
261 260
262 } else 261 } else
@@ -411,7 +410,7 @@ void seekBackward(int nsec)
411 { 410 {
412 notesUsed = 0; 411 notesUsed = 0;
413 for(a=0; a<MAX_VOICES; a++) 412 for(a=0; a<MAX_VOICES; a++)
414 if(voices[a].isUsed == 1) 413 if(voices[a].isUsed)
415 notesUsed++; 414 notesUsed++;
416 tick(); 415 tick();
417 } while(notesUsed == 0); 416 } while(notesUsed == 0);