.h: #include #include #include #define ERROR_LENGTH 1024 class CReadDemoWave { public: BYTE m_pbyDemoBuffer; static int testinteger; void ReadDemoWave(); BYTE *ReadDemoIntoBuffer(); void PlayWav(); long QueueWaveData(HWAVEOUT HWaveOut, WAVEHDR * waveHeader, DWORD WaveDataPlayed, DWORD WaveBufSize, HMMIO HMmio); BYTE *GetDemoBuffer(void); //void WriteDemo(HMMIO recordHandle); //public: // =========== D == E == M == O ======================= // BD create demo buffer. WAVEHDR lpDemoData; DWORD dwDemoDataSize; int m_nDemoBufferSize; //BYTE* m_pbyDemoBuffer; HMMIO m_hmmio; //HMMIO hmmio; char m_szError[ERROR_LENGTH]; int m_nError; MMIOINFO m_mmioInfo; DWORD dwDataSize; DWORD dwCount; HPSTR m_hptr; int m_nBufferSize; //WAVEFORMATEX waveFormat; }; .cpp: // ================DEMO======================== BYTE *ReadDemoWave::ReadDemoIntoBuffer() { // HPSTR demobuffer; // Open file if( (m_hmmio=mmioOpen("AIPL.WAV", NULL,MMIO_ALLOCBUF | MMIO_READ )) == NULL ) { AfxMessageBox("A critical file is missing from your system. Contact AIPL. Singulator will now stop."); m_nError = 1; exit(NULL); } // GET INFO ON FILE I/O BUFFER if (mmioGetInfo(m_hmmio, &m_mmioDemoInfo, 0)) { sprintf(m_szError, "Failed to get I/O buffer info/n"); AfxMessageBox("Failed to get I/O buffer info"); m_nError = 1; mmioClose(m_hmmio,0); return (NULL); } // check if needs advance if (m_mmioDemoInfo.pchNext == m_mmioDemoInfo.pchEndRead){ if (mmioAdvance(m_hmmio,&m_mmioDemoInfo, MMIO_READ)){ //ERROR HERE mmioClose(m_hmmio, 0); sprintf(m_szError, "Failed to Advance I/O buffer info/n"); AfxMessageBox("Failed to advance I/O buffer info"); m_nError = 1; return (NULL); } } HWND hwnd=NULL; LPSTR path = "AIPL.WAV"; PlayWav(); WriteDemo(&m_pbyDemoBuffer,dwDemoDataSize); mmioSetInfo(m_hmmio, &m_mmioDemoInfo, 0); mmioClose(m_hmmio, 0); return (&m_pbyDemoBuffer); } //================PLAYWAV======================= void CReadDemoWave::PlayWav() { HMMIO hmmio; MMCKINFO mmckinfoParent; MMCKINFO mmckinfoSubchunk; DWORD dwFmtSize; DWORD WaveDataPlayed; HWAVEOUT hwaveout=NULL; WAVEFORMATEX waveFormat; /* for reading a fmt chunk's data */ waveFormat.wFormatTag = WAVE_FORMAT_PCM; if((hmmio=mmioOpen("aipl.WAV",NULL,MMIO_READ | MMIO_ALLOCBUF)) == NULL) { AfxMessageBox("Error opening file")