Handmade Hero»Forums»Code
Thompson Lee
20 posts
None
Day 20: ExpectedBytesUntilFlip variable isn't used
At 2:14:26 into the Day 20 video, I see Casey adding a new variable called ExpectedBytesUntilFlip.

The problem is, Casey didn't actually use that variable. The end result was that ExpectedBytesUntilFlip was never used, even though it's initialized.

I don't see Casey resolving this issue in Day 21 (jumping around in the video, didn't view through all of them), perhaps it went unnoticed.

------------

I decided to use that ExpectedBytesUntilFlip in the following code snippet:

1
2
3
float SecondsLeftUntilFlip = (TargetSecondsPerFrame - FromBeginToAudioSeconds);
DWORD ExpectedBytesUntilFlip = (DWORD) ((SecondsLeftUntilFlip / TargetSecondsPerFrame)* (float) ExpectedSoundBytesPerFrame);
DWORD ExpectedFrameBoundaryBytes = PlayCursor + ExpectedBytesUntilFlip;


What it did was the expected flip cursor is now very accurately close to the write cursor, and is within the margin of errors, which Casey was expecting before.
Roderic Bos
70 posts
Day 20: ExpectedBytesUntilFlip variable isn't used
Was answered in later stream and already asked here:
https://forums.handmadehero.org/i...hp/forum?view=topic&catid=4&id=93

;-)
Thompson Lee
20 posts
None
Day 20: ExpectedBytesUntilFlip variable isn't used
I guess I should resist the urge to ask more about possible errors along the way from Day 21 on through the most recent videos, and then ask about issues from there on.

Sorry about that, but thanks for spoilers! :D At least it can ease my mind.