diff options
| author | Nils Wallménius <nils@rockbox.org> | 2007-11-11 01:02:45 +0000 |
|---|---|---|
| committer | Nils Wallménius <nils@rockbox.org> | 2007-11-11 01:02:45 +0000 |
| commit | 0fd4c2e455957ec078425361972003e8c3c50fe4 (patch) | |
| tree | dbd1e43836bf567cf8c5bc1f54c9eb4e3c2a77be /apps/plugins/midi/sequencer.c | |
| parent | d185f9eba8706fb2415eb6406a0ffd90113e95da (diff) | |
| download | rockbox-0fd4c2e455957ec078425361972003e8c3c50fe4.zip rockbox-0fd4c2e455957ec078425361972003e8c3c50fe4.tar.gz rockbox-0fd4c2e455957ec078425361972003e8c3c50fe4.tar.bz2 rockbox-0fd4c2e455957ec078425361972003e8c3c50fe4.tar.xz | |
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.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c index 4e6c15f..7847c37 100644 --- a/apps/plugins/midi/sequencer.c +++ b/apps/plugins/midi/sequencer.c @@ -156,7 +156,7 @@ static inline void computeDeltas(int ch) int a=0; for(a = 0; a<MAX_VOICES; a++) { - if(voices[a].isUsed==1 && voices[a].ch == ch) + if(voices[a].isUsed && voices[a].ch == ch) { findDelta(&voices[a], ch, voices[a].note); } @@ -202,7 +202,7 @@ inline void pressNote(int ch, int note, int vol) if(voices[a].ch == ch && voices[a].note == note) break; - if(voices[a].isUsed==0) + if(!voices[a].isUsed) break; } if(a==MAX_VOICES) @@ -227,7 +227,6 @@ inline void pressNote(int ch, int note, int vol) setVolScale(a); - voices[a].loopState=STATE_NONLOOPING; /* * OKAY. Gt = Gus Table value * rf = Root Frequency of wave @@ -239,7 +238,7 @@ inline void pressNote(int ch, int note, int vol) { findDelta(&voices[a], ch, note); /* Turn it on */ - voices[a].isUsed=1; + voices[a].isUsed=true; setPoint(&voices[a], 0); } else { @@ -256,7 +255,7 @@ inline void pressNote(int ch, int note, int vol) wf->mode = wf->mode & (255-28); /* Turn it on */ - voices[a].isUsed=1; + voices[a].isUsed=true; setPoint(&voices[a], 0); } else @@ -411,7 +410,7 @@ void seekBackward(int nsec) { notesUsed = 0; for(a=0; a<MAX_VOICES; a++) - if(voices[a].isUsed == 1) + if(voices[a].isUsed) notesUsed++; tick(); } while(notesUsed == 0); |