#include "player_win.h" #include #include #include void InternalPlayer::init() { blockCounter = 0; blockPosition = 0; bufSize = 32768; bufCount = 4; WAVEFORMATEX wfx; wfx.nSamplesPerSec = 44100; wfx.wBitsPerSample = 16; wfx.nChannels = 2; wfx.cbSize = 0; /* size of _extra_ info */ wfx.wFormatTag = WAVE_FORMAT_PCM; wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels; wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec; if(waveOutOpen(&hWaveOut, WAVE_MAPPER, &wfx, (DWORD_PTR)InternalPlayer::waveOutProc, (DWORD_PTR)this, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { fprintf(stderr, "unable to open WAVE_MAPPER device\n"); ExitProcess(1); } header.resize(bufCount); buffer.resize(bufCount); for(int i=0; i