Hi,
Not entirely sure about this as a solution but I do have a suggestion.
The WAVEFORMATEX returned from wav.GetFormat()...
May I suggest that you allocate a WAVEFORMATEX for Sounds[id]->pwfx and TempSound->pwfx (including any extra bytes) and copy ( memcpy ) the wave format returned by wav.GetFormat() including said extra bytes, as I believe that memory is freed in the destructor of the CWaveFile (cannot confirm this as I'm away at the moment).
Also place a break point in your unmodified code just before CreateSourceVoice and check that the
Sounds[SoundNum]->pwfx
is valid. I think you'll find that because it is a pointer to memory that has been freed in the CWaveFile destructor then it is unrelieable.
Hope this helps.
:)