|
From: Lourens V. <js...@dd...> - 2000-06-27 17:17:47
|
> For some reason I got the idea that in the module code I had been examining > interpolation was a post process which doesn't make sense really, seeing as > interpolation is about creating points. > > I decided to re-exam what was going on and figured it out well and truely > this time. What it does mean is that we 100% must go over the integer based > mixing now, we cannot stick with floating point, there is no advantage and > if it stays floating point our code will be extremely slow, I can easily see > losses of several hundread percent. That article is a bit misleading indeed! Glad my instinct was right about this anyway (: > Also it doesn't take long before you realise how well this code could work > in assembler. The potential benefits are immense. Yep. Looks dandy! >The only problem in the above example is that SamplePos is moved by >floating-point step, as F2/F1 is a floating-point value. To solve this, we >can do simple linear interpolation, that is, separately add integral step >and fractional step, like this: Huh? That is fixed point, has nothing to do with lerping, right? > One final point and this is what I need you guys to help me on, see this > line of code: > > IntSamplePos += IntStep + CY; > > CY from what I can work out represents the carry flag, it would appear this > is something that isn't present in Windows compilers yet I believe you would > find it in Borland compilers. I could really do with finding or simulating > the carry counter (or maybe even the overflow flag) for my ANSI C++ part of > SUB-SONIC. Once this is done I can actually get on and write the asm code > and watch the CPU usage go down dramatically. Well, I don't think you're going to get direct access to the carry flag from ANSI C, after all there may not even be a carry flag on a certain platform. Anyway, I suggest doing it the way you're doing it already, add FracStep, and check if FracSamplePos is now smaller. If so, increment IntSamplePos. > So I hope I've cleared those points up for you (and me) now. I will play > around with my mixing code a little more, it looks extremely ugly having two > sorts of mixing code in the same module with 50% of commented out. What happened to #ifdef? > Doug #Lourens |