Very odd OpenAL problem

This topic is 4204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I was very happy to get OpenAL working and installed on my computer. I read the documentation and got some code to work on my computer. Now, in my game I have a bunch of sound/music in my game. But for SOME REASON, it will only play on my computer. I'm sure that I have the sound files all in the write places. Its a very weird problem and I would really appreciate it if someone could help me out. If you have EVER gotten a program to play sound using OpenAL on multiple computers, PLEASE contact me: email: bballmitch2@sbcglobal.net AIM: gamer12121 MSN: lubanfamily@sbcglobal.net

Share on other sites
Come on...please. I finished every aspect of my game, the only problem is that sound won't plat on OTHER people's computers. Will someone who is experience with OpenAL PLEASE contact me?

Share on other sites
I have gotten AL working on multiple machines, although I didn't have any troubles like you are describing. I used alut though (I'd like to rewrite that actually), and wouldn't call myself an expert. Anyway, could you give more detail? In your code are you checking for errors (init fails, load fails, etc)? Are you sure the other machine has a working soundcard and has the volume turned up? It seems dumb, but that's a good place to start... Give us more detail, and perhaps show us some of your sound init, loading, and play back code.

Share on other sites
ok

int drawGLScene(GLvoid){...	//set listener properties	SetListenerPosition(player1->getX(),player1->getY(),player1->getZ() );	//set listener orientation, first 3 numbers are for the forward vector, last three are for the up vector	SetListenerOrientation(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));...}int WINAPI WinMain(	HINSTANCE	hInstance,			// Instance					HINSTANCE	hPrevInstance,		// Previous Instance					LPSTR		lpCmdLine,			// Command Line Parameters					int			nCmdShow)			// Window Show State{...	ALCcontext *Context;	ALCdevice *Device;	//Open device	Device = alcOpenDevice((ALCchar*)"MMSYSTEM");	//Device = alcOpenDevice(NULL);	//Create context(s)	Context=alcCreateContext(Device,0);	//Set active context	alcMakeContextCurrent(Context);	// Clear Error Code	alGetError();	//load up our background music	background.LoadSound("Data/Menu.wav",1);	//set the position of the sound effect	background.SetSourceRelative();	background.SetProperties(0.0f,0.0f,0.0f,0.0f,0.0f,0.0f);	background.PlaySound();	SetListenerPosition(player1->getX(),player1->getY(),player1->getZ() );...//if the user quits out of the program// Shutdown	//Get active context	Context=alcGetCurrentContext();	//Get device for active context	Device=alcGetContextsDevice(Context);	//Disable context	alcMakeContextCurrent(NULL);	//Release context(s)	alcDestroyContext(Context);	//Close device	alcCloseDevice(Device);...}

my LoadSound function looks like this:
void Sound::LoadSound(char fname[40], bool looping){	//load our sound	ALboolean 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 pitch	alSourcef(alSource,AL_PITCH,1.0f);	//set the gain	alSourcef(alSource,AL_GAIN,1.0f);	//set looping to true	alSourcei(alSource,AL_LOOPING,AL_TRUE);	Volume = 1.0;	//alutUnloadWAV(alFormatBuffer, alBuffer, alBufferLen, alFreqBuffer);}

Keep in mind two things:

1. All things in relation to sound work PERFECTLY on my computer (just on no one else's)
2. The sound file that I load is relative to the executable, so there shouldn't be any problem on other people's computers finding that file.

Does that help?

Share on other sites
I would agree to what Mr. Grinch suggested. Make sure you check for errors starting with the obvious stuff such as whether the file has really loaded. Besides the lack of error-checking your code looks fine. Good Luck.

In this code snippet, I check for errors after every OpenAL call
//Should be called after every ALfunction - return false on errorbool isALOK(const char* nameoffunc2chk){   	ALint	error;   	if ((error = alGetError()) != AL_NO_ERROR)      {      	DisplayALError(nameoffunc2chk,error);      return false;      }   return true;	//NO ERROR}bool sr_audio::InitSoundSystem(Uint32 flags){	ALCcontext *Context=NULL;	ALCdevice *Device=NULL;   //Opens a device    Device=alcOpenDevice("MMSYSTEM");   //Device=alcOpenDevice("DirectSound3D");//   if(NULL == Device)return false;   //Creates a context using a specified device.   Context=alcCreateContext(Device,NULL);   if(NULL == Context){alcCloseDevice(Device);return false;}   //Makes a specified context the current context.   alcMakeContextCurrent(Context);   //   alGetError(); // Clear Error Code   ALfloat listenerPos[]={0.0,0.0,0.0};   ALfloat listenerVel[]={0.0,0.0,0.0};   ALfloat listenerOri[]={0.0,0.0,-1.0, 0.0,1.0,0.0};	// Listener facing into the screen	// Position ...	alListenerfv(AL_POSITION,listenerPos);	isALOK("sr_audio::InitSoundSystem()-alListenerfv(POS)");	// Velocity ...	alListenerfv(AL_VELOCITY,listenerVel);	isALOK("sr_audio::InitSoundSystem()-alListenerfv(VEL)");	// Orientation ...	alListenerfv(AL_ORIENTATION,listenerOri);        isALOK("sr_audio::InitSoundSystem()-alListenerfv(ORI)");}

Share on other sites
well, i tested for those errors on my computer and im not getting any errors. But you're not realizing the MOST important part of this problem...it works 100% on my computer. It has something to do with when the program is moved to other people's computers. The things that i know FOR SURE are that the files are where they are supposed to be, and all the .dll files are where they are supposed to be.

I am relativly certain, however, that the problem lies with the Device. On a friedn of mine's computer, when i tested if the device was null (and if it was the program would quit) as soon as he opened my program, it closed.

The weird thing, though, is that I tried multiple Devices; NULL, MMSYSTEM, DirectSound3D...none of them worked. anymore ideas?

Share on other sites
Quote:
 Original post by bballmitchwell, i tested for those errors on my computer and im not getting any errors. But you're not realizing the MOST important part of this problem...it works 100% on my computer. It has something to do with when the program is moved to other people's computers. The things that i know FOR SURE are that the files are where they are supposed to be, and all the .dll files are where they are supposed to be. I am relativly certain, however, that the problem lies with the Device. On a friedn of mine's computer, when i tested if the device was null (and if it was the program would quit) as soon as he opened my program, it closed. The weird thing, though, is that I tried multiple Devices; NULL, MMSYSTEM, DirectSound3D...none of them worked. anymore ideas?

That's why you should check to see what goes wrong on other computers. There is a relatively small amount of things that can be happening. Either it can't fiind the files, openAL is missing/messed up, or the other computers can't support what you want to do. Does it have anything to do with release or debug builds?

Share on other sites
I tried checking for errors on someone else's computer (one that won't play sound) and there are no errors (at least according to alGetError() ).

I am compiling my project in release mode. Could that have something to do with the problem?

Share on other sites

Did you try the SDK samples on the other computer ?

They should provide the base line for making a working OpenAL program.

I have made an OpenAL program working on several computers.

Sometimes it happens that one thing works on one computer but not on another computer.

There are issues such as the maximum amount of sources. It isn't safe to assume any number of available sources. I don't know if it is your case, but it might cause head ache too :)

Best regards

Share on other sites
Maybe it has something to do with drivers?

I vagely remember there might small differences between driver
implementation, such as certain drivers returning '0' as an id
for the first soundsource, others returning 1... So any 0-check
would be bad (rather check return-codes).

Again, I might be wrong here...

Share on other sites
well, i've ruled out that it could be a problem with the file locations. I ruled out that OpenAL is "missing something" (b/c on every computer i put the program on, OpenAL says that there are no errors)....

I'm telling you the error is in:
Device = alcOpenDevice( (ALCchar*)"MMSYSTEM" );

I've tried SOOOO many things in there. On every computer BUT my own, that funciton is returning NULL. why is that happening?

edit: oh, and the problem can't be the index (or the amount of sources) b/c i have exactly 3 sources. and yes, every computer that i'm putting it on does have a working sound card.

Share on other sites
not an expert in openAL but...

seems to me that the string you're passing is wrong or only valid on your machine. quick googling found this thread that seems related; towards the end is what looks like much more robust code for opening devices:

http://www.devmaster.net/forums/archive/index.php/t-1256.html

-me

Share on other sites
Call alcGetError(Device) after alcOpenDevice() even if Device is NULL. This should get you a more specific error.

You could post a exe that tests you sound system and we could test it.

If you like,download the source code and check out alc_device.c ,alc_backend.c and alc_backend_windows.c and investigate possible failure points.

But hopefully the solution will be easier than digging through source:)

