   Openal/Ogg Vorbis pitch problem [solved]
  I recently set up a simple OpenAL and Ogg Vorbis audio loading/playing system, based on this tutorial. Both OpenAL and Ogg Vorbis are initializing and running (mostly) without errors. However, every time I load and play an ogg file, it plays sped up, at a really high pitch. Also, when I try to manually reset the pitch of my sound using alSourcef(Source, AL_PITCH, 1.0); nothing happens. I've done a good amount of googling around, but haven't been able to find a solution. I'm using the latest versions of OpenAL and Ogg Vorbis, so that shouldn't be a problem. My code is basically the same as the code in the tutorial, so I'm kinda stumped as to why it's not working. Can anyone give me some advice as to what my problem is?EDIT: By the way, I have tried a few different ogg files from different sources. The problem occurs with all of them.[Edited by - ProgrammerZ on June 2, 2010 4:48:22 PM]
  Can you post the code you're using to load the Ogg Vorbis files? It sounds more like the frequency or audio format is being set incorrectly...   ;  Sure, here is my code (sorry about the late reply):// after OpenAL has been initializedint bitstream = 0;long bytes = 0;char bufferarray[(4096 * 8)]; // a buffer for reading chunks of the filestd::vector<BYTE> buffer;FILE *f;// open for binary readingf = _wfopen(L"res/sound.ogg", L"rb");if (!f){fclose(f);// error reporting code omitted}vorbis_info *info = NULL;ALenum format;OggVorbis_File oggfile;ov_open(f, &oggfile, NULL, 0);// get information about the fileinfo = ov_info(&oggfile, -1);if (info->channels == 1)format = AL_FORMAT_MONO16;elseformat = AL_FORMAT_STEREO16;int section;do {// read a chunk of databytes = ov_read(&oggfile, bufferarray, BUFFERSIZE, 0, 2, 1, &section);// append to end of bufferbuffer.insert(buffer.end(), bufferarray, bufferarray + bytes);} while (bytes > 0);ov_clear(&oggfile); // release the file// Upload sound data to bufferalBufferData(m_iBuffer, format, &buffer[0], buffer.size(), info->rate);// Attach sound buffer to sourcealSourcei(m_iSource, AL_BUFFER, m_iBuffer);// play the soundalSourcePlay(m_iSource);By the way, after reading your post, I did a Google search for "OpenAL Ogg Vorbis frequency", and found something about using the AL_EXT_Vorbis OpenAL extension for loading .ogg files instead of using the libvorbisfile library. Is this anything I would want to look into?   ;  Oh boy. I feel stupid.I just figured out what was causing my problem. I was passing the value of info->rate to alBufferData, instead of copying the value and passing that in ... like the tutorial said. I thought I'd be smart and skip that extra step. But, it turns out that calling ov_clear invalidates my rate pointer, causing my info->rate variable to be filled with garbage. So ... yeah.Well, thanks anyway.   