   OpenAL sound devices
  Will someone please tell me how to change the following code so that it will work on the majority of computers? For some reason, that code works 100% like its supposed to on my computer, but it hasn't worked on anyone elses computer. I THINK it has something to do with alcOpenDevice(), but I can't figure it out. All the lines that I have tried below have worked 100% on my computer, but for some reason, none of them work on anyone elses. PLEASE help. Its very important! Thanks.ALCcontext *Context;ALCdevice *Device;//Open deviceDevice = alcOpenDevice((ALCchar*)"MMSYSTEM");//Device = alcOpenDevice(NULL); ... didn't work either//Device=alcCreateContext( (ALchar*) "DirectSound3D"); ...also didn't work//Create context(s)Context=alcCreateContext(Device,NULL);//Set active contextalcMakeContextCurrent(Context);// Clear Error CodealGetError();
  At what point does it not work?  Are you sure that these other computers have OpenAL installed on them, or are the DLLs packaged with the execuable?   ;  Here's my code for initializing the best device available. This code may still have some bugs in it but hey it worked for me - so here it goes: ALCint highest_version = 0; // Highest version number found   const ALCchar * best_device = NULL; // Name of the 'best' device   // Find the highest-version device available   const ALCchar * device_name = alcGetString(NULL, ALC_DEVICE_SPECIFIER); // Get list of all devices (terminated with two '0')   while (*device_name != NULL) // Loop until two terminating zeroes has been read   { ALCint major_v=0, minor_v=0; ALCdevice * _temp_device = alcOpenDevice(device_name); // Open a temporary device for reading in its version number if (_temp_device == NULL) // Just keep looping if we couldn't open the device {    cerr << "AUDIO: Couldn't open a temporary device: " <<  device_name << endl;    device_name += strlen(device_name) + 1;    continue; } ALCcontext * temp_context = alcCreateContext(_temp_device, NULL); // Create a temporary context if (temp_context == NULL) // Keep looping again if no context was created {    cerr << "AUDIO: Couldn't create a temporary context for device: " <<  device_name << endl;    alcCloseDevice(_temp_device);    device_name += strlen(device_name) + 1;    continue; } alcMakeContextCurrent(temp_context); alGetError(); alcGetIntegerv(_temp_device, ALC_MAJOR_VERSION, sizeof(ALCint), &major_v); // Get the version number alcGetIntegerv(_temp_device, ALC_MINOR_VERSION, sizeof(ALCint), &minor_v); alcMakeContextCurrent(NULL); // Disable the temporary context alcDestroyContext(temp_context); // Destroy the temporary context alcCloseDevice(_temp_device); // Close the temporary device if (highest_version < (major_v * 10 + minor_v)) // Check if we found a higher version {    highest_version = (major_v * 10 + minor_v);    best_device = device_name; } device_name += strlen(device_name) + 1; // Go to the next device name in the list   }   // Open the 'best' device we found above   _device = alcOpenDevice(best_device);   if (_device == NULL) { cerr << "AUDIO ERROR: Failed to initialize OpenAL and open a default device." << endl; return false;   }   ALCcontext * context = alcCreateContext(best_device, NULL);   alcMakeContextCurrent(context);   alGetError();I'd still suggest to check hh10k's advice   ;Quote:Original post by hh10kAt what point does it not work?  Are you sure that these other computers have OpenAL installed on them, or are the DLLs packaged with the execuable?The DLLs are packaged with the executable. In addition, on one computer I installed OpenAL and i packaged the executable and it still didnt work. :(I'm not 100% sure its the device, but I can't think of what other thing would make it so that it would work on my computer, but on no one elses. ;  The code i originally posted and the code above still don't work. Could i get some help?   