   Compiling and Linking: OpenAL sound not playing
  Ok, I got everything in my program to compile and link and the program runs. The problem is that the sound is just not playing. I'm using the following tutorial:http://www.gamedev.net/reference/articles/article1958.aspThe OpenAL portion of my game is IDENTICAL to the OpenAL in the files that can be downloaded on that site. I'm 100% sure I have the sound file right where it needs to be. Now, I know I'm not supposed to post a whole bunch of code, so I"m going to ask a simple question first, and if I still can't figure it out, then I'll post some code. My question is how do I do any error testing in the code from that tutorial?If something is going wrong in my code, I have no way of knowing cause I don't know how to test for errors. Could I get some help on this?   
  Make sure you are creating it with the right device.  If you've got, say a usb headset and your soundcard in there, if Windows has the usb headset set as the default device then it will go out over that.Long shot, but do check the default Windows sound device if you are confident in the code.From personal experience, I've also had troubles using OpenAL with the integrated chipsets on some mother boards (eg the cheapo ones).  That is down to drivers.   ;  I'm not EXTREMELY confident in my code, thats why I want to test for errors in my code. i.e., when I call alutLoadWAVFile() , I want to make sure that did what it was supposed to. I know it can't have anything to do with my device or my hardware because I have another project (that I didn't make) in which OpenAL worked. It must be the code, but from what I can see, all the code in my project is IDENTICAL to the code in the other project.alsound.h#include <al.h>#include <alut.h>//sound classclass Sound{public:void LoadSound(char fname[40], bool looping);void SetProperties(float x, float y, float z, float vx, float vy, float vz);void SetSourceRelative();void PlaySound();void StopSound();void DestroySound();private:char*alBuffer;ALenumalFormatBuffer;ALsizeialFreqBuffer;longalBufferLen;ALbooleanalLoop;unsigned intalSource;unsigned intalSampleSet;};alsource.cpp#include <windows.h>#include <math.h>#include <stdio.h>#include <conio.h>#include <stdlib.h>#include <al.h>#include <alut.h>#include "alsound.h"void SetListenerPosition(float x, float y, float z){//set the position using 3 seperate floatsalListener3f(AL_POSITION, x,y,z);}void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz){//set the orientation using an array of floatsfloat vec[6];vec[0] = fx;vec[1] = fy;vec[2] = fz;vec[3] = ux;vec[4] = uy;vec[5] = uz;alListenerfv(AL_ORIENTATION, vec);}void Sound::LoadSound(char fname[40], bool looping){//load our soundALboolean loop;loop = looping;alutLoadWAVFile(fname,&alFormatBuffer, (void **) &alBuffer,(ALsizei *)&alBufferLen, &alFreqBuffer, &loop);alGenSources(1, &alSource);alGenBuffers(1, &alSampleSet);alBufferData(alSampleSet, alFormatBuffer, alBuffer, alBufferLen, alFreqBuffer);alSourcei(alSource, AL_BUFFER, alSampleSet);alutUnloadWAV(alFormatBuffer, alBuffer, alBufferLen, alFreqBuffer);//set the pitchalSourcef(alSource,AL_PITCH,1.0f);//set the gainalSourcef(alSource,AL_GAIN,1.0f);//set looping to truealSourcei(alSource,AL_LOOPING,AL_TRUE);//alutUnloadWAV(alFormatBuffer, alBuffer, alBufferLen, alFreqBuffer);}void Sound::SetProperties(float x, float y, float z, float vx, float vy, float vz){//set the sounds position and velocityalSource3f(alSource,AL_POSITION,x,y,z);alSource3f(alSource,AL_VELOCITY,vx,vy,vz);}//this function makes a sound source relative so all direction and velocity//parameters become relative to the source rather than the listener//useful for background music that you want to stay constant relative to the listener//no matter where they govoid Sound::SetSourceRelative(){alSourcei(alSource,AL_SOURCE_RELATIVE,AL_TRUE);}void Sound::PlaySound(){alSourcePlay(alSource);}void Sound::StopSound(){alSourceStop(alSource);}void Sound::DestroySound(){alDeleteSources(1,&alSource);alDeleteBuffers(1,&alSampleSet);}main.cpp/* *Credit for this game is owed to:  Jacob Reichman, Mike Maunu, Aaron Smorgon, www.gamedev.net forums,  *Stephen Luban, and video game directors everywhere.  *****Include in Credits**** */#include <windows.h>// Header File For Windows#include <iostream>#include <alut.h>#include <alc.h>#include "alsound.h"#include "FPshooter.h"extern void SetListenerPosition(float x, float y, float z);extern void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz);Sound sounds[5];int InitGL(GLvoid)// All Setup For OpenGL Goes Here{    glClearColor (0.35,0.5,0.0,0.0);glShadeModel(GL_SMOOTH);glEnable(GL_DEPTH_TEST);GLfloat matamb[]={1.0,1.0,1.0,0.0};    //Set the light...GLfloat matdif[]={.0,1.0,1.0,0.0};GLfloat ambLight[]={1.0,1.0,1.0,0.0};GLfloat diffLight[]={1.0,1.0,0.0,0.0};GLfloat light_position[]={0.0,10.0,2.0,0.0};//If i want to add more lights later i canglMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matamb);glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matdif);glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0);glLightfv(GL_LIGHT0, GL_POSITION, light_position);glLightfv(GL_LIGHT0, GL_AMBIENT, diffLight);glLightfv(GL_LIGHT0, GL_DIFFUSE, ambLight);glEnable(GL_LIGHTING);glEnable(GL_LIGHT0);glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);glEnable(GL_COLOR_MATERIAL);glEnable(GL_FOG);//All Fog//GLfloat fogColor[4] = {1.0,0.35,0.0,0.0};//GLfloat fogColor[4] = {0.25,0.3,0.0,0.0};GLfloat fogColor[4] = {0.5,0.2,0.2,0.0};glFogfv(GL_FOG_COLOR, fogColor);glFogf(GL_FOG_MODE, GL_EXP);glFogf(GL_FOG_DENSITY, 0.0015);return TRUE;// Initialization Went OK}int DrawGLScene(GLvoid)// Here's Where We Do All The Drawing{glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );....//set listener propertiesSetListenerPosition(player1->getX(),player1->getY(),player1->getZ() );//set listener orientation, first 3 numbers are for the forward vector, last three are for the up vectorSetListenerOrientation(player1->getX() + cos(view_angle)*cos(sight),    player1->getY() + sin(sight),   player1->getZ() + sin(view_angle)*cos(sight),   -sin(sight)*cos(view_angle),   cos(sight),   -sin(sight)*sin(view_angle));sounds[0].PlaySound();gluLookAt(player1->getX(),  //camera player1->getY(), player1->getZ(), player1->getX() + cos(view_angle)*cos(sight), player1->getY() + sin(sight), player1->getZ() + sin(view_angle)*cos(sight), -sin(sight)*cos(view_angle), cos(sight), -sin(sight)*sin(view_angle));   //camera....return TRUE;// Everything Went OK}GLvoid KillGLWindow(GLvoid)// Properly Kill The Window{...}/*This Code Creates the OpenGL Window.  Parameters Are:* *title- Title To Appear At The Top Of The Window* *width- Width Of The GL Window Or Fullscreen Mode* *height- Height Of The GL Window Or Fullscreen Mode* *bits- Number Of Bits To Use For Color (8/16/24/32)* *fullscreenflag- Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE)*/ BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag){....}int WINAPI WinMain(HINSTANCEhInstance,// InstanceHINSTANCEhPrevInstance,// Previous InstanceLPSTRlpCmdLine,// Command Line ParametersintnCmdShow)// Window Show State{MSGmsg;// Windows Message StructureBOOLdone=FALSE;ALCcontext *Context;ALCdevice *Device;FILE *fp;....//Open deviceDevice = alcOpenDevice((ALCchar*)"DirectSound3D");if (Device == NULL){//we failed to initialize the deviceexit(-1);}//Create context(s)Context=alcCreateContext(Device,NULL);//Set active contextalcMakeContextCurrent(Context);// Clear Error CodealGetError();//load up our water soundsounds[0].LoadSound("Brain.wav",1);//set the position of the sound effectsounds[0].SetProperties(0.0f,2.0f,0.0f,0.0f,0.0f,0.0f);sounds[0].PlaySound();//set the initial listener positionSetListenerPosition(player1->getX(),player1->getY(),player1->getZ() );....//The following only occurs if the user has exited the program.//destroy our soundsounds[0].DestroySound();// Shutdown//Get active contextContext=alcGetCurrentContext();//Get device for active contextDevice=alcGetContextsDevice(Context);//Disable contextalcMakeContextCurrent(NULL);//Release context(s)alcDestroyContext(Context);//Close devicealcCloseDevice(Device);// ShutdownKillGLWindow();// Kill The Windowreturn (msg.wParam);// Exit The Program}So whats the problem? That should work perfectly according to the tutorial in my first post. Keep in mind that this code is compiling and running fine, just a sound isn't playing.   