![]() |
| [[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]] |
|
|
#1 |
|
New Member
Join Date: May 2005
Posts: 3
|
Hello there, new here :)
I have begun to work with OpenAL as part of my game to get some sounds (and later music) going. Though, when I first compiled my game (no errors or warnings) and ran it, there was no sound to be heard. I quad-checked everything, and it was in order. I then downloaded one of the samples from this site (great site btw!), and it ran just fine. I could even modify it. But... if I use the very same .CPP file from the sample in my own project file (linking to OpenAL32.lib and alut.lib), I get the same problem as above, there is no sound to be heard. I am checking if the file I am attempting to load is existant and the path is correct, so that is not the problem. Have I managed to miss something important in the project settings?? |
|
|
|
|
|
#2 |
|
New Member
Join Date: May 2005
Posts: 3
|
I'll post the parts of the code where I have put the OpenAL stuff, though it is pretty intact from the tutorial, and I have compared the code a million times (and it does not really lie there since the very same file works perfectly with the original project file (.DSW/.DSP).
Code:
The program uses GLUT to draw a window and OpenGL to draw primitives (it's just my simulator thingy where I test mathematical stuff). That should work, right? I have included OpenAL32.lib and alut.lib in the Linker. And the phaser.wav file is in the correct location. Have I missed something? |
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2005
Posts: 3
|
Okey.. I managed to find out what was causing these anomalies.
It seems that the OpenAL32.dll that comes with the OpenAL SDK is errorful. When I use that one, I get no sounds, but programs can be quit without problems. If I use the one I already had (no idea where it came from, but probably either with Windows, the soundcard or some driver), I get sounds but an error whenever I close any program using OpenAL. Has anyone else experienced a similar problem? |
|
|
|
|
|
#4 |
|
New Member
Join Date: Oct 2005
Location: FL
Posts: 3
|
Hey Eldritch, I am experiencing the same problem. I have gone over my code many times and it looks right. I am using the most recent SDK from the Creative web sight.
When I run the example binary it plays sounds, if I build it from the source code... I get no errors but also no sound. Can you send me the lib file that works for you, so I can try it? |
|
|
|
|
|
#5 |
|
New Member
Join Date: Nov 2005
Location: Singapore
Posts: 2
|
I think your code'd work fine in OpenAL1.0 but now you are using the new release 1.1, right?
I had the same problem afer updating the library. It looks the problem is in the alutInit function which doesn't seem to work properly anymore. You have to initialize the device and context directly, for example, like this: >>>>>>>>>>>>>>>>> ALCcontext *Context; ALCdevice *Device; Device = alcOpenDevice((ALchar*)"DirectSound3D"); if (Device == NULL) { exit(-1); } //Create context(s) Context=alcCreateContext(Device,NULL); //Set active context alcMakeContextCurrent(Context); alGetError(); <<<<<<<<<<<<<<<<<< we'd also note that the alutLoadWavfile function is now deprecated (but still works fine in current version). Hope this helps. cheers, Roberto |
|
|
|
|
|
#6 | |
|
Valued Member
Join Date: Jan 2004
Location: England
Posts: 265
|
Quote:
ALut now comes in its own dll/lib (don't know which as I do not actually use it, I load all the sound data myself), so alutLoadWav is probably in there, rather than actually being depreciated. Spree |
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Nov 2005
Location: Singapore
Posts: 2
|
Hello,
I am not sure what you mean by "depreciated".... actually, the ALUT specification published on the official OpenAL site (http://www.openal.org/openal_webstf/specs/alut.html) clearly states that AlutLoadWavFile, ALutLoadWavMemory and AlutUnloadWav are now deprecated but still available for backward compatibility. Interestingly, the same document doesn't say anything particular about the AlutInit function which was the one causing the problem here reported (at least on my machine). All best! Roberto |
|
|
|
|
|
#8 |
|
Valued Member
Join Date: Jan 2004
Location: England
Posts: 265
|
As I said, I do not use alut, so I am not an authority here. But as I said, AlutLoadWavFile has been moved to the alut library, and whilst it looks like ti has been 'officially' depreciated, is still available.
Reading the OpenAL developers mailing list doesn't really make this clear though, as there seems to be a lot of too'ing and fro'ing about it. But it looks like it has been replaced with alutCreateBufferFromFile (and the various variations that come with it), which seems to work in a similar way. Spree |
|
|
|
|
|
#9 |
|
New Member
Join Date: Jan 2006
Posts: 1
|
I'm having the same 1.1 SDK problem. I'm pretty new to programming in general and completly new to OpenAL. Copy pasting rdillions code doesn't seem to solve the problem (although I'm probably doing something wrong), could someone quickly explain how to get the code in the first OpenAL tutorial on this site to work with the 1.1 release? Thanks.
|
|
|
|
|
|
#10 |
|
New Member
Join Date: Oct 2005
Posts: 27
|
Code:
I just use: Code:
and it does the trick for me using the new 1.1 lib. I seem to remember not getting any love from the DirectSound3D flag. Also, the SDK documentation just recommended initializing this way as well IIRC..
___________________________________________
Wazoo Game Programming in C++: Start to Finish | Game Tutorials |
|
|
|
|
|
#11 |
|
New Member
Join Date: Feb 2006
Posts: 3
|
i cant get OpenAL to play a sound on my creative card.
Plays on the onboard nvidia sound, but my Audigy won't play sounds. OpenAL initialises, inits buffers, sources, plays the source, i get no sound, and no error. I dont know if its a driver issue, or just openal being crap. Driving me insaine. |
|
|
|
|
|
#12 |
|
DevMaster Staff
Join Date: Oct 2004
Location: Seattle, WA
Posts: 3,707
|
Zeussy, have you tried making sure the volume is turned up? (I don't just mean the volume in your speakers, but the OpenAL volume control. You never know, it might default to zero or something dumb like that.)
___________________________________________
Currently working at Sucker Punch reedbeta.com - OpenGL demos and other projects Luabridge - a lightweight, dependency-free C++/Lua binding library. CD Lite - an unobtrusive, minimal CD player application for Windows. |
|
|
|
|
|
#13 |
|
New Member
Join Date: Feb 2006
Posts: 3
|
thanks Reedbeta, listener gain was set to 1, upped it to like 1000.f as well as the 1000 gain on the source, makes it audible.
was almost going to convert my sound handling class to fmod |
|
|
|
|
|
#14 |
|
New Member
Join Date: Mar 2007
Location: Argentina
Posts: 10
|
"FILE *fp = fopen("wavdata/phaser.wav", "r");
if (!fp) MessageBox(NULL, "Error loading sound!", "Error", MB_OK); else fclose(fp);" REMOVE THIS, FIRST LOAD THE WAV, THEN USE FOPEN .... |
|
|
|
|
|
#15 |
|
DevMaster Staff
Join Date: Oct 2004
Location: Seattle, WA
Posts: 3,707
|
L1zb3th, that is just a check that the file exists before passing it to ALUT.
___________________________________________
Currently working at Sucker Punch reedbeta.com - OpenGL demos and other projects Luabridge - a lightweight, dependency-free C++/Lua binding library. CD Lite - an unobtrusive, minimal CD player application for Windows. |
|
|
|
|
|
#16 |
|
New Member
Join Date: Mar 2007
Location: Argentina
Posts: 10
|
ahh , i didnt read well xDDDDDDDD
-.-'' |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|