Share on other sites
Ok...with your guys help, i have determined that in the following line:

Device = alcOpenDevice(NULL);

It causes alcGetError(Device) to give out an AL_INVALID_DEVICE error (it also will return an AL_INVALID_NAME error). But why would it do that? I was told to always put NULL as a parameter in that function...anyway, when I put things like (ALCchar*)"DirectSound3D" as a parameter, that also causes AL_INVALID_ERROR. What could be causing this and how do I solve it?

Share on other sites
come on...i narrowed down the problem; i know im getting an ALC_INVALID_DEVICE error. Can anyone tell me why? How do I solve this? Isn't the line supposed to look like:

Device = alcOpenDevice(NULL);

Help please. I would really like to finish up my game.

Share on other sites
What...so when i narrow down the problem no one can help me? I know someone here has had this problem. Will someone please help me?

Share on other sites
1) What compiler are you using?

2) Do any of the SDK sample programs and other programs that use OpenAL work on their computer?

3) How many other computers have you tested your code on?

4) Have you tried a minimal program containing only enough code to play a sound using OpenAL? This would rule out any interference from other parts of your code causing problem on other computers.

5) Are the other computers's OpenAL version current?

6) Try this program.

[Edited by - Jack Sotac on June 15, 2006 12:45:03 AM]

