|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Programming 3D Sound With OpenAL in Windows |
|
![]() atcdevil Member since: 2/12/2001 From: NJ |
||||
|
|
||||
| Nice article. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Unfortunately it perpetuates the common mistake of creating a source for every sound file loaded. This is not a good idea for a couple of reasons: 1) In a game, multiple sources may need to play the same sound (buffer). For example multiple players firing the same weapon. 2) The number of sources is limited by OpenAL implementation or the hardware, generally to around 32. Most games have more sound effects than this (even though they aren't all playing at once). |
||||
|
||||
![]() wenching Member since: 1/4/2003 |
||||
|
|
||||
| Hi. Just wonder can i use openal with a Directx 8.1 engine? Or openal is only meant for opengl? Regards, Chua Wen Ching |
||||
|
||||
![]() cardinals33 Member since: 11/11/2001 From: United States |
||||
|
|
||||
| OpenAL can easily be used with DirectX 8.1. My demo application that I included with the article uses directinput. OpenAL has no relation to OpenGL. As far as multiple sources, this article was just meant to demonstrate how to load a sound into a source to get basic functionality of OpenAL. The methods used here aren't neccessarily going to be used in large projects or games. |
||||
|
||||
![]() Promit Moderator - Graphics Programming and Theory Member since: 7/29/2001 From: Baltimore, MD, United States |
||||
|
|
||||
| Does "DirectSound3D" have anything to do with DX, or is it just the name of one of the devices? |
||||
|
||||
![]() cardinals33 Member since: 11/11/2001 From: United States |
||||
|
|
||||
| DirectSound3D is a component of DirectX just like DirectSound, DirectInput, Direct3D and all of them. Microsoft has basically put DirectSound and DirectSound3D into one api but you still specify DirectSound3D seperately when setting up OpenAL. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Is it my impression or it leaves no answer to the question "when to init openAL?" I tried to init it after creating the window and it didn't work so I tried to init it **before** creating the window and it didn't work. Then, I got upset and switched to DirectSound. Then, I get the rid of DS by using FMOD. When to init the AL? |
||||
|
||||
![]() cardinals33 Member since: 11/11/2001 From: United States |
||||
|
|
||||
| How do you know that the initialization did not work? If it didnt maybe you have the wrong files from the OpenAL SDK? When you initialize it does not matter as long as you do it before oyu play any sounds or set up the listener. In the demo I provided, I initialize it after I create the window. |
||||
|
||||
![]() Promit Moderator - Graphics Programming and Theory Member since: 7/29/2001 From: Baltimore, MD, United States |
||||
|
|
||||
| Ok is there a way I can init OpenAL in a totally platform independent way? (i.e. not bound to DX) |
||||
|
||||
![]() cardinals33 Member since: 11/11/2001 From: United States |
||||
|
|
||||
| I have only worked with the Windows SDK as I have yet to find the Linux one but I would kind of doubt there is one solid way that would work on both systems. I'm not sure any program that uses APIs could ever be expected to compile and run fully on two OSes without making a single change to the code. There is actually a function called alutInit() that should come with the SDK which will Initialize OpenAL in Windows. The code for this function in Windows though looks exactly like the way I have it specifying DirectSound3D. This same function or a similarly named one probably exists in the Linux version of OpenAL. Simply calling that should save you the trouble of worrying about how to set it up so it may be possible that there is one way for all systems if they use the same name. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| I guess the OpenAL operations are launched on the CPU ? And maybe they will be sent to next gen soundcards processors ? Is there any case where GPU is involved ? Thanks, Guillaume |
||||
|
||||
![]() rozy_programmer Member since: 12/31/2006 From: cairo |
||||
|
|
||||
| Hi , I'm new to openal and I'm trying to use it however I'm facing an error in code of the hello world example 1) I downloaded the openAl sdk and from www.openal.org and 2) installed it 3) I have added the path of the lib directory (containing alut.lib) to the library files in vc++ 4) I have added the path of the include directory(containing alut.h ,al.h and alc.h) to the include files in vc++ When trying to compile this code: #include "stdafx.h" #include <stdlib.h> #include <al.h> #include <alut.h> int main(int argc, char** argv) { ALuint helloBuffer; ALuint helloSource; alutInit (&argc, argv); helloBuffer = alutCreateBufferHelloWorld(); alGenSources (1, &helloSource); alSourcei (helloSource, AL_BUFFER, helloBuffer); alSourcePlay (helloSource); alutSleep (1); alutExit (); return EXIT_SUCCESS; } The following errors occured: Compiling... openal.cpp Linking... openal.obj : error LNK2019: unresolved external symbol __imp__alutExit referenced in function _main openal.obj : error LNK2019: unresolved external symbol __imp__alutSleep referenced in function _main openal.obj : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function _main openal.obj : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function _main openal.obj : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function _main openal.obj : error LNK2019: unresolved external symbol __imp__alutCreateBufferHelloWorld referenced in function _main openal.obj : error LNK2019: unresolved external symbol __imp__alutInit referenced in function _main C:\Documents and Settings\Abousafy\My Documents\Visual Studio 2005\Projects\openal\Debug\openal.exe : fatal error LNK1120: 7 unresolved externals so any ideas , I really need to use it in a graphics project Thanks |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Don't double post. I answered this in your other thread. Thanks. |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|