Advertisement

Need help with OpenAL and Visual Studio 2003 PE

Started by February 01, 2005 03:15 PM
2 comments, last by Drew_Benton 19 years, 7 months ago
Hi, I'm quite new to this forum, so i start by saying hello to everyone :-) I searched this forum and several other sites for my problem, but didn't find anything. So I try to ask you. The problem is the following: I use OpenAL together with OpenGL to do a little game in C++. I use Microsoft Visual Studio 2003 PE. A few days ago, I started to go through some OpenAL-Tutorial and was suprised, how easy it is to use (I don't have any expierence with other sound-librabries, though). The tutorial i refer to is: http://www.gamedev.net/reference/articles/article1958.asp The sourcecode with a project file for Visual C++ 6.0 (.dsw) to the tutorial is also available from there. I downloaded the source an could compile it. It runs fine, everything works. Now i tried to set up my own project in VS 2003 (console, started with empty project, added a main.cpp with main()-function). It was no problem to load a sound, to link it to a source an to play it. The only thing, that doesn't work, is attenuation by distance. The source and the listener can be as far away from each other as possible, the sound always plays at the same Volume. I tried to use alDistanceModel ( AL_INVERSE_DISTANCE ), but there was no effect. So I tried to copy the whole code from the above tutorial into my project. The same effect occured, the distance had no effect again. The same code worked fine in the project that was delivered together with the source code. I also tried another tutorial at devmaster.net with the same effect (works fine with the delivered project, but not in my own project): http://www.devmaster.net/articles/openal-tutorials/lesson2.php So here are my questions: Does anyone have an idea, what could be wrong? Do I need to change some properties of my project in VS2003 so that it works? Thank You very much in advance! Greetings from Stuttgart, Kay'l P.S.: My English is not the best, I know :-)
Hello to you too! Ok here's a shot. First off what is Microsoft Visual Studio 2003 PE? What does the PE stand for, I googled but couldn't find it.

As for what's wrong there's two possibilities:

1. If you are using their 'exact' code pretty, and it compiles but does not work, check the sound file you are using - in particulary, are you using the one they used? I just had a 4 hour frustration fest last night because I had a similar problem with sounds that would not work when I changes the distance. After trying everything and rewrting tons of code, it finally hit me that I was not using the right file format. You must use a 16 bit mono channel file to get the distance functions working I believe. I was using my own, which was a stereo channel instead. I am 99% sure that should solve the problem if you are using their code and it compiles fine but their examples do not work in your own project - assuming you are not using their files to begin with.

2. If you are not using their code, I'd suggest doing a side by side compare. Even the smallest differences have a big impact, in particulary the order in which things are called.

Hope this helps a bit. If neither work, you can post your code and I'll take a look at it. OpenAL can be very very [evil]!

- Drew

PS if you are not sure how to post your code in a formatted code box (ie don't just paste it in), look at the middle of the FAQ to see how to do C++ code.
Advertisement
Hi Drew,

wow thanks for the fast answer!

PE stands for Professional Editiion. I have to admit I was a bit too lazy to type it in the first post :o)

You were right, the reason it didn't work was that I used a stereo sound file. I tried to use a different sound file and now it works fine :-)

So again thank You very much, You really helped me from going mad!

Greetings,

Kay'l

No problem! Yea that one little detail about the sound format killed me! I still can't believe that wasn't the first thing I thought of before spending time debugging my code. Oh well, I'm glad it's helped someone else out [smile]. Good luck with your programming.

- Drew

This topic is closed to new replies.

Advertisement