#40906 - Ultima2876 - Sat Apr 23, 2005 1:57 pm
I've had some problems with Krawall lately. I'm using this code to fade out (to black):
However, when I'm fading with sound, the sound sometimes "crunches", making a horrible crunching noise, or fuzz. This seems to be completely random, as sometimes it works perfectly, others it onl crunches a tiny bit, and sometimes it even crunches horribly the whole way through the fade.
Is there any solution to this? (using High Quality mode in Krawall makes no difference) Is there a more efficient way to fade to black while providing a number of frames to fade over (the number of frames will only ever be 1 or a multiple of 15). Do you think it is my fade function using too much CPU time?
Thanks.
Code: |
void fade_to_black(int frames, int sound, u16 blend)
{ int i = 0; REG_BLDCNT = BLD_DEC | blend; REG_BLDY = BLD_EVY(0); for (i = 0; i < frames; i++) { if (sound == 1) { kramWorker(); i++; } WaitForVsync(); switch (frames) { case 1: REG_BLDY = BLD_EVY(16 * i / 1); break; case 15: REG_BLDY = BLD_EVY(16 * i / 15); break; case 30: REG_BLDY = BLD_EVY(16 * i / 30); break; case 45: REG_BLDY = BLD_EVY(16 * i / 45); break; case 60: REG_BLDY = BLD_EVY(16 * i / 60); break; case 75: REG_BLDY = BLD_EVY(16 * i / 75); break; case 90: REG_BLDY = BLD_EVY(16 * i / 90); break; case 105: REG_BLDY = BLD_EVY(16 * i / 105); break; case 120: REG_BLDY = BLD_EVY(16 * i / 120); break; case 135: REG_BLDY = BLD_EVY(16 * i / 135); break; case 150: REG_BLDY = BLD_EVY(16 * i / 150); break; case 165: REG_BLDY = BLD_EVY(16 * i / 165); break; case 180: REG_BLDY = BLD_EVY(16 * i / 180); break; case 195: REG_BLDY = BLD_EVY(16 * i / 195); break; case 210: REG_BLDY = BLD_EVY(16 * i / 210); break; case 225: REG_BLDY = BLD_EVY(16 * i / 225); break; case 240: REG_BLDY = BLD_EVY(16 * i / 240); break; case 255: REG_BLDY = BLD_EVY(16 * i / 255); break; } } REG_BLDY = BLD_EVY(16); } |
However, when I'm fading with sound, the sound sometimes "crunches", making a horrible crunching noise, or fuzz. This seems to be completely random, as sometimes it works perfectly, others it onl crunches a tiny bit, and sometimes it even crunches horribly the whole way through the fade.
Is there any solution to this? (using High Quality mode in Krawall makes no difference) Is there a more efficient way to fade to black while providing a number of frames to fade over (the number of frames will only ever be 1 or a multiple of 15). Do you think it is my fade function using too much CPU time?
Thanks.