After I recently got sound working (somewhat) in my platform layer using ALSA, I figured I should actually output something besides the sine wave test pattern.
I remembered that the WAVE file format is basically the set of samples we would want to return, with some additional headers describing the format, so I set out to write a WAVE decoder.
From
http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html you can very easily use the Handmade Hero code and Casey's videos to write your own. Memory map a file (like was done for the replay state files), create structs from the file format specification, and use casts with those structs and pointers to get to the sample data, and then return the samples in batches in the GetSoundSamples function (and loop when you get to the end).
If you're interested, my hack job is at:
https://github.com/nxsy/xcb_handmade/blob/master/src/alternate/
* wav.h for the structs
* wav.cpp for loading into memory
* alternate.cpp's GameGetSoundSamples to return the samples to the platform layer
(Yes, I do play a 44100Hz file at 48000Hz. Why do you ask?)