你提到你了解PlaySound.其中一个标志(SND_MEMORY)将允许您播放已加载到内存中的WAVE,即您自己创建的缓冲区.只要缓冲区具有适当的WAVE标题,无论你放在哪里都应该通过扬声器播放.
标头是一个44字节的块,非常简单
struct WaveHeader
{
DWORD chunkID; // 0x46464952 "RIFF" in little endian
DWORD chunkSize; // 4 + (8 + subChunk1Size) + (8 + subChunk2Size)
DWORD format; // 0x45564157 "WAVE" in little endian
DWORD subChunk1ID; // 0x20746d66 "fmt " in little endian
DWORD subChunk1Size; // 16 for PCM
WORD audioFormat; // 1 for PCM, 3 fot EEE floating point , 7 for μ-law
WORD numChannels; // 1 for mono, 2 for stereo
DWORD sampleRate; // 8000, 22050, 44100, etc...
DWORD byteRate; // sampleRate * numChannels * bitsPerSample/8
WORD blockAlign; // numChannels * bitsPerSample/8
WORD bitsPerSample; // number of bits (8 for 8 bits, etc...)
DWORD subChunk2ID; // 0x61746164 "data&#