[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code template=code012_template.html title="Platform-independent Sound Output" vod_platform=youtube id=5YhR2zAkQmo annotator=jacebennett annotator=Miblo annotator=theinternetftw] [0:57][Review basics of platform API design] [3:54][What the API needs to support] [4:53][Starting with moving sound across the API boundary] [10:30][How most games deal with time (poorly)] [11:06][What we are going to do] [14:55][Moving sound generation across the boundary] [19:30][Finding the seams] [22:49][Dealing with sound buffers abstractly] [25:50][Allocating a game sound buffer] [29:33][Tangent: buffer overruns and how the debugger helps] [31:09][Actually using the game-generated sound] [37:01][Cleaning up the old stuff] [42:16][A step back] [43:30][Tangent: memory management & alloca] [47:57][Nevermind, we'll put it on the heap] [50:57][Review] [53:54][The remaining jank] [57:27][Tweak the build.bat] [58:47][Final Thoughts] [59:30][Q&A][:speech] [1:00:16][Will we use alloca to store pointers to game objects that are local to the player?] [1:04:29][If the DirectSound Lock fails, you'll pass garbage pointers to the game logic.] [1:05:31][When you say 60fps may not be feasible do you mean on non-PC platforms?] [1:07:50][Are we not worried about clean builds?] [1:08:37][Allocating every frame was your bug with alloca. You were calling it in a loop.] [1:12:26][Can you explain again why our current sound buffer fill is problematic?] [1:15:43][Wouldn't updating graphics and sound on the same frame cause audio lag?] [1:17:08][Since alloca is just a function call, how does the compiler know to free the memory?] [1:17:44][Will we spilt game sound update out of GameUpdateAndRender so we can use it as a callback or on a different thread?] [1:18:16][alloca is deprecated, we should use malloca.] [1:20:17][can you provide a log of the chat on the website?] [1:20:43][malloca allocs on the stack if less than 1kB and malloc's if greater.] [1:21:33][How can you safely predict where the flip happens so you can write sound there?] [1:24:54][We know that you can't go below 30fps for 'smooth' video. Is there a similar rule of thumb for audio?] [1:26:29][alloca is deprecated because.... \[There are better options.\]] [1:30:49][How do you do 2 voices in 1 buffer?] [1:30:58][When will the first sprite be displayed in animation?] [1:31:11][I've heard the brain treats sounds within 10ms as in-sync?] [1:31:39][When you work with temporary memory are there dangers? How do we protect against them?] [1:33:21][As a rhythm game player, I can notice audio sync off as little as 10ms...] [1:35:03][Sign Off][:speech] [/video]