forked from len0rd/rockbox
Unroll a frequently executed loop a little for a small speedup
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14924 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
035529c487
commit
f9664e7e87
1 changed files with 24 additions and 7 deletions
|
|
@ -16,20 +16,37 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig);
|
int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig);
|
||||||
signed short int synthVoice(struct SynthObject * so);
|
signed short int synthVoice(struct SynthObject * so);
|
||||||
void setPoint(struct SynthObject * so, int pt);
|
void setPoint(struct SynthObject * so, int pt);
|
||||||
|
|
||||||
static inline void synthSample(int * mixL, int * mixR)
|
static inline void synthSample(int * mixL, int * mixR)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
register int dL=0;
|
register int dL=0;
|
||||||
register int dR=0;
|
register int dR=0;
|
||||||
register short sample = 0;
|
register short sample = 0;
|
||||||
register struct SynthObject *voicept=voices;
|
register struct SynthObject *voicept=voices;
|
||||||
struct SynthObject *lastvoice=&voices[MAX_VOICES];
|
|
||||||
|
|
||||||
while(voicept!=lastvoice)
|
for(i=MAX_VOICES/2; i > 0; i--)
|
||||||
|
{
|
||||||
|
if(voicept->isUsed==1)
|
||||||
|
{
|
||||||
|
sample = synthVoice(voicept);
|
||||||
|
dL += (sample*chPanLeft[voicept->ch])>>7;
|
||||||
|
dR += (sample*chPanRight[voicept->ch])>>7;
|
||||||
|
}
|
||||||
|
voicept++;
|
||||||
|
if(voicept->isUsed==1)
|
||||||
|
{
|
||||||
|
sample = synthVoice(voicept);
|
||||||
|
dL += (sample*chPanLeft[voicept->ch])>>7;
|
||||||
|
dR += (sample*chPanRight[voicept->ch])>>7;
|
||||||
|
}
|
||||||
|
voicept++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=MAX_VOICES%2; i > 0; i--)
|
||||||
{
|
{
|
||||||
if(voicept->isUsed==1)
|
if(voicept->isUsed==1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue