SetSoundListenerPosition
From OxeyeWiki
(Difference between revisions)
(Created page with '{{AudioMethod | audio.setSoundListenerPosition(x, y, z [, speedX, speedY, speedZ]) | Sets the position from which oriented and tracked sounds' volume and panning is calculated. T...') |
|||
Line 19: | Line 19: | ||
audio.setSoundListenerPosition(0,0,0) | audio.setSoundListenerPosition(0,0,0) | ||
- | -- listening abit from above | + | -- first set orientation: [[setSoundListenerOrientation]] |
+ | audio.setSoundListenerOrientation(0,0,1,0,-1,0) | ||
+ | -- now listening abit from above. | ||
audio.setSoundListenerPosition(0,-10,0) | audio.setSoundListenerPosition(0,-10,0) | ||
Latest revision as of 13:20, 18 January 2010
audio.setSoundListenerPosition(x, y, z [, speedX, speedY, speedZ]) | ||
Sets the position from which oriented and tracked sounds' volume and panning is calculated. The relative speed of the listener and the sounds generates a doppler effect. | ||
Parameter | Expected Type | Description |
x | A number | Position in space, in meters. |
y | A number | Position in space, in meters. |
z | A number | Position in space, in meters. |
speedX | A number | The speed of the sound in space, for creation of doppler effects, in meters/second. |
speedY | A number | The speed of the sound in space, for creation of doppler effects, in meters/second. |
speedZ | A number | The speed of the sound in space, for creation of doppler effects, in meters/second. |
Returns | ||
Returns nothing. |
Daisymoon Audio Lib |
---|
Example
-- listen from the center of the world audio.setSoundListenerPosition(0,0,0) -- first set orientation: [[setSoundListenerOrientation]] audio.setSoundListenerOrientation(0,0,1,0,-1,0) -- now listening abit from above. audio.setSoundListenerPosition(0,-10,0) -- listening abit from left audio.setSoundListenerPosition(-10,0,0) local you = {x = 100, y = 100} local res = 1/32 -- 32 pixels is 1 meter. -- z set a bit negative to get less sudden panning. audio.setSoundListenerPosition(you.x*res,you.y*res,-300*res) -- moving too! you.speedX = 10 audio.setSoundListenerPosition(you.x*res,you.y*res,-300*res, you.speedX*res, 0, 0)