int VorbisfileUser::fillBuffer(char *fillbuffer, int fillbufferLength) { if((pcmLeft == 0) && (bufferLeft == 0)) { // もう圧縮データも残ってない ZeroMemory((LPVOID)fillbuffer, fillbufferLength) ; return 0 ; } int filledLength = 0 ; while(fillbufferLength > 0) { long readBytes ; readBytes = ov_read(&ovFile, fillbuffer, fillbufferLength, 0, 2, 1, NULL) ; if((readBytes == OV_HOLE) || (readBytes == OV_EBADLINK)) { MessageBox(NULL, "Ogg Vorbisファイルが壊れているようです。", "VorbisfileUser class error", MB_OK|MB_ICONEXCLAMATION) ; ov_clear(&ovFile) ; info = NULL ; throw 0 ; } if(readBytes == 0) { // 残りは無いらしい pcmLeft = 0 ; ZeroMemory((LPVOID)fillbuffer, fillbufferLength) ; return filledLength ; } filledLength += readBytes ; fillbufferLength -= readBytes ; fillbuffer += readBytes ; pcmLeft -= readBytes ; if(pcmLeft <= 0) { pcmLeft = 0 ; } } return filledLength ; }