Input Cleanup and Fixes

This episode starts with some cleanup and fixes to the input handling code from yesterday.

Sound Programming for Games

Casey starts with a high level overview of sound programing for games. The key ideas here are that we are allocating a circular buffer for sound, and the system will play it continually on a loop. If you haven't worked with circular buffers (or ring buffers) before, much of this code will be confusing. It's worth taking some time to familiarize yourself with them.

Resources:

Working with DirectSound

The basic process for initializing DirectSound is as follows:

  1. Load the Library - LoadLibrary("dsound.dll")
  2. Create a DirectSound object - DirectSoundCreate()
  3. Set the Cooperative Level - IDirectSound8::SetCooperativeLevel()
  4. "Create" a primary buffer - IDirectSound8::CreateSoundBuffer()
  5. Create a secondary buffer
  6. Tell DirectSound to start playing the secondary buffer - IDirectSoundBuffer8::Play()

In the next episode we will look closely at how to fill this buffer and implement it in the game loop.