Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I make DirectX9 strategic game with left-hand coordinate system. XZ is floor, +Y is up, camera's direction (0,-1,0). I use 3 different variants of irrKlang engine in 3 different tests of the same game (1st variant for 1st test, etc) -- Variant1 ---- createIrrKlangDevice (ESOD_AUTO_DETECT, ESEO_MULTI_THREADED | ESEO_USE_3D_BUFFERS);} // DirectSound8 Variant2 ---- createIrrKlangDevice (ESOD_AUTO_DETECT, ESEO_MULTI_THREADED | ESEO_LINEAR_ROLLOFF);} // DirectSound8 Variant3 ---- createIrrKlangDevice (ESOD_WIN_MM, ESEO_MULTI_THREADED | ESEO_LINEAR_ROLLOFF);} 1) Issue. For correct sound I should have different Listener's parameters for different Variants -- Variant1 ---- setListenerPosition (vec3df(x,y,z), dir, vel, vec3df(0,1,0)); Variant2 ---- setListenerPosition (vec3df(-1 * x,y,z), dir, vel, vec3df(0,0,1)); //different Position and UpVector !!! Variant3 ---- setListenerPosition (vec3df(-1 * x,y,z), dir, vel, vec3df(0,0,1)); //different Position and UpVector !!! This is the same left-hand DirectX9 game, so why do Variant2+Variant3 need different Position and UpVector ? 2) Issue. Only in Variant3 !!!!!!!!!!!!!!!!!! In many ways I set max distance 1000 for sounds. But in all cases I see a strange behavior -- Distance 0 ---- I hear max volume of sound Distance 500 ---- volume become quiet (subside) Distance 1000 ---- volume == 0 Distance 1500 ---- volume become louder !!!!!!!!!!!!! Distance 2000 ---- max volume !!!!!!!!!!! Distance 3500 ---- sound with hoarseness, cracking !!!!!!!!!!! This is very, very, very bad. I can not use Variant3 (WinMM + ESEO_LINEAR_ROLLOFF) in my game, because ALL units in game give audible sound on distance >1000. Please, Nikolaus, can you cure this? 3) As I understand it, using ESEO_USE_3D_BUFFERS for WinMM has no sense, because WinMM will use only soft buffers in all cases. Yes? 4) What Variant2 [DirectSound8 WITHOUT hardware 3D-buffers] means? I can not understand its relationship with WinMM. 4.1) ---- Can it work with GREAT number of ISounds and buffers (because they are soft), as WinMM can? 4.2) ---- It makes its own calculations of sound volume regardless of winmm.dll, or it depends on the WinMM's driver ? |
||||
|
Woha, that are many questions. 1) First, if you are using a left hand coordinate system, which irrKlang is using as well by default, I'm not sure why you need to use Variant2 and 3 at all, it seems to work nicely for most apps and games so far, without this. I'm a bit confused now. 2) Hm, strange. Seems to be a bug, maybe. Maybe it's also because of the unnecessary changed up vector. I would have to take a deeper look into this for that. 3) Yes 4) DirectSound has a feature named 3D audio buffers for playing sounds correctly in 3D space. Basically you play a sound and tell it its position in space, DirectSound does the rest then. If this feature is not used, irrKlang will use a 2D buffer instead and adjust its volume manually to fit the 3d position. That feature doesn't have to do anything with WinMM, so it is ignored when using WinMM. 4.1) Depends on the audio driver. But in most cases, it should. 4.2) No, WinMM is just a plain stupid audio output device, irrKlang then does all the calculations itself. |
||||
|
1 issue) I use Variant2 and Variant3 because they use ESEO_LINEAR_ROLLOFF, which is better than standard rolloff. But in ESEO_LINEAR_ROLLOFF something (orientation) is not working properly. Now read pseudocode carefully, take a pencil and draw : Camera in every position looks from sky to the ground (at direction (0;-1;0)) vertically, because this is strategic game. . . . // set camera at (0;75;0)All works well. ---- camera goes left (-200; 75; 0) --> I hear the sound from the right speaker ---- camera goes right (200; 75; 0) --> I hear the sound from the left speaker But when in this code I use ESEO_LINEAR_ROLLOFF (i.e. Variant2 or Variant3), all works BAD -- orientation is not working properly. See this : ---- camera goes ahead (0; 75; 200) --> I hear the sound from the right speaker only !!!!! ---- camera goes back (0; 75; -200) --> I hear the sound from the left speaker only !!!!! ---- camera goes left (-200; 75; 0) --> I hear the sound from the right speaker ---- camera goes right (200; 75; >0) --> I hear the sound from the right speaker only !!!!! ---- camera goes right (200; 75; <0) --> I hear the sound from the left speaker only !!!!! After many tests I took such coefficients, that sound sounded right (as in Variant1) : up=vec3df(0.0f, 0.0f, 1.0f);So why do ESEO_LINEAR_ROLLOFF needs different Position and UpVector ? 2 issue) in detail : . . . // set camera at (0;75;0)Camera at (0; 0; 0) ---- I hear max volume of sound Camera at (0; 500; 0) ---- volume become quiet (subside) Camera at (0; 1000; 0) ---- volume == 0 Camera at (0; 1500; 0) ---- volume become louder !!!!!!!!!!!!! Camera at (0; 2000; 0) ---- max volume !!!!!!!!!!! Camera at (0; 3500; 0) ---- sound with hoarseness, cracking !!!!!!!!!!! Now I use this up=vec3df(0.0f, 0.0f, 1.0f);but see the same result. Also tested with max distance 300.0f -- but the problem remains. Nikolaus, we need a patch :) |
||||
|
So why do ESEO_LINEAR_ROLLOFF needs different Position and UpVector ? Not sure, but probably, because there is a bug in the implementation and it works like this for your edge case. I think not a lot of people are using linear rolloff, so this is probably why this hasn't been discovered yet. |
|