OpenAL not playing sound
<p>I have been working with OpenAL and I can't get it working. I figure the fault should lie in either OpenAL or my parser.<br/><br/>
<strong>OpenAL:</strong><br/></p>

<pre><code>/* has been initialized */
device = alcOpenDevice(NULL);
if (!device) { /* HANDLE ERROR */ } 
context = alcCreateContext(device, NULL);
if (!context) { /* HANDLE ERROR */ }

/* source has been created */
alGenSources(1, &amp;sourceID);
alSourcef(sourceID, AL_GAIN, 1);
alSourcef(sourceID, AL_PITCH, 1);
alSource3f(sourceID, AL_POSITION, 0, 0, 15);

/* listener has been set up */
alListenerf(AL_GAIN, 1);
alListener3f(AL_POSITION, 0, 0, 15);

/* audio buffer has been created */

/* WAV PARSER CODE GOES UP HERE */
ALuint audioBuffer;
alGenBuffers(1, &amp;audioBuffer);
alBufferData(audioBuffer, format, buffer, dataSize, sampleRate);

/* a sound has been played (or tried to, at least) */
alSourcei(sourceID, AL_BUFFER, audioID);
alSourcePlay(sourceID);
alSourcei(sourceID, AL_BUFFER, 0);    
</code></pre>

<p>The reason I suspect OpenAL is because <code>alGenSources</code> and <code>alGenBuffers</code> seem to consistently out <code>3435973836</code> instead of the sensible number of 1 or 0. However, when I do <code>alGetError()</code>, there's never an error. <br/><br/>
<strong>Parser:</strong><br/>
For the sake of brevity, I'll try to substitute certain code blocks with comments and trim the code. <br/></p>

<pre><code>FILE* file = fopen(fileName.c_str(), "rb");
char type[5];
type[4] = '\0';
// check to make sure the file is valid using 'fread(type, sizeof(char), 4, file)'
// then compare strcmp(type, "RIFF") != 0
// this is repeated for "RIFF", "WAVE", and "fmt "

// the following variables were all declared earlier in the method
fread(&amp;chunkSize, sizeof(int), 1, file);
fread(&amp;formatType, sizeof(short), 1, file);
fread(&amp;channels, sizeof(short), 1, file);
fread(&amp;sampleRate, sizeof(int), 1, file);
fread(&amp;avgBytesPerSec, sizeof(int), 1, file);
fread(&amp;bytesPerSample, sizeof(short), 1, file);
fread(&amp;bitsPerSample, sizeof(short), 1, file);
// check to see if we're at the audio data now using fread and strcmp
// strcmp(type, "data") != 0

fread(&amp;dataSize, sizeof(int), 1, file);
unsigned char* buffer = new unsigned char[dataSize];
fread(buffer, sizeof(char), dataSize, file);

ALenum format = bitsPerSample == 8 ? (channels == 1 ? AL_FORMAT_MONO8 : AL_FORMAT_STEREO8) : (channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16);
// audio buffer creation here
</code></pre>

<p>(Un)fortunately, my parser also doesn't print out any error messages. At this point I'm stuck. <br/></p>

<ul>
<li>My parser seems to be working</li>
<li>OpenAL initialized without any issues</li>
<li>a source and listener has been set up</li>
<li>an audio buffer has been attempted to be played <br/></li>
</ul>

<p>What is the issue here?</p>

<p><strong><em>Edit</em></strong><br/>
I've been tossing the bit of code around for many hours and still have no idea how to proceed. I also have no idea how to debug as I'm not getting any errors from OpenAL or my parser. Any help would be appreciated. </p>