I am implementing ogg support for my audio engine. I have retrieved the ogg info using vorbis_info, and everything is okay. When I got to lock (or unlock) the directsound buffer in order to read in the ogg data, I receive an access violation. I can't find any reason why the following code doesn't work.
Any help would be much appreciated.
pDS->CreateSoundBuffer( &desc, &pTemp, NULL );
DWORD size = BUFSIZE;
DWORD pos = 0;
int sec = 0;
int ret = 1;
pTemp->Lock( 0, size, (LPVOID*)&buf, &size, NULL, NULL, DSBLOCK_ENTIREBUFFER);
// now read in the bits
while(ret && pos<size)
ret = ov_read(&vf, buf+pos, size-pos, 0, 2, 1, &sec);
pos += ret;
pTemp->Unlock( buf, size, NULL, NULL );