使用alut播放声音问题

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 device
	Device = 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 context
	alcMakeContextCurrent(Context);

	// Clear Error Code
	alGetError();
我也遇到了同样的问题,在自己的机器上播放声音正常,但是在别人的机器上就不行。跟踪发现是alutInit初始化失败了,
失败原因是不能打开 ALC设备,错误代码是ALUT_ERROR_OPEN_DEVICE,后来我卸载了OpenAl SDK,结果我这里也不能正常、
播放声音了,返回的错误代码也相同,我观察了一下播放进程所加载的dll,有个dll叫做wrap_oal.dll,这个dll也正是
安装OpenAL SDK时拷贝到System32目录下的,于是我把这个dll同可执行文件一起打包,这样在其他机器上工作就正常了。

你可能感兴趣的:(使用alut播放声音问题)