Share on other sites
http://www.openal.org/documentation.html

Share on other sites
Quote:
 Original post by Jack Sotac1) What compiler are you using?2) Do any of the SDK sample programs and other programs that use OpenAL work on their computer?3) How many other computers have you tested your code on?4) Have you tried a minimal program containing only enough code to play a sound using OpenAL? This would rule out any interference from other parts of your code causing problem on other computers.5) Are the other computers's OpenAL version current?6) Try this program.

1. VS 2005 Express
2. I ran two sample programs from the OpenAL SDK (the two that I tried) and they both worked perfectly
3. I tested my code on 5 other computers (all with sound cards)
4. Yes, I tried this...its not working :( ....
5. I don't install OpenALon the other computers; i send over the dll files (oh, and the sound won't work on my computer any more either...I have NO IDEA why)
6. That program works on my computer (and two of the other computers that I try to get my program to work on)

Hope this helps give you a better idea of what my problem is. :)

Oh, and Anonymous...please don't insult my intelligence; you don't think I've looked through all the OpenAL documentation I can find?

Share on other sites
Whoops, forget to put the text between brackets. The openAL test program .
Source for the test program

Have you check for viruses and spyware? Sometimes they corrupt .dll files.

Make sure OpenAL is properly installed on their computers by having them run the
OpenAL Installer for Windows. This may be the problem.

Don't forget the openal mailing list.

Other then that, try a clean OALSDK install,try a different compiler or compiler settings, rebuild of all source?

Sorry but I have never had a problem like yours so I can't help much. As a last resort you can switch sound library to BASS(un4seen.com) or FMOD(fmod.org/) or sdl_mixer(http://www.libsdl.org/projects/SDL_mixer/) to see if those works.

Good Luck.

[Edited by - Jack Sotac on June 15, 2006 1:55:57 PM]

Share on other sites

This topic is 4204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Create an account

Register a new account

• Forum Statistics

• Total Topics
628769
• Total Posts
2984592

• 13
• 10
• 25
• 12
• 9