Handmade Hero » Forums » Code » [Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
Kavukamari
2 posts
#12806 [Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
3 months, 2 weeks ago

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
mrmixer
Simon Anciaux
286 posts
#12808 [Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
3 months, 2 weeks ago Edited by Simon Anciaux on Aug. 8, 2017, 10:57 a.m. 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:
Kavukamari
2 posts
#12819 [Day 012] Popping artifacts introduced upon restructuring of sound code, can't pinpoint problem (need help)
3 months, 2 weeks ago Edited by on Aug. 9, 2017, 6:24 a.m.

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