Handmade Hero»Forums»Code
2 posts
[Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
I was doing some restructuring of my object names at the time of this episode, and I'm really worried I might have broken something without realizing it, because my sound code keeps popping now and it wasn't before

https://mega.nz/#!94kjABYD!ZcHkBg...EIpAKbyBVy-DK_HWJ2g3KU49IQzxroYn4
I have such a horrible time debugging sound code so I don't know where to look to fix this problem, I thought everything important matched up with Casey's code already

do I actually need to fix this? or will this code be replaced anyway in the future?

if i do need to fix it, does anyone know what might be wrong
Simon Anciaux
1337 posts
[Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
Edited by Simon Anciaux on Reason: Second error
In win32_handmade.cpp on line 442 you used Size1 instead of Size2 and Region1 instead of Region2 on the next line.
1
2
DWORD SampleCount2 = (Size1) / buffer->SampleSize;
int16* SampleOut2 = (int16*)Region1:
2 posts
[Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
Edited by Kavukamari on
you're a lifesaver, I didn't even notice that at all (i had scanned the code over and over assuming that just because it was copypasted from my other implementation that it was correct), thanks a lot

it seems like i missed something else as well cause it's back to popping every second, i just gotta figure out why that might be and itll be fine

AH nevermind, the problem was that I forgot I need to keep using the same pointer to the source samples, because I'm only writing that many, and I don't want it to start back at the beginning if there are two regions, I want it to keep going from where the first left off