VOGONS

Common searches


Search results

Display options

Re: 2003-7-26 Release

Well, that would explain not seeing it before:) btw, then I would assume the tcache variable is only for code readability since it's not doing a copy & it's pointing to the same address as pcache. Aaand, yes, know all about algorthim vs cycle count. Speaking of focusing the main problem areas, have …

Re: 2003-7-26 Release

Surpised I missed this one at first: for(t=0;t<4;t++) { patchCache *tcache = &pcache[t]; dpoly::partialStatus *partCache = &tmppoly->pStatus[t]; if(isRy) tcache = &drumCache[tmppoly->pcmnum][t]; patchCache is a big structure and the code doing a default assignment of it. If the instrument is a drum, …

Re: 2003-7-26 Release

from struct dpoly: struct partialStatus { // Keyfollowed note values int noteval; // Keyfollowed filter values int realval; int filtval; Bit32s envpos[4]; Bit32s envstat[4]; Bit32s envbase[4]; Bit32s envdist[4]; Bit32s envsize[4]; Bit32u lfopos; soundaddr partialOff; // soundaddr wgOff; bool …

Re: 2003-7-26 Release

Called by getSample. INLINE Bit16s MidiChannel::getFiltEnvelope(Bit16s wg, dpoly::partialStatus *pStat, dpoly *poly, bool inDecay) { // // unused // Bit32u sampoff; // float out, out2; // float specialfreq,conv; // int usefreq; // realfol; // envCache *myenv = &pcache[pStat->partNum].fEnvCache; …

Re: 2003-7-26 Release

Called by getSample. INLINE Bit16s MidiChannel::getAmpEnvelope(dpoly::partialStatus *pStat, dpoly *poly, bool inDecay) { Bit16s tc; patchCache *tcache = &pcache[pStat->partNum]; if(inDecay) { if(!pStat->isDecayed) { if(pStat->envpos[AMPENV] >= pStat->envsize[AMPENV]) pStat->isDecayed = true; tc = ( …

Re: 2003-7-26 Release

Ok here' goes: INLINE short MidiChannel::getSample(short *lspecial, short *rspecial) { int t, m, c, loc, pcm, partplay; dpoly *tmppoly; //if(!isRy) return 0; //if ((this->channum<2) || (this->channum>8)) return 0; //if(this->channum!=1) return 0; if(isRy) partplay = DRUMPOLY else partplay = DPOLY; …

Re: 2003-7-26 Release

Oi, in PlaySysex, all the range checks if ((addr>=0x00000) && (addr<0x30000)) following the initial one should be 'else if''s' to avoid needlessly doing all the following checks once having already found & executed the matching range.

Re: 2003-7-26 Release

Changing the beginning of PlayMsg to what's below saves 10 cycles when chan>8. void PlayMsg(Bit32u msg) { int chan = msg & 0xf; isEnabled= true; //if(chan!=0x9) { // if(chan==12) return; // chan = chan & 0x7; // //} else { // chan = 8; //} //if (chan==0) return; //int prechan = chan; //if(code!=0xf0 …

Re: 2003-7-26 Release

I didn't look close enough, here's nearly 7k easily saved right here: int period = 256; float angdelt = (360 / (float)period) * (PI / 180); float angval = 0; for(int ang=0;ang quartang)) sintable[ang] = (int)((1.0-tval) * 256); else if ((ang>halfang) && (ang<=(quartang+halfang))) sintable[ang] = ( …

Re: 2003-7-26 Release

In InitTables from MidiHandler_mt32 class, merging the following loops save 31k cycles. for(dep=0;dep<=100;dep++) { for(velt=0;velt<128;velt++) { float fdep = ((float)dep / 100.0) * 256; float fv = (velt - 64.0) / 64.0; tempdep = 256.0 + (fdep * fv); filveltable[velt][dep] = (int)tempdep; //LOG_MSG …

Re: 2003-7-26 Release

Fair enough. As for the second caclulation, it sounds like you think I only applied the divide to calc for the first case? Barring a bug, the rewrite is functionally equivalent. The handling of both cases were moved outside of the if else structure and became the general case. For the other cases, …

Re: 2003-7-26 Release

You know what's coming, more optmization:) INLINE Bit16s MidiChannel::getPitchEnvelope(dpoly::partialStatus *pStat, dpoly *poly, bool inDecay) { Bit32u sampoff; patchCache *tcache = &pcache[pStat->partNum]; Bit16s tc; pStat->pitchsustain = false; if(inDecay) { if(pStat->isDecayed || (pStat->envpos[ …

Re: 7-25-2003 MT-32 Version

Code clarification is what comments are for:) You know, clarification without the cycle penalty:) Since most coders don't like commenting or documentation, only code, I suppose teaching the idea of self documenting code is the busines worlds way of tricking coders into doing so:) ps. If you'll …

Re: 7-25-2003 MT-32 Version

No problem, I only went over the pitch caching function. Also, for a cheap gain I was using bits16s, 32, etc as equivalents to int & float which is wrong looking at your definition of them. It's minor. And speaking of avoiding jumps, in fixkeyfollow, I've replaced the big case statement with an …

Re: 7-25-2003 MT-32 Version

Thanks Zorbid, and now for another function update: MidiChannel::MidiChannel(int samp, int cnum) { isRy = holdpedal = isPlaying = false; rightvol = leftvol = 255; patch = storedpatch = 0; sampRate = samp; channum = cnum; volume = 102; panpot = 64; if(cnum==8) { isRy = true; int pan; volume = 127; // …

Re: 7-25-2003 MT-32 Version

Cleaned up getPitchEnvelope: INLINE Bit16s MidiChannel::getPitchEnvelope(int partNum, dpoly *poly, bool inDecay) { patchCache *tcache = &pcache[partNum]; Bit16s destin, tc; Bit32u sampoff; if(inDecay) { destin = poly->decay[partNum][PITCHENV]; sampoff = (destin) >> ENVSPEED; if(sampoff>100) return …

Re: 7-25-2003 MT-32 Version

A cleaned up MidiChannel::setPitchCache: INLINE void MidiChannel::setPitchCache(int partNum) { Bit16s found, tmp, score, startp, endp, pitchEnvlevel, sampoff, pitchEnvoff, m; Bit32s realtime, distt, effectors[4][2]; for(m=0;m<4;m++) { effectors[m][0] = pcache[partNum].pitchEnv.level[m]; effectors …

Page 41 of 41