vorbis_info * vi = ov_info(&vf, -1);
DWORD sizeofFile = (DWORD)ov_pcm_total(&vf, 0);
DWORD position;
char * tempBuffer = new char[sizeofFile];
int p = 1;
while(position < sizeofFile)
{
p = ov_read(&vf, tempBuffer + position, sizeofFile - position, 0, 2, 1, 0);
position += p;
}
alBufferData(ALbuf, AL_FORMAT_STEREO16, (ALvoid*)tempBuffer, sizeofFile, vi->rate);
alSourcei (ALsrc, AL_BUFFER, g_vALbuffer );
delete [] tempBuffer;
i got a ogg vorbis player class off flipcode''s cotd archive, and i''m trying to make it work with openAL instead of directx. i''ve tested it by replacing the ogg reading part with a load wav, and it played, so thats not the problem. its somwhere along the lines getting tempBuffer into the AL buffer. i''m almost positive its because when i was using directsound, it had a lot of variables like channels, and some others. but with openal, i either can''t figure out how to set them or it doesn''t have them. i also assume ogg''s format is stereo 16 bit?
well, the above code doesn''t work and i can''t figure out why, i need your help
whats wrong with this code? (ogg vorbis and openAL)
DOH!!!!!!!!!!!!!!!!!!!!!
i''m a flippin dumbass, i didn''t init position to 0. i noticed it while checking the post for spelling errors
i''m a flippin dumbass, i didn''t init position to 0. i noticed it while checking the post for spelling errors
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement